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

Introduce first tests, and fix test structure to appease PHPCS

parent f3511ee9
Branches
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
> >
<testsuites> <testsuites>
<testsuite> <testsuite>
<directory prefix="test-" suffix=".php">./tests/</directory> <directory suffix=".php">./tests/tests/</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
</phpunit> </phpunit>
<?php
/**
* Class SampleTest
*
* @package WP_CLI_Cron_Control_Offload
*/
/**
* Sample test case.
*/
class SampleTest extends WP_UnitTestCase {
/**
* A single example test.
*/
function test_sample() {
// Replace this with some actual testing code.
$this->assertTrue( true );
}
}
<?php
/**
* Test plugin's common functions
*
* @package WP_CLI_Cron_Control_Offload
*/
namespace Automattic\WP\WP_CLI_Cron_Control_Offload\Tests;
use Automattic\WP\WP_CLI_Cron_Control_Offload;
use WP_UnitTestCase;
/**
* Sample test case.
*/
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' ) );
}
/**
* 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' ) );
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment