diff --git a/tests/unit/Framework/AssertTest.php b/tests/unit/Framework/AssertTest.php index dfde4ea6cf7..404e522b70e 100644 --- a/tests/unit/Framework/AssertTest.php +++ b/tests/unit/Framework/AssertTest.php @@ -3004,6 +3004,38 @@ public function testStringNotContainsStringCanBeAssertedIgnoringCase(): void $this->fail(); } + public function testIterableContainsSameObjectCanBeAsserted(): void + { + $object = new \stdClass; + $iterable = [$object]; + + $this->assertContains($object, $iterable); + + try { + $this->assertContains(new \stdClass, $iterable); + } catch (AssertionFailedError $e) { + return; + } + + $this->fail(); + } + + public function testIterableNotContainsSameObjectCanBeAsserted(): void + { + $object = new \stdClass; + $iterable = [$object]; + + $this->assertNotContains(new \stdClass, $iterable); + + try { + $this->assertNotContains($object, $iterable); + } catch (AssertionFailedError $e) { + return; + } + + $this->fail(); + } + protected function sameValues(): array { $object = new \SampleClass(4, 8, 15);