From ba270dd4b3bc20900d1e92a007ca5117a3ea5a07 Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Wed, 10 Jan 2024 12:57:53 -0300 Subject: [PATCH] Fix some tests and warnings --- tests/phpunit/BaseTestCase.php | 8 ++++++ .../feature/TestBooleanSearchOperators.php | 13 --------- tests/phpunit/feature/TestCoAuthorsPlus.php | 13 --------- tests/phpunit/feature/TestMetaKeyPattern.php | 27 ------------------- tests/phpunit/indexables/TestUser.php | 4 ++- 5 files changed, 11 insertions(+), 54 deletions(-) diff --git a/tests/phpunit/BaseTestCase.php b/tests/phpunit/BaseTestCase.php index b760dcc..f9b5032 100644 --- a/tests/phpunit/BaseTestCase.php +++ b/tests/phpunit/BaseTestCase.php @@ -19,6 +19,14 @@ class BaseTestCase extends \WP_UnitTestCase { */ protected $ep_factory; + /** + * Helps us keep track of actions that have fired + * + * @var array + * @since 2.3.0 + */ + protected $fired_actions = array(); + /** * Set up the test case. * diff --git a/tests/phpunit/feature/TestBooleanSearchOperators.php b/tests/phpunit/feature/TestBooleanSearchOperators.php index 8e753e9..a368369 100644 --- a/tests/phpunit/feature/TestBooleanSearchOperators.php +++ b/tests/phpunit/feature/TestBooleanSearchOperators.php @@ -61,19 +61,6 @@ public function testBoxSummary() { $this->assertStringContainsString( 'Allow boolean operators in search queries', $output ); } - /** - * Test box long text - * - * @since 1.2.0 - */ - public function testBoxLong() { - ob_start(); - $this->get_feature()->output_feature_box_long(); - $output = ob_get_clean(); - - $this->assertStringContainsString( 'Allows users to search using the following boolean operators:', $output ); - } - /** * Text query_uses_boolean_operators function * diff --git a/tests/phpunit/feature/TestCoAuthorsPlus.php b/tests/phpunit/feature/TestCoAuthorsPlus.php index bc7bd8f..d502dd5 100644 --- a/tests/phpunit/feature/TestCoAuthorsPlus.php +++ b/tests/phpunit/feature/TestCoAuthorsPlus.php @@ -77,19 +77,6 @@ public function testBoxSummary() { $this->assertStringContainsString( 'Add support for the Co-Authors Plus plugin in the Admin Post List screen by Author name', $output ); } - /** - * Test box long text - * - * @since 1.1.0 - */ - public function testBoxLong() { - ob_start(); - $this->get_feature()->output_feature_box_long(); - $output = ob_get_clean(); - - $this->assertStringContainsString( 'If using the Co-Authors Plus plugin and the Protected Content feature, enable this feature to visit the Admin Post List screen by Author name wp-admin/edit.php?author_name=<name> and see correct results.', $output ); - } - /** * Test filter out author name and id from Elasticsearch query * diff --git a/tests/phpunit/feature/TestMetaKeyPattern.php b/tests/phpunit/feature/TestMetaKeyPattern.php index 03b3de5..4918fc9 100644 --- a/tests/phpunit/feature/TestMetaKeyPattern.php +++ b/tests/phpunit/feature/TestMetaKeyPattern.php @@ -71,33 +71,6 @@ public function testBoxSummary() { $this->assertStringContainsString( 'Include or exclude meta key patterns.', $output ); } - /** - * Test the `output_feature_box_long` method. - * - * @group MetaKeyPattern - */ - public function testBoxLong() { - ob_start(); - $this->get_feature()->output_feature_box_long(); - $output = ob_get_clean(); - - $this->assertStringContainsString( 'This feature will give you the most control over the metadata indexed.', $output ); - } - - /** - * Test the `output_feature_box_settings` method. - * - * @group MetaKeyPattern - */ - public function testOutputFeatureBoxSettings() { - ob_start(); - $this->get_feature()->output_feature_box_settings(); - $output = ob_get_clean(); - - $this->assertStringContainsString( 'Allow patterns', $output ); - $this->assertStringContainsString( 'Deny patterns', $output ); - } - /** * Test the `is_match` method. * diff --git a/tests/phpunit/indexables/TestUser.php b/tests/phpunit/indexables/TestUser.php index d1483de..41f13c4 100644 --- a/tests/phpunit/indexables/TestUser.php +++ b/tests/phpunit/indexables/TestUser.php @@ -77,7 +77,9 @@ protected function get_feature() { public function createAndIndexUsers() { ElasticPress\Indexables::factory()->get( 'user' )->sync_manager->add_to_queue( 1 ); - ElasticPress\Indexables::factory()->get( 'user' )->bulk_index( array_keys( ElasticPress\Indexables::factory()->get( 'user' )->sync_manager->sync_queue ) ); + ElasticPress\Indexables::factory()->get( 'user' )->bulk_index( + array_keys( ElasticPress\Indexables::factory()->get( 'user' )->sync_manager->sync_queue[1] ) + ); $user_1 = $this->ep_factory->user->create( [