Skip to content
Snippets Groups Projects
Commit f16eee49 authored by Erick Hitter's avatar Erick Hitter
Browse files

Fix *list tests to respect underlying functions

parent 8dd650f8
No related branches found
No related tags found
No related merge requests found
......@@ -16,16 +16,30 @@ class SampleTest extends WP_UnitTestCase {
/**
* Test whitelisted commands
*/
function test_whitelist() {
$this->assertTrue( WP_CLI_Cron_Control_Offload\is_command_allowed( 'wp post list' ) );
$this->assertTrue( WP_CLI_Cron_Control_Offload\is_command_allowed( 'post list' ) );
function test_whitelist_using_is_command_allowed() {
$this->assertTrue( WP_CLI_Cron_Control_Offload\is_command_allowed( 'post' ) );
}
/**
* Test blacklisted commands
*/
function test_blacklist() {
$this->assertFalse( WP_CLI_Cron_Control_Offload\is_command_allowed( 'wp cli info' ) );
$this->assertFalse( WP_CLI_Cron_Control_Offload\is_command_allowed( 'cli info' ) );
function test_blacklist_using_is_command_allowed() {
$this->assertFalse( WP_CLI_Cron_Control_Offload\is_command_allowed( 'cli' ) );
}
/**
* Test whitelisted command validation
*/
function test_whitelist_using_validate_command() {
$this->assertTrue( is_string( WP_CLI_Cron_Control_Offload\validate_command( 'wp post list' ) ) );
$this->assertTrue( is_string( WP_CLI_Cron_Control_Offload\validate_command( 'post list' ) ) );
}
/**
* Test blacklisted command validation
*/
function test_blacklist_using_validate_command() {
$this->assertTrue( is_wp_error( WP_CLI_Cron_Control_Offload\validate_command( 'wp cli info' ) ) );
$this->assertTrue( is_wp_error( WP_CLI_Cron_Control_Offload\validate_command( 'cli info' ) ) );
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment