From 2cf49a9e84f02159fa759d981db0e6f0aa2be0bf Mon Sep 17 00:00:00 2001 From: Maxim Smakouz Date: Wed, 18 Oct 2023 11:13:44 +0300 Subject: [PATCH] Remove abandoned package (#88) * Change http-factory package * Add bindInjector in test * Up spiral/testing version * Fix rebinding singletons --- composer.json | 6 +++--- src/GRPC/Generator/BootloaderGenerator.php | 1 - tests/src/Console/Command/Queue/ListCommandTest.php | 4 ++-- tests/src/Console/Command/Queue/PauseCommandTest.php | 4 ++-- tests/src/RoadRunnerModeTest.php | 6 ++++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index fa45fab..34cb886 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,8 @@ ], "require": { "php": ">=8.1", - "psr/simple-cache": "3", - "php-http/message-factory": "^1.0", + "psr/simple-cache": "^3.0", + "psr/http-factory": "^1.0.2", "grpc/grpc": "^1.42", "roadrunner-php/centrifugo": "^2.0", "spiral/roadrunner-http": "^3.0", @@ -36,7 +36,7 @@ "spiral/scaffolder": "^3.7" }, "require-dev": { - "spiral/testing": "^2.3", + "spiral/testing": "^2.6.1", "phpunit/phpunit": "^10.1", "vimeo/psalm": "^5.0", "spiral/nyholm-bridge": "^1.2" diff --git a/src/GRPC/Generator/BootloaderGenerator.php b/src/GRPC/Generator/BootloaderGenerator.php index 6b54dd5..eee08c1 100644 --- a/src/GRPC/Generator/BootloaderGenerator.php +++ b/src/GRPC/Generator/BootloaderGenerator.php @@ -98,7 +98,6 @@ private function updateInitServicesMethod(FileDeclaration $file, array $files): { $method = $file->getClass(self::BOOTLOADER_NAME)->getMethod('initServices'); $method->setBody(''); - foreach ($files as $service) { if (!\str_ends_with($service, 'Interface.php')) { continue; diff --git a/tests/src/Console/Command/Queue/ListCommandTest.php b/tests/src/Console/Command/Queue/ListCommandTest.php index ee68713..2d71047 100644 --- a/tests/src/Console/Command/Queue/ListCommandTest.php +++ b/tests/src/Console/Command/Queue/ListCommandTest.php @@ -11,10 +11,10 @@ final class ListCommandTest extends ConsoleTestCase { - public function testGetsListOfAvailablePipelines() + public function testGetsListOfAvailablePipelines(): void { $jobs = \Mockery::mock(JobsInterface::class); - $this->getContainer()->bind(JobsInterface::class, $jobs); + $this->getContainer()->bindSingleton(JobsInterface::class, $jobs, true); $jobs->shouldReceive('getIterator')->andReturn( new \ArrayIterator([ diff --git a/tests/src/Console/Command/Queue/PauseCommandTest.php b/tests/src/Console/Command/Queue/PauseCommandTest.php index 3f85b5b..a2dff82 100644 --- a/tests/src/Console/Command/Queue/PauseCommandTest.php +++ b/tests/src/Console/Command/Queue/PauseCommandTest.php @@ -9,10 +9,10 @@ final class PauseCommandTest extends ConsoleTestCase { - public function testPausePipeline() + public function testPausePipeline(): void { $jobs = \Mockery::mock(JobsInterface::class); - $this->getContainer()->bind(JobsInterface::class, $jobs); + $this->getContainer()->bindSingleton(JobsInterface::class, $jobs, true); $jobs->shouldReceive('pause')->once()->with('foo'); diff --git a/tests/src/RoadRunnerModeTest.php b/tests/src/RoadRunnerModeTest.php index a095602..12eef13 100644 --- a/tests/src/RoadRunnerModeTest.php +++ b/tests/src/RoadRunnerModeTest.php @@ -5,6 +5,7 @@ namespace Spiral\Tests; use PHPUnit\Framework\Attributes\DataProvider; +use Spiral\Boot\Injector\EnumInjector; use Spiral\RoadRunner\Environment; use Spiral\RoadRunner\EnvironmentInterface; use Spiral\RoadRunnerBridge\RoadRunnerMode; @@ -15,14 +16,15 @@ protected function setUp(): void { parent::setUp(); $this->getContainer()->removeBinding(RoadRunnerMode::class); + $this->getContainer()->bindInjector(RoadRunnerMode::class, EnumInjector::class); } #[DataProvider('roadRunnerModes')] public function testDetectMode(string $mode, RoadRunnerMode $expected): void { - $this->getContainer()->bind(EnvironmentInterface::class, static fn () => new Environment([ + $this->getContainer()->bindSingleton(EnvironmentInterface::class, static fn () => new Environment([ 'RR_MODE' => $mode, - ])); + ]), true); $this->assertSame($expected, $this->getContainer()->get(RoadRunnerMode::class)); }