From ecdc8d86a5e961f48b597fa7227ce81aab2dd8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 18 Jan 2022 00:11:04 +0200 Subject: [PATCH 1/3] Update phpunit to 8.5 --- phpunit.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 527c2585e..d989cdc8b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,11 +1,11 @@ - + - + ./tests From f810ee2fc9f06c54fb3430658bda10be83afde56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 18 Jan 2022 00:39:49 +0200 Subject: [PATCH 2/3] Fix assertInternalType deprecation --- tests/Controller/RunTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Controller/RunTest.php b/tests/Controller/RunTest.php index b9ec93d3c..641c35f37 100644 --- a/tests/Controller/RunTest.php +++ b/tests/Controller/RunTest.php @@ -157,7 +157,7 @@ public function testCallgraphData(): void ]); $result = $this->runs->callgraphData($this->request); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('metric', $result); $this->assertArrayHasKey('total', $result); $this->assertArrayHasKey('nodes', $result); From 4127eff9f4c0ae4934eddaaf0d50922d6911b1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 18 Jan 2022 00:37:30 +0200 Subject: [PATCH 3/3] Fix withConsecutive arguments --- tests/Saver/MongoTest.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/Saver/MongoTest.php b/tests/Saver/MongoTest.php index 3d45cc6ff..e235f934b 100644 --- a/tests/Saver/MongoTest.php +++ b/tests/Saver/MongoTest.php @@ -17,9 +17,23 @@ public function testSave(): void $collection = $this->getMockBuilder(MongoCollection::class) ->disableOriginalConstructor() ->getMock(); - $collection->expects($this->exactly(count($data))) + + $collection + ->expects($this->exactly(count($data))) ->method('insert') - ->withConsecutive($this->equalTo($data)); + ->withConsecutive(...array_map(function () { + return [ + $this->callback(function ($data) { + $this->assertIsArray($data); + $this->assertArrayHasKey('_id', $data); + $this->assertArrayHasKey('meta', $data); + $this->assertArrayHasKey('profile', $data); + + return true; + }), + $this->equalTo(['w' => 0]), + ]; + }, $data)); $saver = new MongoSaver($collection);