diff --git a/phpunit.xml b/phpunit.xml index 527c2585..d989cdc8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,11 +1,11 @@ - + - + ./tests diff --git a/tests/Controller/RunTest.php b/tests/Controller/RunTest.php index b9ec93d3..641c35f3 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); diff --git a/tests/Saver/MongoTest.php b/tests/Saver/MongoTest.php index 3d45cc6f..e235f934 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);