From 5071503c50b1ac3f5cb23ef9af123fe64f3ab0d2 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Fri, 5 Mar 2021 09:52:51 +0100 Subject: [PATCH] Make this test more robust The order of properties in changed in various places (including serialization and var_dump()) in PHP 8.1 --- .../unit/Framework/Exception/ExceptionTest.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/unit/Framework/Exception/ExceptionTest.php b/tests/unit/Framework/Exception/ExceptionTest.php index 64ae6cb616b..d38e7444af5 100644 --- a/tests/unit/Framework/Exception/ExceptionTest.php +++ b/tests/unit/Framework/Exception/ExceptionTest.php @@ -13,16 +13,13 @@ class ExceptionTest extends TestCase { public function testExceptionSleep(): void { - $exception = new Exception(); + $actual = (new Exception)->__sleep(); - $expectedArray = [ - 'serializableTrace', - 'message', - 'code', - 'file', - 'line', - ]; - - $this->assertSame($expectedArray, $exception->__sleep()); + $this->assertCount(5, $actual); + $this->assertContains('serializableTrace', $actual); + $this->assertContains('message', $actual); + $this->assertContains('code', $actual); + $this->assertContains('file', $actual); + $this->assertContains('line', $actual); } }