From 602b01c581d1a22e5565c5329cbcfa5ef515e787 Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Sun, 3 Mar 2024 17:26:19 +0700 Subject: [PATCH 01/10] Add tests for DebugHeadersMiddleware --- composer.json | 2 + .../Debug/Middleware/DebugHeadersTest.php | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/Unit/Debug/Middleware/DebugHeadersTest.php diff --git a/composer.json b/composer.json index 8fba472..224c036 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "gitonomy/gitlib": "^1.3", "guzzlehttp/guzzle": "^7.5", "guzzlehttp/psr7": "^2.4", + "httpsoft/http-message": "^1.1", "psr/container": "^2.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0", @@ -61,6 +62,7 @@ "yiisoft/db-sqlite": "^1.0", "yiisoft/psr-dummy-provider": "^1.0", "yiisoft/router-fastroute": "^3.0", + "yiisoft/test-support": "^3.0", "yiisoft/yii-cycle": "dev-master", "yiisoft/yii-view": "^6.0" }, diff --git a/tests/Unit/Debug/Middleware/DebugHeadersTest.php b/tests/Unit/Debug/Middleware/DebugHeadersTest.php new file mode 100644 index 0000000..8a64007 --- /dev/null +++ b/tests/Unit/Debug/Middleware/DebugHeadersTest.php @@ -0,0 +1,44 @@ +createMock(UrlGeneratorInterface::class); + $urlGenerator->method('generate')->willReturnCallback( + fn (string $route, array $parameters) => $route . '?' . http_build_query($parameters) + ); + $idGenerator = new DebuggerIdGenerator(); + $expectedId = $idGenerator->getId(); + + $middleware = new DebugHeaders($idGenerator, $urlGenerator); + $response = $middleware->process(new ServerRequest(), $this->createRequestHandler()); + + $this->assertSame($expectedId, $response->getHeaderLine('X-Debug-Id')); + $this->assertSame('debug/api/view?id=' . $expectedId, $response->getHeaderLine('X-Debug-Link')); + } + + protected function createRequestHandler(): RequestHandlerInterface + { + return new class implements RequestHandlerInterface { + public function handle($request): ResponseInterface + { + return new Response(200); + } + }; + } + +} From 1cf803a5982956001ec65fad3a7b6afbeb59a7d9 Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Sun, 3 Mar 2024 17:43:45 +0700 Subject: [PATCH 02/10] Add tests for ResponseDataWrapperMiddleware --- .../Middleware/ResponseDataWrapperTest.php | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 tests/Unit/Debug/Middleware/ResponseDataWrapperTest.php diff --git a/tests/Unit/Debug/Middleware/ResponseDataWrapperTest.php b/tests/Unit/Debug/Middleware/ResponseDataWrapperTest.php new file mode 100644 index 0000000..b52a0fd --- /dev/null +++ b/tests/Unit/Debug/Middleware/ResponseDataWrapperTest.php @@ -0,0 +1,140 @@ +createMiddleware(); + $response = $middleware->process(new ServerRequest(), $this->createRequestHandler(new Response(200))); + + $this->assertInstanceOf(ResponseInterface::class, $response); + } + + public function testDataResponse(): void + { + $controllerRawResponse = ['id' => 1, 'name' => 'User name']; + $factory = $this->createDataResponseFactory(); + $response = $factory->createResponse($controllerRawResponse); + + $middleware = $this->createMiddleware(); + $response = $middleware->process(new ServerRequest(), $this->createRequestHandler($response)); + + $this->assertInstanceOf(ResponseInterface::class, $response); + $this->assertInstanceOf(DataResponse::class, $response); + + $this->assertEquals(200, $response->getStatusCode()); + $this->assertEquals([ + 'id' => null, + 'data' => $controllerRawResponse, + 'error' => null, + 'success' => true, + ], $response->getData()); + } + + public function testDataResponseErrorStatus(): void + { + $controllerRawResponse = ['id' => 1, 'name' => 'User name']; + $factory = $this->createDataResponseFactory(); + $response = $factory->createResponse($controllerRawResponse, 400); + + $middleware = $this->createMiddleware(); + $response = $middleware->process(new ServerRequest(), $this->createRequestHandler($response)); + + $this->assertInstanceOf(ResponseInterface::class, $response); + $this->assertInstanceOf(DataResponse::class, $response); + + $this->assertEquals(400, $response->getStatusCode()); + $this->assertEquals([ + 'id' => null, + 'data' => $controllerRawResponse, + 'error' => null, + 'success' => false, + ], $response->getData()); + } + + public function testDataResponseException(): void + { + $errorMessage = 'Test exception'; + $middleware = $this->createMiddleware(); + $response = $middleware->process( + new ServerRequest(), + $this->createExceptionRequestHandler(new NotFoundException($errorMessage)) + ); + + $this->assertInstanceOf(ResponseInterface::class, $response); + $this->assertInstanceOf(DataResponse::class, $response); + + $this->assertEquals(404, $response->getStatusCode()); + $this->assertEquals([ + 'id' => null, + 'data' => null, + 'error' => $errorMessage, + 'success' => false, + ], $response->getData()); + } + + private function createRequestHandler(ResponseInterface $response): RequestHandlerInterface + { + return new class ($response) implements RequestHandlerInterface { + public function __construct( + private ResponseInterface $response, + ) { + } + + public function handle($request): ResponseInterface + { + return $this->response; + } + }; + } + + private function createExceptionRequestHandler(Throwable $exception): RequestHandlerInterface + { + return new class ($exception) implements RequestHandlerInterface { + public function __construct( + private Throwable $exception, + ) { + } + + public function handle($request): ResponseInterface + { + throw $this->exception; + } + }; + } + + private function createMiddleware(): ResponseDataWrapper + { + $factory = $this->createDataResponseFactory(); + $currentRoute = new CurrentRoute(); + $middleware = new ResponseDataWrapper($factory, $currentRoute); + return $middleware; + } + + private function createDataResponseFactory(): DataResponseFactory + { + return new DataResponseFactory( + new ResponseFactory(), + new StreamFactory(), + ); + } + +} From 9d78aba22b7d2ab556a740e2b2f61cd50d44a6b9 Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Sun, 3 Mar 2024 17:48:22 +0700 Subject: [PATCH 03/10] Add tests for DebugApiProvider --- src/Debug/Provider/DebugApiProvider.php | 3 +- .../Debug/Provider/DebugApiProviderTest.php | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 tests/Unit/Debug/Provider/DebugApiProviderTest.php diff --git a/src/Debug/Provider/DebugApiProvider.php b/src/Debug/Provider/DebugApiProvider.php index d62d5be..2a0977a 100644 --- a/src/Debug/Provider/DebugApiProvider.php +++ b/src/Debug/Provider/DebugApiProvider.php @@ -4,7 +4,6 @@ namespace Yiisoft\Yii\Debug\Api\Debug\Provider; -use Psr\Container\ContainerInterface; use Yiisoft\Di\ServiceProviderInterface; use Yiisoft\Router\RouteCollectorInterface; use Yiisoft\Yii\Debug\Api\Debug\Middleware\DebugHeaders; @@ -22,7 +21,7 @@ public function getDefinitions(): array public function getExtensions(): array { return [ - RouteCollectorInterface::class => static function (ContainerInterface $container, RouteCollectorInterface $routeCollector) { + RouteCollectorInterface::class => static function (RouteCollectorInterface $routeCollector) { $routeCollector->prependMiddleware(DebugHeaders::class); return $routeCollector; }, diff --git a/tests/Unit/Debug/Provider/DebugApiProviderTest.php b/tests/Unit/Debug/Provider/DebugApiProviderTest.php new file mode 100644 index 0000000..e38bba7 --- /dev/null +++ b/tests/Unit/Debug/Provider/DebugApiProviderTest.php @@ -0,0 +1,37 @@ +assertIsArray($provider->getDefinitions()); + $this->assertIsArray($provider->getExtensions()); + $this->assertEmpty($provider->getDefinitions()); + + $extensions = $provider->getExtensions(); + $this->assertArrayHasKey(RouteCollectorInterface::class, $extensions); + + $routeCollectorDecorator = $extensions[RouteCollectorInterface::class]; + $this->assertIsCallable($routeCollectorDecorator); + + $routeCollector = $this->createMock(RouteCollectorInterface::class); + $routeCollector->expects($this->once()) + ->method('prependMiddleware') + ->with(DebugHeaders::class) + ->willReturn($routeCollector); + + $this->assertSame($routeCollector, $routeCollectorDecorator($routeCollector)); + } + +} From 3db8e6f62210fbc8ad9ec28f55f9e80b654837ff Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Sun, 3 Mar 2024 18:12:59 +0700 Subject: [PATCH 04/10] Add test for CollectorRepository --- src/Debug/Repository/CollectorRepository.php | 2 +- tests/Support/StubCollector.php | 32 ++++++ .../Repository/CollectorRepositoryTest.php | 101 ++++++++++++++++++ 3 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 tests/Support/StubCollector.php create mode 100644 tests/Unit/Debug/Repository/CollectorRepositoryTest.php diff --git a/src/Debug/Repository/CollectorRepository.php b/src/Debug/Repository/CollectorRepository.php index e37324b..777963e 100644 --- a/src/Debug/Repository/CollectorRepository.php +++ b/src/Debug/Repository/CollectorRepository.php @@ -38,7 +38,7 @@ public function getObject(string $id, string $objectId): array|null $dump = $this->loadData(StorageInterface::TYPE_OBJECTS, $id); foreach ($dump as $name => $value) { - if (($pos = strrpos($name, "#$objectId")) !== false) { + if (($pos = strrpos((string)$name, "#$objectId")) !== false) { return [substr($name, 0, $pos), $value]; } } diff --git a/tests/Support/StubCollector.php b/tests/Support/StubCollector.php new file mode 100644 index 0000000..06abc04 --- /dev/null +++ b/tests/Support/StubCollector.php @@ -0,0 +1,32 @@ +data; + } +} diff --git a/tests/Unit/Debug/Repository/CollectorRepositoryTest.php b/tests/Unit/Debug/Repository/CollectorRepositoryTest.php new file mode 100644 index 0000000..576e163 --- /dev/null +++ b/tests/Unit/Debug/Repository/CollectorRepositoryTest.php @@ -0,0 +1,101 @@ + 'value']); + + $storage = $this->createStorage($idGenerator); + $repository = new CollectorRepository($storage); + + $this->assertIsArray($repository->getSummary()); + $this->assertEquals([ + [ + 'id' => $idGenerator->getId(), + 'collectors' => [], + ], + ], $repository->getSummary()); + + $storage->addCollector($stubCollector); + + $this->assertIsArray($repository->getSummary()); + $this->assertEquals([ + [ + 'id' => $idGenerator->getId(), + 'collectors' => [$stubCollector->getName()], + ], + ], $repository->getSummary()); + } + + public function testDetail(): void + { + $idGenerator = new DebuggerIdGenerator(); + $stubCollector = new StubCollector(['key' => 'value']); + + $storage = $this->createStorage($idGenerator); + $storage->addCollector($stubCollector); + + $repository = new CollectorRepository($storage); + + $this->assertIsArray($repository->getDetail($idGenerator->getId())); + $this->assertEquals([ + $stubCollector->getName() => $stubCollector->getCollected(), + ], $repository->getDetail($idGenerator->getId())); + } + + public function testDumpObject(): void + { + $idGenerator = new DebuggerIdGenerator(); + $stubCollector = new StubCollector(['key' => 'value']); + + $storage = $this->createStorage($idGenerator); + $storage->addCollector($stubCollector); + + $repository = new CollectorRepository($storage); + + $this->assertIsArray($repository->getDumpObject($idGenerator->getId())); + $this->assertEquals([ + 'key' => 'value', + ], $repository->getDumpObject($idGenerator->getId())); + } + + public function testObject(): void + { + $idGenerator = new DebuggerIdGenerator(); + + $objectId = '123'; + $stubCollector = new StubCollector([ + 'stdClass#' . $objectId => 'value', + ]); + + $storage = $this->createStorage($idGenerator); + $storage->addCollector($stubCollector); + + $repository = new CollectorRepository($storage); + + $this->assertIsArray($repository->getObject($idGenerator->getId(), $objectId)); + $this->assertEquals([ + 'stdClass', + 'value', + ], $repository->getObject($idGenerator->getId(), $objectId)); + } + + private function createStorage(DebuggerIdGenerator $idGenerator): StorageInterface + { + return new MemoryStorage($idGenerator); + } + +} From 803071a0659b6adf8148a44b6783ef45123e1a58 Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Sun, 3 Mar 2024 18:41:58 +0700 Subject: [PATCH 05/10] Cover more --- src/Inspector/ApplicationState.php | 7 +++- tests/Support/Application/fail.sh | 2 + tests/Unit/Inspector/ApplicationStateTest.php | 19 +++++++++ .../Inspector/Command/BashCommandTest.php | 41 +++++++++++++++++++ tests/Unit/Inspector/CommandResponseTest.php | 20 +++++++++ .../Database/DbSchemaProviderTest.php | 2 +- 6 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 tests/Support/Application/fail.sh create mode 100644 tests/Unit/Inspector/ApplicationStateTest.php create mode 100644 tests/Unit/Inspector/Command/BashCommandTest.php create mode 100644 tests/Unit/Inspector/CommandResponseTest.php rename tests/{ => Unit}/Inspector/Database/DbSchemaProviderTest.php (98%) diff --git a/src/Inspector/ApplicationState.php b/src/Inspector/ApplicationState.php index 9996b20..1b73fd2 100644 --- a/src/Inspector/ApplicationState.php +++ b/src/Inspector/ApplicationState.php @@ -4,7 +4,10 @@ namespace Yiisoft\Yii\Debug\Api\Inspector; -class ApplicationState +/** + * @internal + */ +final class ApplicationState { - public static $params; + public static array $params = []; } diff --git a/tests/Support/Application/fail.sh b/tests/Support/Application/fail.sh new file mode 100644 index 0000000..4bbf6fa --- /dev/null +++ b/tests/Support/Application/fail.sh @@ -0,0 +1,2 @@ +echo 'failed' +exit $1 diff --git a/tests/Unit/Inspector/ApplicationStateTest.php b/tests/Unit/Inspector/ApplicationStateTest.php new file mode 100644 index 0000000..2b8aed5 --- /dev/null +++ b/tests/Unit/Inspector/ApplicationStateTest.php @@ -0,0 +1,19 @@ +assertEquals([], ApplicationState::$params); + + ApplicationState::$params = ['key' => 'value']; + $this->assertEquals(['key' => 'value'], ApplicationState::$params); + } +} diff --git a/tests/Unit/Inspector/Command/BashCommandTest.php b/tests/Unit/Inspector/Command/BashCommandTest.php new file mode 100644 index 0000000..013da82 --- /dev/null +++ b/tests/Unit/Inspector/Command/BashCommandTest.php @@ -0,0 +1,41 @@ + __DIR__, + ]); + $command = new BashCommand($aliases, ['echo', 'test']); + + $response = $command->run(); + + $this->assertSame(CommandResponse::STATUS_OK, $response->getStatus()); + $this->assertSame('test' . PHP_EOL, $response->getResult()); + $this->assertSame([], $response->getErrors()); + } + + public function testError(): void + { + $aliases = new Aliases([ + '@root' => dirname(__DIR__, 3) . '/Support/Application', + ]); + $command = new BashCommand($aliases, ['bash', 'fail.sh', '1']); + + $response = $command->run(); + + $this->assertSame(CommandResponse::STATUS_ERROR, $response->getStatus()); + $this->assertSame('failed' . PHP_EOL, $response->getResult()); + $this->assertSame([], $response->getErrors()); + } +} diff --git a/tests/Unit/Inspector/CommandResponseTest.php b/tests/Unit/Inspector/CommandResponseTest.php new file mode 100644 index 0000000..68b6428 --- /dev/null +++ b/tests/Unit/Inspector/CommandResponseTest.php @@ -0,0 +1,20 @@ +assertSame(CommandResponse::STATUS_OK, $response->getStatus()); + $this->assertSame('result', $response->getResult()); + $this->assertSame(['errors'], $response->getErrors()); + } +} diff --git a/tests/Inspector/Database/DbSchemaProviderTest.php b/tests/Unit/Inspector/Database/DbSchemaProviderTest.php similarity index 98% rename from tests/Inspector/Database/DbSchemaProviderTest.php rename to tests/Unit/Inspector/Database/DbSchemaProviderTest.php index 0584e09..5a00506 100644 --- a/tests/Inspector/Database/DbSchemaProviderTest.php +++ b/tests/Unit/Inspector/Database/DbSchemaProviderTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Yiisoft\Yii\Debug\Api\Tests\Inspector\Database; +namespace Yiisoft\Yii\Debug\Api\Tests\Unit\Inspector\Database; use PHPUnit\Framework\TestCase; use Yiisoft\Cache\NullCache; From 57195e0ad79942b87867af52aa6fb3ba6b570c8c Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 3 Mar 2024 11:42:47 +0000 Subject: [PATCH 06/10] Apply fixes from StyleCI --- tests/Unit/Debug/Middleware/DebugHeadersTest.php | 3 +-- tests/Unit/Debug/Middleware/ResponseDataWrapperTest.php | 4 +--- tests/Unit/Debug/Provider/DebugApiProviderTest.php | 1 - tests/Unit/Debug/Repository/CollectorRepositoryTest.php | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/Unit/Debug/Middleware/DebugHeadersTest.php b/tests/Unit/Debug/Middleware/DebugHeadersTest.php index 8a64007..f86459a 100644 --- a/tests/Unit/Debug/Middleware/DebugHeadersTest.php +++ b/tests/Unit/Debug/Middleware/DebugHeadersTest.php @@ -33,12 +33,11 @@ public function testHeaders(): void protected function createRequestHandler(): RequestHandlerInterface { - return new class implements RequestHandlerInterface { + return new class () implements RequestHandlerInterface { public function handle($request): ResponseInterface { return new Response(200); } }; } - } diff --git a/tests/Unit/Debug/Middleware/ResponseDataWrapperTest.php b/tests/Unit/Debug/Middleware/ResponseDataWrapperTest.php index b52a0fd..634cc66 100644 --- a/tests/Unit/Debug/Middleware/ResponseDataWrapperTest.php +++ b/tests/Unit/Debug/Middleware/ResponseDataWrapperTest.php @@ -125,8 +125,7 @@ private function createMiddleware(): ResponseDataWrapper { $factory = $this->createDataResponseFactory(); $currentRoute = new CurrentRoute(); - $middleware = new ResponseDataWrapper($factory, $currentRoute); - return $middleware; + return new ResponseDataWrapper($factory, $currentRoute); } private function createDataResponseFactory(): DataResponseFactory @@ -136,5 +135,4 @@ private function createDataResponseFactory(): DataResponseFactory new StreamFactory(), ); } - } diff --git a/tests/Unit/Debug/Provider/DebugApiProviderTest.php b/tests/Unit/Debug/Provider/DebugApiProviderTest.php index e38bba7..0ca8861 100644 --- a/tests/Unit/Debug/Provider/DebugApiProviderTest.php +++ b/tests/Unit/Debug/Provider/DebugApiProviderTest.php @@ -33,5 +33,4 @@ public function testExtension(): void $this->assertSame($routeCollector, $routeCollectorDecorator($routeCollector)); } - } diff --git a/tests/Unit/Debug/Repository/CollectorRepositoryTest.php b/tests/Unit/Debug/Repository/CollectorRepositoryTest.php index 576e163..b62153b 100644 --- a/tests/Unit/Debug/Repository/CollectorRepositoryTest.php +++ b/tests/Unit/Debug/Repository/CollectorRepositoryTest.php @@ -97,5 +97,4 @@ private function createStorage(DebuggerIdGenerator $idGenerator): StorageInterfa { return new MemoryStorage($idGenerator); } - } From 39e7a54e26bd0638d7eb634ddb2e469febdb959b Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Wed, 29 May 2024 01:41:41 +0300 Subject: [PATCH 07/10] Fix test for Windows --- src/Inspector/Command/BashCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Inspector/Command/BashCommand.php b/src/Inspector/Command/BashCommand.php index 357e056..597bbcc 100644 --- a/src/Inspector/Command/BashCommand.php +++ b/src/Inspector/Command/BashCommand.php @@ -38,7 +38,7 @@ public function run(): CommandResponse ->setTimeout(null) ->run(); - $processOutput = $process->getOutput(); + $processOutput = rtrim($process->getOutput(), PHP_EOL); if (!$process->getExitCode() > 1) { return new CommandResponse( From 1e6cd821906b7a221c3812ef9a8f79d9b22c9065 Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Wed, 29 May 2024 01:45:04 +0300 Subject: [PATCH 08/10] Fix db versions --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 224c036..169e646 100644 --- a/composer.json +++ b/composer.json @@ -56,9 +56,10 @@ "roave/infection-static-analysis-plugin": "^1.16", "spatie/phpunit-watcher": "^1.23", "vimeo/psalm": "^5.22", - "yiisoft/active-record": "3.0.x-dev", + "yiisoft/active-record": "dev-master", "yiisoft/assets": "^4.0", "yiisoft/csrf": "^2.0", + "yiisoft/db": "1.2 as dev-master", "yiisoft/db-sqlite": "^1.0", "yiisoft/psr-dummy-provider": "^1.0", "yiisoft/router-fastroute": "^3.0", From e30e4dbbe6103a96c0ea73e8d067cfa63b001c8e Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Wed, 29 May 2024 01:46:39 +0300 Subject: [PATCH 09/10] Fix test --- tests/Unit/Inspector/Command/BashCommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Unit/Inspector/Command/BashCommandTest.php b/tests/Unit/Inspector/Command/BashCommandTest.php index 013da82..1fb8454 100644 --- a/tests/Unit/Inspector/Command/BashCommandTest.php +++ b/tests/Unit/Inspector/Command/BashCommandTest.php @@ -35,7 +35,7 @@ public function testError(): void $response = $command->run(); $this->assertSame(CommandResponse::STATUS_ERROR, $response->getStatus()); - $this->assertSame('failed' . PHP_EOL, $response->getResult()); + $this->assertSame('failed', $response->getResult()); $this->assertSame([], $response->getErrors()); } } From 85291b462b577e886c841db4ce9ac160fdab4f8f Mon Sep 17 00:00:00 2001 From: Dmitrii Derepko Date: Wed, 29 May 2024 01:48:16 +0300 Subject: [PATCH 10/10] Fix test --- src/Inspector/Command/BashCommand.php | 2 +- tests/Unit/Inspector/Command/BashCommandTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Inspector/Command/BashCommand.php b/src/Inspector/Command/BashCommand.php index 597bbcc..9485c99 100644 --- a/src/Inspector/Command/BashCommand.php +++ b/src/Inspector/Command/BashCommand.php @@ -38,7 +38,7 @@ public function run(): CommandResponse ->setTimeout(null) ->run(); - $processOutput = rtrim($process->getOutput(), PHP_EOL); + $processOutput = rtrim($process->getOutput()); if (!$process->getExitCode() > 1) { return new CommandResponse( diff --git a/tests/Unit/Inspector/Command/BashCommandTest.php b/tests/Unit/Inspector/Command/BashCommandTest.php index 1fb8454..5a327f7 100644 --- a/tests/Unit/Inspector/Command/BashCommandTest.php +++ b/tests/Unit/Inspector/Command/BashCommandTest.php @@ -21,7 +21,7 @@ public function testSuccess(): void $response = $command->run(); $this->assertSame(CommandResponse::STATUS_OK, $response->getStatus()); - $this->assertSame('test' . PHP_EOL, $response->getResult()); + $this->assertSame('test', $response->getResult()); $this->assertSame([], $response->getErrors()); }