Skip to content

Commit

Permalink
fix: removing use of assertObjectHasProperty
Browse files Browse the repository at this point in the history
Older version of PHPUnit do not have this function available. Updating to workaround: `assertTrue( property_exists( $obj, 'prop' ) )`
  • Loading branch information
eddiesshop committed Sep 9, 2023
1 parent e7c7792 commit b6b959b
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/test-coauthors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -1233,11 +1233,11 @@ public function test_assign_post_authors_from_coauthors_who_are_linked() {
$this->isInstanceOf( WP_User::class )
)
);
$this->assertObjectHasProperty( 'type', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'type' ) );
$this->assertEquals( 'guest-author', $linked_author_1->type );
$this->assertObjectHasProperty( 'is_wp_user', $linked_author_1 );
$this->asserTrue( property_exists( $linked_author_1, 'is_wp_user' ) );
$this->assertTrue( $linked_author_1->is_wp_user );
$this->assertObjectHasProperty( 'wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'wp_user' ) );
$this->assertInstanceOf( WP_User::class, $linked_author_1->wp_user );
$this->assertEquals( $this->author2->ID, $linked_author_1->wp_user->ID );

Expand All @@ -1249,11 +1249,11 @@ public function test_assign_post_authors_from_coauthors_who_are_linked() {
$this->isInstanceOf( WP_User::class )
)
);
$this->assertObjectHasProperty( 'type', $linked_author_2 );
$this->assertTrue( property_exists( $linked_author_2, 'type' ) );
$this->assertEquals( 'guest-author', $linked_author_2->type );
$this->assertObjectHasProperty( 'is_wp_user', $linked_author_2 );
$this->assertTrue( property_exists( $linked_author_2, 'is_wp_user' ) );
$this->assertTrue( $linked_author_2->is_wp_user );
$this->assertObjectHasProperty( 'wp_user', $linked_author_2 );
$this->assertTrue( property_exists( $linked_author_2, 'wp_user' ) );
$this->assertInstanceOf( WP_User::class, $linked_author_2->wp_user );
$this->assertEquals( $this->author3->ID, $linked_author_2->wp_user->ID );

Expand Down Expand Up @@ -1346,11 +1346,11 @@ public function test_append_post_authors_from_coauthors_one_of_whom_is_linked()
$this->isInstanceOf( WP_User::class )
)
);
$this->assertObjectHasProperty( 'type', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'type' ) );
$this->assertEquals( 'guest-author', $linked_author_1->type );
$this->assertObjectHasProperty( 'is_wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'is_wp_user' ) );
$this->assertTrue( $linked_author_1->is_wp_user );
$this->assertObjectHasProperty( 'wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'wp_user' ) );
$this->assertInstanceOf( WP_User::class, $linked_author_1->wp_user );
$this->assertEquals( $this->author3->ID, $linked_author_1->wp_user->ID );

Expand Down Expand Up @@ -1556,9 +1556,9 @@ public function test_assign_multiple_post_authors_only_one_linked_passed_last()
$this->isInstanceOf( WP_User::class )
)
);
$this->assertObjectHasProperty( 'is_wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'is_wp_user' ) );
$this->assertTrue( $linked_author_1->is_wp_user );
$this->assertObjectHasProperty( 'wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'wp_user' ) );
$this->assertInstanceOf( WP_User::class, $linked_author_1->wp_user );
$this->assertEquals( $this->author3->ID, $linked_author_1->wp_user->ID );

Expand Down Expand Up @@ -1655,9 +1655,9 @@ public function test_assign_multiple_post_authors_one_user_before_one_linked_pas
$this->isInstanceOf( WP_User::class )
)
);
$this->assertObjectHasProperty( 'is_wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'is_wp_user' ) );
$this->assertTrue( $linked_author_1->is_wp_user );
$this->assertObjectHasProperty( 'wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'wp_user' ) );
$this->assertInstanceOf( WP_User::class, $linked_author_1->wp_user );
$this->assertEquals( $this->author3->ID, $linked_author_1->wp_user->ID );

Expand Down Expand Up @@ -1752,9 +1752,9 @@ public function test_assign_multiple_post_authors_one_linked_passed_first() {
$this->isInstanceOf( WP_User::class )
)
);
$this->assertObjectHasProperty( 'is_wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'is_wp_user' ) );
$this->assertTrue( $linked_author_1->is_wp_user );
$this->assertObjectHasProperty( 'wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'wp_user' ) );
$this->assertInstanceOf( WP_User::class, $linked_author_1->wp_user );
$this->assertEquals( $this->author3->ID, $linked_author_1->wp_user->ID );

Expand Down Expand Up @@ -1849,9 +1849,9 @@ public function test_assign_multiple_post_authors_one_linked_passed_using_user_l
$this->isInstanceOf( WP_User::class )
)
);
$this->assertObjectHasProperty( 'is_wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'is_wp_user' ) );
$this->assertTrue( $linked_author_1->is_wp_user );
$this->assertObjectHasProperty( 'wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'wp_user' ) );
$this->assertInstanceOf( WP_User::class, $linked_author_1->wp_user );
$this->assertEquals( $this->author3->ID, $linked_author_1->wp_user->ID );

Expand Down Expand Up @@ -2007,9 +2007,9 @@ public function test_assign_post_authors_from_post_with_no_author() {
$this->isInstanceOf( WP_User::class )
)
);
$this->assertObjectHasProperty( 'is_wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'is_wp_user' ) );
$this->assertTrue( $linked_author_1->is_wp_user );
$this->assertObjectHasProperty( 'wp_user', $linked_author_1 );
$this->assertTrue( property_exists( $linked_author_1, 'wp_user' ) );
$this->assertInstanceOf( WP_User::class, $linked_author_1->wp_user );
$this->assertEquals( $this->author3->ID, $linked_author_1->wp_user->ID );

Expand Down

0 comments on commit b6b959b

Please sign in to comment.