Skip to content

Commit

Permalink
Fix tests, pass --yes to index command
Browse files Browse the repository at this point in the history
  • Loading branch information
roborourke committed Jan 19, 2022
1 parent dc7dcfe commit 3fb7b12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/_output
23 changes: 12 additions & 11 deletions tests/acceptance/ElasticSearchCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}

Expand All @@ -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' );
}

/**
Expand Down Expand Up @@ -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 );
}
Expand Down

0 comments on commit 3fb7b12

Please sign in to comment.