diff --git a/rules-tests/CodeQuality/Rector/ClassMethod/AddInstanceofAssertForNullableInstanceRector/Fixture/two_asserts_right_after_each_other.php.inc b/rules-tests/CodeQuality/Rector/ClassMethod/AddInstanceofAssertForNullableInstanceRector/Fixture/two_asserts_right_after_each_other.php.inc new file mode 100644 index 00000000..ce22759e --- /dev/null +++ b/rules-tests/CodeQuality/Rector/ClassMethod/AddInstanceofAssertForNullableInstanceRector/Fixture/two_asserts_right_after_each_other.php.inc @@ -0,0 +1,65 @@ +getSomeObject(); + $this->assertSame(123, $someObject->getSomeMethod()); + + $someObject2 = $this->getSomeObject(); + $this->assertSame(456, $someObject2->getSomeMethod()); + } + + private function getSomeObject(): ?SomeClassUsedInTests + { + if (mt_rand(0, 1)) { + return new SomeClassUsedInTests(); + } + + return null; + } +} + +?> +----- +getSomeObject(); + $this->assertInstanceOf(\Rector\PHPUnit\Tests\CodeQuality\Rector\ClassMethod\AddInstanceofAssertForNullableInstanceRector\Source\SomeClassUsedInTests::class, $someObject); + $this->assertSame(123, $someObject->getSomeMethod()); + + $someObject2 = $this->getSomeObject(); + $this->assertInstanceOf(\Rector\PHPUnit\Tests\CodeQuality\Rector\ClassMethod\AddInstanceofAssertForNullableInstanceRector\Source\SomeClassUsedInTests::class, $someObject2); + $this->assertSame(456, $someObject2->getSomeMethod()); + } + + private function getSomeObject(): ?SomeClassUsedInTests + { + if (mt_rand(0, 1)) { + return new SomeClassUsedInTests(); + } + + return null; + } +} + +?>