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
Issue boards
Milestones
Wiki
Code
Merge requests
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
wp-basic-requirements
Commits
b7d6ab90
Commit
b7d6ab90
authored
5 years ago
by
dyszczo
Browse files
Options
Downloads
Patches
Plain Diff
factory tests
parent
89266f6e
No related branches found
No related tags found
1 merge request
!13
Feature/repository plugins
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/unit/Test_Basic_Requirement_Checker_Factory.php
+47
-0
47 additions, 0 deletions
tests/unit/Test_Basic_Requirement_Checker_Factory.php
with
47 additions
and
0 deletions
tests/unit/Test_Basic_Requirement_Checker_Factory.php
0 → 100644
+
47
−
0
View file @
b7d6ab90
<?php
class
Test_Basic_Requirement_Checker_Factory
extends
PHPUnit\Framework\TestCase
{
public
function
test_can_create_checker_withn_valid_requirements
()
{
$requirements
=
array
(
'php'
=>
'5.6'
,
'wp'
=>
'4.5'
,
'plugins'
=>
array
(
array
(
'name'
=>
'woocommerce/woocommerce.php'
,
'nice_name'
=>
'WooCommerce'
,
),
),
'repo_plugins'
=>
array
(
array
(
'name'
=>
'flexible-checkout-fields/flexible-checkout-fields.php'
,
'version'
=>
'1.0'
,
'nice_name'
=>
'Flexible Checkout Fields'
,
),
),
);
$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