diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a620c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tests/_output diff --git a/tests/acceptance/ElasticSearchCest.php b/tests/acceptance/ElasticSearchCest.php index b4d4f2c..a7ae4c8 100644 --- a/tests/acceptance/ElasticSearchCest.php +++ b/tests/acceptance/ElasticSearchCest.php @@ -38,17 +38,13 @@ public function testTermSearch( AcceptanceTester $I ) { 'Omega', ]; - // Create terms. - foreach ( $tags as $tag ) { - $I->haveTermInDatabase( $tag, 'post_tag' ); - } - $I->seeTermInDatabase( [ 'slug' => 'theta' ] ); - - $this->_index(); - $I->loginAsAdmin(); $I->amOnAdminPage( 'edit-tags.php?taxonomy=post_tag' ); foreach ( $tags as $tag ) { + $I->submitForm( '#addtag', [ + 'tag-name' => $tag, + ] ); + $I->seeTermInDatabase( [ 'slug' => strtolower( $tag ) ] ); $I->see( $tag, '.column-primary' ); } @@ -58,14 +54,19 @@ public function testTermSearch( AcceptanceTester $I ) { $I->see( 'Alpha', '.column-primary' ); $I->submitForm( '#wpbody .search-form', [ - 's' => 'the', + 's' => 'alp', ] ); - $I->see( 'Theta', '.column-primary' ); + $I->see( 'Alpha', '.column-primary' ); $I->submitForm( '#wpbody .search-form', [ 's' => 'thet', ] ); $I->see( 'Theta', '.column-primary' ); + + $I->submitForm( '#wpbody .search-form', [ + 's' => 'theto', + ] ); + $I->see( 'Theta', '.column-primary' ); } /** @@ -337,7 +338,7 @@ public static function _disableCavalcade() { protected function _index( string $options = '' ) { // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_exec exec( sprintf( - 'WPBROWSER_HOST_REQUEST=1 wp elasticpress index --network-wide --setup %s', + 'WPBROWSER_HOST_REQUEST=1 wp elasticpress index --network-wide --setup --yes %s', $options ), $output ); }