From ca165740350f32e92ab37338848707bcd8ce8479 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Tue, 5 Feb 2019 15:59:24 +0100 Subject: [PATCH] Add tests --- tests/unit/Framework/AssertTest.php | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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);