Skip to content

Commit 09bd7e2

Browse files
committed
Fix tests for no robots
1 parent 82a7f70 commit 09bd7e2

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

phpunit.xml.dist

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
convertNoticesToExceptions="true"
88
convertWarningsToExceptions="true"
99
verbose="true"
10-
syntaxCheck="true"
1110
>
1211
<php>
1312
<const name="PHPUNIT_WPJM_TESTSUITE" value="true"/>

tests/php/tests/includes/test_class.wp-job-manager-post-types.php

+15-6
Original file line numberDiff line numberDiff line change
@@ -921,14 +921,23 @@ public function test_noindex_expired_filled_job_listings_expired() {
921921
);
922922
$this->assertEquals( 1, $jobs->post_count );
923923
$this->assertTrue( $jobs->is_single );
924-
$desired_result = $this->get_wp_no_robots();
925924
while ( $jobs->have_posts() ) {
926925
$jobs->the_post();
927-
$post = get_post();
928-
ob_start();
929-
$instance->noindex_expired_filled_job_listings();
930-
$result = ob_get_clean();
931-
$this->assertEquals( $desired_result, $result );
926+
927+
if ( function_exists('wp_robots') ) {
928+
$instance->noindex_expired_filled_job_listings();
929+
ob_start();
930+
$wp_robots = wp_robots();
931+
$result = ob_get_clean();
932+
$this->assertNotFalse( strpos( $result, 'noindex' ) );
933+
} else {
934+
$desired_result = $this->get_wp_no_robots();
935+
$post = get_post();
936+
ob_start();
937+
$instance->noindex_expired_filled_job_listings();
938+
$result = ob_get_clean();
939+
$this->assertEquals( $desired_result, $result );
940+
}
932941
}
933942
}
934943

0 commit comments

Comments
 (0)