Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#261] install composer unused in toggle-model package
- Loading branch information
Showing
14 changed files
with
336 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Pheature\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\CreateFeature; | ||
use Psr\Container\ContainerInterface; | ||
|
||
final class CreateFeatureFactory | ||
{ | ||
public function __invoke(ContainerInterface $container): CreateFeature | ||
{ | ||
/** @var FeatureRepository $featureRepository */ | ||
$featureRepository = $container->get(FeatureRepository::class); | ||
|
||
return self::create($featureRepository); | ||
} | ||
|
||
public static function create(FeatureRepository $featureRepository): CreateFeature | ||
{ | ||
return new CreateFeature($featureRepository); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Pheature\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\DisableFeature; | ||
use Psr\Container\ContainerInterface; | ||
|
||
final class DisableFeatureFactory | ||
{ | ||
public function __invoke(ContainerInterface $container): DisableFeature | ||
{ | ||
/** @var FeatureRepository $featureRepository */ | ||
$featureRepository = $container->get(FeatureRepository::class); | ||
|
||
return self::create($featureRepository); | ||
} | ||
|
||
public static function create(FeatureRepository $featureRepository): DisableFeature | ||
{ | ||
return new DisableFeature($featureRepository); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Pheature\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\EnableFeature; | ||
use Psr\Container\ContainerInterface; | ||
|
||
final class EnableFeatureFactory | ||
{ | ||
public function __invoke(ContainerInterface $container): EnableFeature | ||
{ | ||
/** @var FeatureRepository $featureRepository */ | ||
$featureRepository = $container->get(FeatureRepository::class); | ||
|
||
return self::create($featureRepository); | ||
} | ||
|
||
public static function create(FeatureRepository $featureRepository): EnableFeature | ||
{ | ||
return new EnableFeature($featureRepository); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Pheature\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\RemoveFeature; | ||
use Psr\Container\ContainerInterface; | ||
|
||
final class RemoveFeatureFactory | ||
{ | ||
public function __invoke(ContainerInterface $container): RemoveFeature | ||
{ | ||
/** @var FeatureRepository $featureRepository */ | ||
$featureRepository = $container->get(FeatureRepository::class); | ||
|
||
return self::create($featureRepository); | ||
} | ||
|
||
public static function create(FeatureRepository $featureRepository): RemoveFeature | ||
{ | ||
return new RemoveFeature($featureRepository); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Pheature\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\RemoveStrategy; | ||
use Psr\Container\ContainerInterface; | ||
|
||
final class RemoveStrategyFactory | ||
{ | ||
public function __invoke(ContainerInterface $container): RemoveStrategy | ||
{ | ||
/** @var FeatureRepository $featureRepository */ | ||
$featureRepository = $container->get(FeatureRepository::class); | ||
return self::create( | ||
$featureRepository | ||
); | ||
} | ||
|
||
public static function create(FeatureRepository $featureRepository): RemoveStrategy | ||
{ | ||
return new RemoveStrategy($featureRepository); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Pheature\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\SetStrategy; | ||
use Psr\Container\ContainerInterface; | ||
|
||
final class SetStrategyFactory | ||
{ | ||
public function __invoke(ContainerInterface $container): SetStrategy | ||
{ | ||
/** @var FeatureRepository $featureRepository */ | ||
$featureRepository = $container->get(FeatureRepository::class); | ||
|
||
return self::create($featureRepository); | ||
} | ||
|
||
public static function create(FeatureRepository $featureRepository): SetStrategy | ||
{ | ||
return new SetStrategy($featureRepository); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Pheature\Test\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\CreateFeatureFactory; | ||
use Pheature\Crud\Toggle\Handler\CreateFeature; | ||
use Psr\Container\ContainerInterface; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class CreateFeatureFactoryTest extends TestCase | ||
{ | ||
public function testItShouldCreateInstanceOfCreateFeature(): void | ||
{ | ||
$featureRepository = $this->createMock(FeatureRepository::class); | ||
$container = $this->createMock(ContainerInterface::class); | ||
$container->expects(static::once()) | ||
->method('get') | ||
->with(FeatureRepository::class) | ||
->willReturn($featureRepository); | ||
|
||
$addStrategyFactory = new CreateFeatureFactory(); | ||
|
||
$addStrategyFactory->__invoke($container); | ||
} | ||
|
||
public function testItShouldCreateInstanceOfCreateFeatureStatically(): void | ||
{ | ||
$featureRepository = $this->createMock(FeatureRepository::class); | ||
|
||
$addStrategy = CreateFeatureFactory::create($featureRepository); | ||
|
||
$this->assertInstanceOf(CreateFeature::class, $addStrategy); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Pheature\Test\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\DisableFeatureFactory; | ||
use Pheature\Crud\Toggle\Handler\DisableFeature; | ||
use Psr\Container\ContainerInterface; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class DisableFeatureFactoryTest extends TestCase | ||
{ | ||
public function testItShouldCreateInstanceOfCreateFeature(): void | ||
{ | ||
$featureRepository = $this->createMock(FeatureRepository::class); | ||
$container = $this->createMock(ContainerInterface::class); | ||
$container->expects(static::once()) | ||
->method('get') | ||
->with(FeatureRepository::class) | ||
->willReturn($featureRepository); | ||
|
||
$disableFeatureFactory = new DisableFeatureFactory(); | ||
|
||
$disableFeatureFactory->__invoke($container); | ||
} | ||
|
||
public function testItShouldCreateInstanceOfCreateFeatureStatically(): void | ||
{ | ||
$featureRepository = $this->createMock(FeatureRepository::class); | ||
|
||
$addStrategy = DisableFeatureFactory::create($featureRepository); | ||
|
||
$this->assertInstanceOf(DisableFeature::class, $addStrategy); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Pheature\Test\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Pheature\Test\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\RemoveStrategyFactory; | ||
use Pheature\Crud\Toggle\Handler\RemoveStrategy; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\Container\ContainerInterface; | ||
|
||
class RemoveStrategyFactoryTest extends TestCase | ||
{ | ||
public function testItShouldCreateARemoveStrategyFromInvokable(): void | ||
{ | ||
$mockedContainer = $this->createConfiguredMock(ContainerInterface::class, [ | ||
'get' => $this->createMock(FeatureRepository::class) | ||
]); | ||
|
||
$factory = new RemoveStrategyFactory(); | ||
$actual = $factory->__invoke($mockedContainer); | ||
|
||
self::assertInstanceOf(RemoveStrategy::class, $actual); | ||
} | ||
|
||
public function testItShouldCreateARemoveStrategyFromCreate(): void | ||
{ | ||
$actual = RemoveStrategyFactory::create($this->createMock(FeatureRepository::class)); | ||
|
||
self::assertInstanceOf(RemoveStrategy::class, $actual); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Pheature\Test\Crud\Toggle\Handler; | ||
|
||
use Pheature\Core\Toggle\Write\FeatureRepository; | ||
use Pheature\Crud\Toggle\Handler\SetStrategyFactory; | ||
use Pheature\Crud\Toggle\Handler\SetStrategy; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\Container\ContainerInterface; | ||
|
||
final class SetStrategyFactoryTest extends TestCase | ||
{ | ||
public function testItShouldCreateInstanceOfAddStrategy(): void | ||
{ | ||
$featureRepository = $this->createMock(FeatureRepository::class); | ||
$container = $this->createMock(ContainerInterface::class); | ||
$container->expects(static::once()) | ||
->method('get') | ||
->with(FeatureRepository::class) | ||
->willReturn($featureRepository); | ||
|
||
$addStrategyFactory = new SetStrategyFactory(); | ||
|
||
$addStrategyFactory->__invoke($container); | ||
} | ||
|
||
public function testItShouldCreateInstanceOfAddStrategyStatically(): void | ||
{ | ||
$featureRepository = $this->createMock(FeatureRepository::class); | ||
|
||
$addStrategy = SetStrategyFactory::create($featureRepository); | ||
|
||
$this->assertInstanceOf(SetStrategy::class, $addStrategy); | ||
} | ||
} |