Repository: pheature-flags/pheature-flags (php)

Issue:
[Toggle PSR-11 Factories] Add static version to RemoveFeatureFactory 
**Epic:** https://github.com/pheature-flags/pheature-flags/issues/122 Toggle PSR-11 Factories
**Package:** https://github.com/pheature-flags/toggle-psr11-factories 

**Description:**

Following the example defined in the issue https://github.com/pheature-flags/pheature-flags/issues/122, create a static version of the RemoveFeatureFactory class.

Pull request:
[Toggle PSR-11 Factories] Add static version to RemoveFeatureFactory
It closes #134

Patch:
diff --git a/packages/toggle-crud-psr11-factories/src/RemoveFeatureFactory.php b/packages/toggle-crud-psr11-factories/src/RemoveFeatureFactory.php
index b74da50..120bbb0 100644
--- a/packages/toggle-crud-psr11-factories/src/RemoveFeatureFactory.php
+++ b/packages/toggle-crud-psr11-factories/src/RemoveFeatureFactory.php
@@ -15,6 +15,11 @@ final class RemoveFeatureFactory
         /** @var FeatureRepository $featureRepository */
         $featureRepository = $container->get(FeatureRepository::class);
 
+        return self::create($featureRepository);
+    }
+
+    public static function create(FeatureRepository $featureRepository): RemoveFeature
+    {
         return new RemoveFeature($featureRepository);
     }
 }


Test patch:
diff --git a/packages/toggle-crud-psr11-factories/test/CreateFeatureFactoryTest.php b/packages/toggle-crud-psr11-factories/test/CreateFeatureFactoryTest.php
index f559731..d128f94 100644
--- a/packages/toggle-crud-psr11-factories/test/CreateFeatureFactoryTest.php
+++ b/packages/toggle-crud-psr11-factories/test/CreateFeatureFactoryTest.php
@@ -8,7 +8,7 @@ use Pheature\Crud\Toggle\Handler\CreateFeature;
 use Psr\Container\ContainerInterface;
 use PHPUnit\Framework\TestCase;
 
-class CreateFeatureFactoryTest extends TestCase
+final class CreateFeatureFactoryTest extends TestCase
 {
     public function testItShouldCreateInstanceOfCreateFeature(): void
     {
diff --git a/packages/toggle-crud-psr11-factories/test/DeleteFeatureFactoryTest.php b/packages/toggle-crud-psr11-factories/test/DeleteFeatureFactoryTest.php
index bd407b6..fec3353 100644
--- a/packages/toggle-crud-psr11-factories/test/DeleteFeatureFactoryTest.php
+++ b/packages/toggle-crud-psr11-factories/test/DeleteFeatureFactoryTest.php
@@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase;
 use Psr\Container\ContainerInterface;
 use Psr\Http\Message\ResponseFactoryInterface;
 
-class DeleteFeatureFactoryTest extends TestCase
+final class DeleteFeatureFactoryTest extends TestCase
 {
     public function testItShouldCreateInstanceOfDeleteFeature(): void
     {
diff --git a/packages/toggle-crud-psr11-factories/test/RemoveFeatureFactoryTest.php b/packages/toggle-crud-psr11-factories/test/RemoveFeatureFactoryTest.php
new file mode 100644
index 0000000..5713dc3
--- /dev/null
+++ b/packages/toggle-crud-psr11-factories/test/RemoveFeatureFactoryTest.php
@@ -0,0 +1,32 @@
+<?php
+declare(strict_types=1);
+
+namespace Pheature\Test\Crud\Psr11\Toggle;
+
+use Pheature\Core\Toggle\Write\FeatureRepository;
+use Pheature\Crud\Psr11\Toggle\RemoveFeatureFactory;
+use Pheature\Crud\Toggle\Handler\RemoveFeature;
+use PHPUnit\Framework\TestCase;
+use Psr\Container\ContainerInterface;
+
+final class RemoveFeatureFactoryTest extends TestCase
+{
+    public function testItShouldCreateARemoveFeatureFromInvokable(): void
+    {
+        $mockedContainer = $this->createConfiguredMock(ContainerInterface::class, [
+            'get' => $this->createMock(FeatureRepository::class)
+        ]);
+
+        $factory = new RemoveFeatureFactory();
+        $actual = $factory->__invoke($mockedContainer);
+
+        self::assertInstanceOf(RemoveFeature::class, $actual);
+    }
+
+    public function testItShouldCreateARemoveFeatureFromCreate(): void
+    {
+        $actual = RemoveFeatureFactory::create($this->createMock(FeatureRepository::class));
+
+        self::assertInstanceOf(RemoveFeature::class, $actual);
+    }
+}