Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp-basic-requirements
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
wp-basic-requirements
Commits
60f5ad25
Commit
60f5ad25
authored
5 years ago
by
vasili.guruli
Browse files
Options
Downloads
Patches
Plain Diff
FIxed plugin name display in admin panel
parent
60b9a528
No related branches found
No related tags found
1 merge request
!23
Small fix with plugin name
Pipeline
#10399
passed with warnings with stages
in 1 minute and 25 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+7
-2
7 additions, 2 deletions
CHANGELOG.md
src/Basic_Requirement_Checker_Factory.php
+3
-2
3 additions, 2 deletions
src/Basic_Requirement_Checker_Factory.php
tests/unit/Test_Basic_Requirement_Checker_Factory.php
+47
-47
47 additions, 47 deletions
tests/unit/Test_Basic_Requirement_Checker_Factory.php
with
57 additions
and
51 deletions
CHANGELOG.md
+
7
−
2
View file @
60f5ad25
## [3.1.1] - 2019-11-14
### Feature
## [3.2.1] - 2019-11-15
### Fixed
-
Fixed plugin version notice
-
Fixed required plugin name display in admin notices
## [3.2.0] - 2019-11-14
### Added
-
Minimum required plugin version notice
## [3.1.0] - 2019-11-13
...
...
This diff is collapsed.
Click to expand it.
src/Basic_Requirement_Checker_Factory.php
+
3
−
2
View file @
60f5ad25
...
...
@@ -42,14 +42,15 @@
$requirements_checker
=
new
WPDesk_Basic_Requirement_Checker_With_Update_Disable
(
$plugin_file
,
$plugin_name
,
$text_domain
,
$text_domain
,
$requirements
[
'php'
],
$requirements
[
'wp'
]
);
if
(
isset
(
$requirements
[
'plugins'
]
)
)
{
foreach
(
$requirements
[
'plugins'
]
as
$requirement
)
{
$requirements_checker
->
add_plugin_require
(
$requirement
[
'name'
],
$requirement
[
'nice_name'
],
$requirement
[
'version'
]
);
$version
=
isset
(
$requirement
[
'version'
]
)
?
$requirement
[
'version'
]
:
null
;
$requirements_checker
->
add_plugin_require
(
$requirement
[
'name'
],
$requirement
[
'nice_name'
],
$version
);
}
$requirements_checker
->
transient_delete_on_plugin_version_changed
();
...
...
This diff is collapsed.
Click to expand it.
tests/unit/Test_Basic_Requirement_Checker_Factory.php
+
47
−
47
View file @
60f5ad25
<?php
class
Test_Basic_Requirement_Checker_Factory
extends
PHPUnit\Framework\TestCase
{
public
function
test_can_create_checker_withn_valid_requirements
()
{
$existing_locale
=
'pl_PL'
;
$requirements
=
array
(
'php'
=>
'5.6'
,
'wp'
=>
'4.5'
,
'plugins'
=>
array
(
array
(
'name'
=>
'woocommerce/woocommerce.php'
,
'nice_name'
=>
'WooCommerce'
,
'version'
=>
'1.0'
class
Test_Basic_Requirement_Checker_Factory
extends
PHPUnit\Framework\TestCase
{
public
function
test_can_create_checker_withn_valid_requirements
()
{
$existing_locale
=
'pl_PL'
;
$requirements
=
array
(
'php'
=>
'5.6'
,
'wp'
=>
'4.5'
,
'plugins'
=>
array
(
array
(
'name'
=>
'woocommerce/woocommerce.php'
,
'nice_name'
=>
'WooCommerce'
,
'version'
=>
'1.0'
),
),
),
'repo_plugins'
=>
array
(
array
(
'name'
=>
'flexible-checkout-fields/flexible-checkout-fields.php
'
,
'version'
=>
'1.0
'
,
'nice_name'
=>
'Flexible Checkout Fields'
,
'repo_plugins'
=>
array
(
array
(
'name'
=>
'flexible-checkout-fields/flexible-checkout-fields.php'
,
'version'
=>
'1.0
'
,
'nice_name'
=>
'Flexible Checkout Fields
'
,
)
,
),
)
,
);
WP_Mock
::
wpFunction
(
'get
_locale
'
)
->
andReturn
(
$existing_locale
);
$factory
=
new
WPDesk_Basic_Requirement_Checker_Factory
(
);
$checker
=
$factory
->
create_from_requirement_array
(
'whatever'
,
'whatever'
,
$requirements
);
WP_Mock
::
wpFunction
(
'get_plugins'
)
->
andReturn
(
array
()
);
WP_Mock
::
wpFunction
(
'get_option'
)
->
withArgs
(
array
(
'active_plugins'
,
array
()
)
)
->
andReturn
(
array
()
);
WP_Mock
::
passthruFunction
(
'
self_admin_url
'
);
WP_Mock
::
passthruFunction
(
'wp_
kses
'
);
WP_Mock
::
passthruFunction
(
'wp_nonce
_url
'
);
WP_Mock
::
passthruFunction
(
'
wp_create_nonce
'
);
WP_Mock
::
passthruFunction
(
'admin_url'
);
$this
->
assertFalse
(
$checker
->
are_requirements_met
(),
'2 plugins required and there should be none activated'
);
$this
->
expectOutputRegex
(
'/
Flexible Checkout Fields
/'
);
$this
->
expectOutputRegex
(
'/WooCommerce/'
);
$checker
->
handle_render_notices_action
();
)
;
WP_Mock
::
wpFunction
(
'get_locale'
)
->
andReturn
(
$existing
_locale
)
;
$factory
=
new
WPDesk_Basic_Requirement_Checker_Factory
();
$checker
=
$factory
->
create_from_requirement_array
(
'whatever'
,
'whatever'
,
$requirements
);
WP_Mock
::
wpFunction
(
'get_plugins'
)
->
andReturn
(
array
()
)
;
WP_Mock
::
wpFunction
(
'get_option'
)
->
withArgs
(
array
(
'active_plugins'
,
array
()
)
)
->
andReturn
(
array
()
)
;
WP_Mock
::
passthruFunction
(
'self_admin_url'
);
WP_Mock
::
passthruFunction
(
'
wp_kses
'
);
WP_Mock
::
passthruFunction
(
'wp_
nonce_url
'
);
WP_Mock
::
passthruFunction
(
'wp_
create_
nonce'
);
WP_Mock
::
passthruFunction
(
'
admin_url
'
);
$this
->
assertFalse
(
$checker
->
are_requirements_met
(),
'2 plugins required and there should be none activated'
);
$this
->
expectOutputRegex
(
'/Flexible Checkout Fields/'
);
$this
->
expectOutputRegex
(
'/
WooCommerce
/'
);
$checker
->
handle_render_notices_action
(
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment