Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
WP Revisions Control
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
WP Plugins
WP Revisions Control
Commits
9e9d5c06
Commit
9e9d5c06
authored
5 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
PHPCS
parent
4f9ab32b
No related branches found
No related tags found
1 merge request
!4
Add bulk actions
Pipeline
#1062
failed with stages
in 2 minutes and 42 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.phpcs.xml.dist
+0
-1
0 additions, 1 deletion
.phpcs.xml.dist
tests/bootstrap.php
+13
-8
13 additions, 8 deletions
tests/bootstrap.php
tests/test-purges.php
+2
-2
2 additions, 2 deletions
tests/test-purges.php
tests/test-ui.php
+2
-2
2 additions, 2 deletions
tests/test-ui.php
with
17 additions
and
13 deletions
.phpcs.xml.dist
+
0
−
1
View file @
9e9d5c06
...
...
@@ -6,7 +6,6 @@
<file>
.
</file>
<exclude-pattern>
/vendor/
</exclude-pattern>
<exclude-pattern>
/node_modules/
</exclude-pattern>
<exclude-pattern>
/tests/*
</exclude-pattern>
<!-- How to scan -->
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
...
...
This diff is collapsed.
Click to expand it.
tests/bootstrap.php
+
13
−
8
View file @
9e9d5c06
...
...
@@ -5,34 +5,39 @@
* @package WP_Revisions_Control
*/
$_tests_dir
=
getenv
(
'WP_TESTS_DIR'
);
$
wp_revisions_control_tests
_tests_dir
=
getenv
(
'WP_TESTS_DIR'
);
if
(
!
$_tests_dir
)
{
$_tests_dir
=
rtrim
(
sys_get_temp_dir
(),
'/\\'
)
.
'/wordpress-tests-lib'
;
if
(
!
$
wp_revisions_control_tests
_tests_dir
)
{
$
wp_revisions_control_tests
_tests_dir
=
rtrim
(
sys_get_temp_dir
(),
'/\\'
)
.
'/wordpress-tests-lib'
;
}
if
(
!
file_exists
(
$_tests_dir
.
'/includes/functions.php'
)
)
{
echo
"Could not find
$_tests_dir
/includes/functions.php, have you run bin/install-wp-tests.sh ?"
.
PHP_EOL
;
// WPCS: XSS ok.
if
(
!
file_exists
(
$
wp_revisions_control_tests
_tests_dir
.
'/includes/functions.php'
)
)
{
echo
"Could not find
$
wp_revisions_control_tests
_tests_dir
/includes/functions.php, have you run bin/install-wp-tests.sh ?"
.
PHP_EOL
;
// WPCS: XSS ok.
exit
(
1
);
}
// Give access to tests_add_filter() function.
require_once
$_tests_dir
.
'/includes/functions.php'
;
require_once
$
wp_revisions_control_tests
_tests_dir
.
'/includes/functions.php'
;
/**
* Stub admin-only function not needed for testing.
*/
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
if
(
!
function_exists
(
'post_revisions_meta_box'
)
)
{
/**
* Stub for Core's revisions meta box.
*/
function
post_revisions_meta_box
()
{}
}
// phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
/**
* Manually load the plugin being tested.
*/
function
_manually_load_plugin
()
{
function
wp_revisions_control_tests
_manually_load_plugin
()
{
require
dirname
(
dirname
(
__FILE__
)
)
.
'/wp-revisions-control.php'
;
}
tests_add_filter
(
'muplugins_loaded'
,
'_manually_load_plugin'
);
// Start up the WP testing environment.
require
$_tests_dir
.
'/includes/bootstrap.php'
;
require
$
wp_revisions_control_tests
_tests_dir
.
'/includes/bootstrap.php'
;
This diff is collapsed.
Click to expand it.
tests/test-purges.php
+
2
−
2
View file @
9e9d5c06
...
...
@@ -39,7 +39,7 @@ class TestPurges extends WP_UnitTestCase {
'Failed to assert that there are revisions to purge.'
);
$purge
=
WP_Revisions_Control
::
get_instance
()
->
do_purge_all
(
$post_id
);
$purge
=
WP_Revisions_Control
::
get_instance
()
->
do_purge_all
(
$post_id
);
$revisions_remaining
=
count
(
wp_get_post_revisions
(
$post_id
)
);
$this
->
assertEquals
(
...
...
@@ -93,7 +93,7 @@ class TestPurges extends WP_UnitTestCase {
'Failed to assert that post is limited to a given number of revisions.'
);
$purge
=
WP_Revisions_Control
::
get_instance
()
->
do_purge_excess
(
$post_id
);
$purge
=
WP_Revisions_Control
::
get_instance
()
->
do_purge_excess
(
$post_id
);
$revisions_remaining
=
count
(
wp_get_post_revisions
(
$post_id
)
);
$this
->
assertEquals
(
...
...
This diff is collapsed.
Click to expand it.
tests/test-ui.php
+
2
−
2
View file @
9e9d5c06
...
...
@@ -27,7 +27,7 @@ class TestUI extends WP_UnitTestCase {
* Test meta box with no meta set.
*/
public
function
test_no_meta
()
{
$post_id
=
$this
->
factory
->
post
->
create
();
$post_id
=
$this
->
factory
->
post
->
create
();
ob_start
();
WP_Revisions_Control
::
get_instance
()
->
revisions_meta_box
(
get_post
(
$post_id
)
);
...
...
@@ -44,7 +44,7 @@ class TestUI extends WP_UnitTestCase {
* Test meta box with no limit set.
*/
public
function
test_no_limit
()
{
$post_id
=
$this
->
factory
->
post
->
create
();
$post_id
=
$this
->
factory
->
post
->
create
();
update_post_meta
(
$post_id
,
static
::
$meta_key
,
-
1
);
ob_start
();
...
...
This diff is collapsed.
Click to expand it.
Erick Hitter
@ethitter
mentioned in commit
f9201143
·
5 years ago
mentioned in commit
f9201143
mentioned in commit f9201143da0d7f63697c0b75d6771a858752f166
Toggle commit list
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