Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
burhandodhy committed Jan 24, 2025
1 parent 208d931 commit af8b995
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
14 changes: 6 additions & 8 deletions includes/classes/Indexable/Post/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,19 @@ class Post extends Indexable {
public $support_indexing_advanced_pagination = true;

/**
* Create indexable and initialize dependencies
* Instantiate the indexable SyncManager and QueryIntegration
*
* @since 3.0
* @since 5.2.0
* @return void
*/
public function __construct() {

$this->sync_manager = new SyncManager( $this->slug );
$this->query_integration = new QueryIntegration( $this->slug );
}

public function setup() {
$this->labels = [
'plural' => esc_html__( 'Posts', 'elasticpress' ),
'singular' => esc_html__( 'Post', 'elasticpress' ),
];

$this->sync_manager = new SyncManager( $this->slug );
$this->query_integration = new QueryIntegration( $this->slug );
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/php/features/TestAutosuggest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ protected function get_feature() {
*/
public function testConstruct() {
$instance = new ElasticPress\Feature\Autosuggest\Autosuggest();
$instance->set_i18n_strings();

$this->assertEquals( 'autosuggest', $instance->slug );
$this->assertEquals( 'Autosuggest', $instance->title );
Expand Down
1 change: 1 addition & 0 deletions tests/php/features/TestComments.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ protected function get_feature() {
*/
public function testConstruct() {
$instance = new ElasticPress\Feature\Comments\Comments();
$instance->set_i18n_strings();

$this->assertEquals( 'comments', $instance->slug );
$this->assertEquals( 'Comments', $instance->title );
Expand Down
1 change: 1 addition & 0 deletions tests/php/features/TestDidYouMean.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function set_up() {
*/
public function testConstruct() {
$instance = new ElasticPress\Feature\DidYouMean\DidYouMean();
$instance->set_i18n_strings();

$this->assertEquals( 'did-you-mean', $instance->slug );
$this->assertEquals( 'Did You Mean', $instance->title );
Expand Down
2 changes: 2 additions & 0 deletions tests/php/features/TestSearchOrdering.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public function get_feature() {
*/
public function testConstruct() {
$instance = new \ElasticPress\Feature\SearchOrdering\SearchOrdering();
$instance->set_i18n_strings();

$this->assertSame( 'searchordering', $instance->slug );
$this->assertSame( 'Custom Search Results', $instance->title );
}
Expand Down
1 change: 1 addition & 0 deletions tests/php/indexables/TestPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -6167,6 +6167,7 @@ function ( $args ) {
public function testPostConstructor() {

$post = new \ElasticPress\Indexable\Post\Post();
$post->setup();

$this->assertSame( 'Posts', $post->labels['plural'] );
$this->assertSame( 'Post', $post->labels['singular'] );
Expand Down

0 comments on commit af8b995

Please sign in to comment.