Skip to content

Commit

Permalink
Suppression de la fonctionnalité feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchois committed Jan 22, 2025
1 parent 699e0e3 commit c80c997
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 135 deletions.
26 changes: 0 additions & 26 deletions src/Infrastructure/FeatureFlagService.php

This file was deleted.

9 changes: 0 additions & 9 deletions src/Infrastructure/Twig/AppExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
namespace App\Infrastructure\Twig;

use App\Application\StringUtilsInterface;
use App\Infrastructure\FeatureFlagService;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\Request;

class AppExtension extends \Twig\Extension\AbstractExtension
{
Expand All @@ -16,7 +14,6 @@ class AppExtension extends \Twig\Extension\AbstractExtension
public function __construct(
string $clientTimezone,
private StringUtilsInterface $stringUtils,
private FeatureFlagService $featureFlagService,
) {
$this->clientTimezone = new \DateTimeZone($clientTimezone);
}
Expand All @@ -31,7 +28,6 @@ public function getFunctions(): array
new \Twig\TwigFunction('app_is_client_future_day', [$this, 'isClientFutureDay']),
new \Twig\TwigFunction('app_vehicle_type_icon_name', [$this, 'getVehicleTypeIconName']),
new \Twig\TwigFunction('app_is_fieldset_error', [$this, 'isFieldsetError']),
new \Twig\TwigFunction('app_is_feature_enabled', [$this, 'isFeatureEnabled']),
];
}

Expand Down Expand Up @@ -125,11 +121,6 @@ public function isFieldsetError(FormError $error, string $fieldset): bool
return $payload && \array_key_exists('fieldset', $payload) && $payload['fieldset'] === $fieldset;
}

public function isFeatureEnabled(string $featureName, ?Request $request = null): bool
{
return $this->featureFlagService->isFeatureEnabled($featureName, $request);
}

public function capFirst(string $text): \Twig\Markup
{
if (!$text) {
Expand Down
76 changes: 0 additions & 76 deletions tests/Unit/Infrastructure/FeatureFlagServiceTest.php

This file was deleted.

25 changes: 1 addition & 24 deletions tests/Unit/Infrastructure/Twig/AppExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use App\Domain\Regulation\Enum\CritairEnum;
use App\Domain\Regulation\Enum\VehicleTypeEnum;
use App\Infrastructure\Adapter\StringUtils;
use App\Infrastructure\FeatureFlagService;
use App\Infrastructure\Twig\AppExtension;
use App\Tests\TimezoneHelper;
use PHPUnit\Framework\TestCase;
Expand All @@ -20,21 +19,18 @@ class AppExtensionTest extends TestCase
use TimezoneHelper;

private AppExtension $extension;
private $featureFlagService;

protected function setUp(): void
{
$this->featureFlagService = $this->createMock(FeatureFlagService::class);
$this->extension = new AppExtension(
'Etc/GMT-1', // Independent of Daylight Saving Time (DST).
new StringUtils(),
$this->featureFlagService,
);
}

public function testGetFunctions(): void
{
$this->assertCount(8, $this->extension->getFunctions());
$this->assertCount(7, $this->extension->getFunctions());
}

public function testGetFilters(): void
Expand Down Expand Up @@ -215,25 +211,6 @@ public function testIsFieldsetError(mixed $payload, bool $expected): void
$this->assertSame($expected, $this->extension->isFieldsetError($error, 'example'));
}

private function provideIsFeatureEnabled(): array
{
return [['enabled' => true], ['enabled' => false]];
}

/**
* @dataProvider provideIsFeatureEnabled
*/
public function testIsFeatureEnabled(bool $enabled): void
{
$this->featureFlagService
->expects(self::once())
->method('isFeatureEnabled')
->with('MY_FEATURE')
->willReturn($enabled);

$this->assertSame($enabled, $this->extension->isFeatureEnabled('MY_FEATURE'));
}

public function testCapFirst(): void
{
$this->assertSame('', (string) $this->extension->capFirst(''));
Expand Down

0 comments on commit c80c997

Please sign in to comment.