Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp-cli-cron-control-offload
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
WP Plugins
wp-cli-cron-control-offload
Commits
797e802e
Commit
797e802e
authored
7 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Review feedback
parent
7e7fe4c9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/class-command.php
+0
-5
0 additions, 5 deletions
includes/class-command.php
tests/tests/class-plugin-functions.php
+29
-1
29 additions, 1 deletion
tests/tests/class-plugin-functions.php
with
29 additions
and
6 deletions
includes/class-command.php
+
0
−
5
View file @
797e802e
...
...
@@ -28,11 +28,6 @@ class Command extends WP_CLI_Command {
*/
public
function
create
(
$args
,
$assoc_args
)
{
$command
=
WP_CLI\Utils\get_flag_value
(
$assoc_args
,
'command'
,
''
);
$command
=
validate_command
(
$command
);
if
(
is_wp_error
(
$command
)
)
{
WP_CLI
::
error
(
$command
->
get_error_message
()
);
}
$timestamp
=
WP_CLI\Utils\get_flag_value
(
$assoc_args
,
'timestamp'
,
null
);
if
(
is_numeric
(
$timestamp
)
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/tests/class-plugin-functions.php
+
29
−
1
View file @
797e802e
...
...
@@ -51,11 +51,18 @@ class Plugin_Functions extends WP_UnitTestCase {
* Test whitelisted command validation
*
* @dataProvider whitelisted_command_provider
*
* @param string $command Command to test.
*/
function
test_whitelist_using_validate_command
(
$command
)
{
$this
->
assertTrue
(
is_string
(
WP_CLI_Cron_Control_Offload\validate_command
(
$command
)
)
);
}
/**
* Data provider for command whitelisting
*
* @return array
*/
function
whitelisted_command_provider
()
{
return
array
(
array
(
'wp post list'
),
...
...
@@ -67,11 +74,18 @@ class Plugin_Functions extends WP_UnitTestCase {
* Test blacklisted command validation
*
* @dataProvider blacklisted_command_provider
*
* @param string $command Command to test.
*/
function
test_blacklist_using_validate_command
(
$command
)
{
$this
->
assertWPError
(
WP_CLI_Cron_Control_Offload\validate_command
(
$command
)
);
}
/**
* Data provider for command blacklisting
*
* @return array
*/
function
blacklisted_command_provider
()
{
return
array
(
array
(
'wp cli info'
),
...
...
@@ -97,16 +111,23 @@ class Plugin_Functions extends WP_UnitTestCase {
* Test scheduling several of the same blocked event
*
* @dataProvider blocked_events_provider
*
* @param string $command Command to test.
*/
function
test_blocked_event_scheduling
(
$command
)
{
$this
->
assertWPError
(
WP_CLI_Cron_Control_Offload\schedule_cli_command
(
$command
)
);
}
/**
* Data provider for blocked-event scheduling
*
* @return array
*/
function
blocked_events_provider
()
{
return
array
(
array
(
'wp cli info'
),
// Should fail, is a blocked event.
array
(
'wp cli info'
),
// Should fail as a blocked event, would otherwise fail as a duplicate.
array
(
'cli info'
),
// Should also fail as a blocked event, though normalization would also block it as a duplicate.
array
(
'cli info'
),
// Should also fail as a blocked event, though normalization would also block it as a duplicate.
);
}
...
...
@@ -114,11 +135,18 @@ class Plugin_Functions extends WP_UnitTestCase {
* Test each blocked bash operator
*
* @dataProvider invalid_bash_operators_provider
*
* @param string $command Command to test.
*/
function
test_for_invalid_bash_operators
(
$command
)
{
$this
->
assertWPError
(
WP_CLI_Cron_Control_Offload\validate_command
(
$command
)
);
}
/**
* Data provider for unsupported bash operators
*
* @return array
*/
function
invalid_bash_operators_provider
()
{
return
array
(
array
(
'post list & date'
),
...
...
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