From 45878d8fae3a2ad85587c9af3a75bd089515fb2d Mon Sep 17 00:00:00 2001 From: Koldo Picaza <1093654+kpicaza@users.noreply.github.com> Date: Sun, 3 Dec 2023 14:43:54 +0100 Subject: [PATCH] update psalm to 5.16 --- composer.json | 6 ++-- test/Handler/EnableFeatureFactoryTest.php | 37 +++++++++++++++++++++++ test/Handler/RemoveFeatureTest.php | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 test/Handler/EnableFeatureFactoryTest.php diff --git a/composer.json b/composer.json index c38cb99..d479734 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "~8.0.0|~8.1.0|~8.2.0|~8.3.0", - "pheature/toggle-core": "^0.7", + "pheature/toggle-core": "^0.8", "psr/event-dispatcher": "^1.0" }, "require-dev": { @@ -28,8 +28,8 @@ "phpunit/phpunit": "^8.0 || ^9.0", "roave/infection-static-analysis-plugin": "^1.18", "squizlabs/php_codesniffer": "^3.4", - "symfony/var-dumper": "^4.2 || ^5.0 || ^6.0", - "vimeo/psalm": "^4.4" + "symfony/var-dumper": "^4.2 || ^5.0 || ^6.0 || ^7.0", + "vimeo/psalm": "^4.4|^5.16" }, "autoload": { "psr-4": { diff --git a/test/Handler/EnableFeatureFactoryTest.php b/test/Handler/EnableFeatureFactoryTest.php new file mode 100644 index 0000000..a4eeea9 --- /dev/null +++ b/test/Handler/EnableFeatureFactoryTest.php @@ -0,0 +1,37 @@ +createMock(FeatureRepository::class); + $container = $this->createMock(ContainerInterface::class); + $container->expects(static::once()) + ->method('get') + ->with(FeatureRepository::class) + ->willReturn($featureRepository); + + $enableFeatureFactory = new EnableFeatureFactory(); + + $enableFeatureFactory->__invoke($container); + } + + public function testItShouldCreateInstanceOfEnableFeatureStatically(): void + { + $featureRepository = $this->createMock(FeatureRepository::class); + + $addStrategy = EnableFeatureFactory::create($featureRepository); + + $this->assertInstanceOf(EnableFeature::class, $addStrategy); + } +} diff --git a/test/Handler/RemoveFeatureTest.php b/test/Handler/RemoveFeatureTest.php index 37db528..6d4544c 100644 --- a/test/Handler/RemoveFeatureTest.php +++ b/test/Handler/RemoveFeatureTest.php @@ -37,5 +37,6 @@ public function testItShouldRemoveAFeature(): void $handler = new RemoveFeature($repository); $handler->handle($command); + $this->assertCount(2, $expectedFeature->release()); } }