diff --git a/tests/MockServiceProviderTest.php b/tests/MockServiceProviderTest.php new file mode 100644 index 0000000..a1ad39c --- /dev/null +++ b/tests/MockServiceProviderTest.php @@ -0,0 +1,30 @@ +setDefinition('example-id-001', ['class' => 'Example1\Class1\Position1']); + $mockServiceProvider->setDefinition('example-id-002', 'Example1\Class2\Position2'); + $mockServiceProvider->setDefinition('example-id-003', 'Example3\Class3\Position3'); + + $this->assertEquals([ + 'example-id-001' => ['class' => 'Example1\Class1\Position1'], + 'example-id-002' => 'Example1\Class2\Position2', + 'example-id-003' => 'Example3\Class3\Position3', + ], $mockServiceProvider->getDefinitions()); + } + + public function testGetExtensionsWillReturnEmptyArray(): void + { + $this->assertEmpty((new MockServiceProvider())->getExtensions()); + } +} diff --git a/tests/ResponseGrabberTest.php b/tests/ResponseGrabberTest.php new file mode 100644 index 0000000..741b329 --- /dev/null +++ b/tests/ResponseGrabberTest.php @@ -0,0 +1,42 @@ +setResponse($response); + + $this->assertEquals(new ResponseAccessor($response), $responseGrabber->getResponse()); + } + + public function testGetResponseWillThrowExceptionIfSetResponseIsCalledWithNullParameter(): void + { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('Response is null'); + + $responseGrabber = new ResponseGrabber(); + $responseGrabber->setResponse(null); + $responseGrabber->getResponse(); + } + + public function testGetResponseWillThrowExceptionIfResponseIsNotSet(): void + { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('Response is null'); + + (new ResponseGrabber())->getResponse(); + } +}