Skip to content

Commit 31984a0

Browse files
Tests: Refactor filter assertion in get_post() tests
Moves the filter property assertion into the appropriate conditional blocks and removes the redundant final if statement for better code structure. Co-authored-by: gemini-cli <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent cbddb78 commit 31984a0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tests/phpunit/tests/post/getPost.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,12 @@ public function test_get_post( callable $input, string $output, string $filter,
7676
$this->assertIsArray( $post );
7777
$this->assertArrayHasKey( 'ID', $post );
7878
$this->assertSame( $expected_id_val, $post['ID'] );
79+
$this->assertArrayHasKey( 'filter', $post );
80+
$this->assertSame( $filter, $post['filter'] );
7981
} elseif ( ARRAY_N === $output ) {
8082
$this->assertIsArray( $post );
8183
$this->assertContains( $expected_id_val, $post );
84+
$this->assertContains( $filter, $post );
8285
} else {
8386
$this->assertInstanceOf( WP_Post::class, $post );
8487

@@ -87,9 +90,6 @@ public function test_get_post( callable $input, string $output, string $filter,
8790
}
8891

8992
$this->assertSame( $expected_id_val, $post->ID );
90-
}
91-
92-
if ( $post instanceof WP_Post ) {
9393
$this->assertSame( $filter, $post->filter );
9494
}
9595
}

0 commit comments

Comments
 (0)