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

Test coverage

parent 3e5084a4
1 merge request!5Add block-editor support
Pipeline #4959 failed with stages
in 2 minutes and 7 seconds
...@@ -8,9 +8,8 @@ ...@@ -8,9 +8,8 @@
convertWarningsToExceptions="true" convertWarningsToExceptions="true"
> >
<testsuites> <testsuites>
<testsuite> <testsuite name="Autopaging">
<directory prefix="test-" suffix=".php">./tests/</directory> <directory prefix="test-" suffix=".php">./tests/</directory>
<exclude>./tests/test-sample.php</exclude>
</testsuite> </testsuite>
</testsuites> </testsuites>
</phpunit> </phpunit>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* @package Automatically_Paginate_Posts * @package Automatically_Paginate_Posts
*/ */
$autopaging_tests_dir = getenv( 'WPautopaging_tests_dir' ); $autopaging_tests_dir = getenv( 'WP_TESTS_DIR' );
if ( ! $autopaging_tests_dir ) { if ( ! $autopaging_tests_dir ) {
$autopaging_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib'; $autopaging_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
......
<?php
/**
* Test main plugin class.
*
* @package Automatically_Paginate_Posts
*/
/**
* @coversDefaultClass Automatically_Paginate_Posts
*/
class SampleTest extends WP_UnitTestCase {
protected $_instance;
public function set_up() {
parent::set_up();
$this->_instance = new Automatically_Paginate_Posts();
}
/**
* @covers ::__get()
*/
public function test___get() {
$this->assertEquals(
'_disable_autopaging',
$this->_instance->meta_key,
'Failed to assert meta key matched expected value.'
);
// TODO: consider testing `post_types` along with a filter.
$this->assertNull(
$this->_instance->unit_test,
'Failed to assert that unsupported key returns null.'
);
}
/**
* @covers ::filter_plugin_action_links()
*/
public function test_filter_plugin_action_links() {
$this->assertEmpty(
$this->_instance->filter_plugin_action_links(
array(),
'unit-test.php'
),
'Failed to assert that no change is made for other plugins..'
);
$this->assertArrayHasKey(
'settings',
$this->_instance->filter_plugin_action_links(
array(),
'automatically-paginate-posts/automatically-paginate-posts.php'
),
'Failed to assert that settings link is added for this plugin.'
);
}
}
<?php
/**
* Class SampleTest
*
* @package Automatically_Paginate_Posts
*/
/**
* Sample test case.
*/
class SampleTest extends WP_UnitTestCase {
/**
* A single example test.
*/
public function test_sample() {
// Replace this with some actual testing code.
$this->assertTrue( true );
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment