Skip to content

Commit

Permalink
Remove pimple as a supported container
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Dec 5, 2023
1 parent 2eb90de commit d6f0d7c
Show file tree
Hide file tree
Showing 11 changed files with 827 additions and 831 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"jsoumelidis/zend-sf-di-config": "^0.5",
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-development-mode": "^3.3.0",
"laminas/laminas-pimple-config": "^1.4",
"laminas/laminas-servicemanager": "^3.6.4",
"mezzio/mezzio-fastroute": "^3.2.0",
"mezzio/mezzio-laminasrouter": "^3.1.0",
Expand Down
1,550 changes: 796 additions & 754 deletions composer.lock

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/App/src/Handler/HomePageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Mezzio\Router\RouterInterface;
use Mezzio\Template\TemplateRendererInterface;
use Mezzio\Twig\TwigRenderer;
use Pimple\Psr11\Container as PimpleContainer;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
Expand All @@ -36,10 +35,6 @@ public function handle(ServerRequestInterface $request): ResponseInterface
$data = [];

switch ($this->containerName) {
case PimpleContainer::class:
$data['containerName'] = 'Pimple';
$data['containerDocs'] = 'https://pimple.symfony.com/';
break;
case ServiceManager::class:
$data['containerName'] = 'Laminas Servicemanager';
$data['containerDocs'] = 'https://docs.laminas.dev/laminas-servicemanager/';
Expand Down
1 change: 0 additions & 1 deletion src/MezzioInstaller/OptionalPackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ class OptionalPackages
'mezzio/mezzio-twigrenderer',
'mezzio/mezzio-laminasrouter',
'mezzio/mezzio-laminasviewrenderer',
'laminas/laminas-pimple-config',
'laminas/laminas-servicemanager',
];

Expand Down
11 changes: 0 additions & 11 deletions src/MezzioInstaller/Resources/config/container-pimple.php

This file was deleted.

26 changes: 4 additions & 22 deletions src/MezzioInstaller/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
'mezzio/mezzio-laminasviewrenderer',
],
],
'laminas/laminas-pimple-config' => [
'version' => '^1.1.1',
],
'laminas/laminas-servicemanager' => [
'version' => '^3.4',
],
Expand All @@ -74,27 +71,12 @@
'questions' => [
'container' => [
'question' => 'Which container do you want to use for dependency injection?',
'default' => 2,
'default' => 1,
'required' => true,
'custom-package' => true,
'custom-package-warning' => 'You need to edit public/index.php to start the custom container.',
'options' => [
1 => [
'name' => 'Pimple <comment>(supported by laminas)</comment>',
'packages' => [
'laminas/laminas-pimple-config',
],
'flat' => [
'Resources/config/container-pimple.php' => 'config/container.php',
],
'modular' => [
'Resources/config/container-pimple.php' => 'config/container.php',
],
'minimal' => [
'Resources/config/container-pimple.php' => 'config/container.php',
],
],
2 => [
'name' => 'laminas-servicemanager <comment>(supported by laminas)</comment>',
'packages' => [
'laminas/laminas-servicemanager',
Expand All @@ -109,7 +91,7 @@
'Resources/config/container-laminas-servicemanager.php' => 'config/container.php',
],
],
3 => [
2 => [
'name' => 'Symfony DI Container',
'packages' => [
'jsoumelidis/zend-sf-di-config',
Expand All @@ -124,7 +106,7 @@
'Resources/config/container-sf-di.php' => 'config/container.php',
],
],
4 => [
3 => [
'name' => 'PHP-DI',
'packages' => [
'elie29/zend-phpdi-config',
Expand All @@ -139,7 +121,7 @@
'Resources/config/container-php-di.php' => 'config/container.php',
],
],
5 => [
4 => [
'name' => 'chubbyphp-container',
'packages' => [
'chubbyphp/chubbyphp-laminas-config',
Expand Down
28 changes: 12 additions & 16 deletions test/MezzioInstallerTest/ContainersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Mezzio\Helper\UrlHelper;
use Mezzio\Router\RouterInterface;
use MezzioInstaller\OptionalPackages;
use Pimple\Psr11\Container as PimpleContainer;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder as SfContainerBuilder;

Expand Down Expand Up @@ -118,21 +117,18 @@ public function containerProvider(): array
// phpcs:disable Generic.Files.LineLength.TooLong
// $installType, $containerOption, $routerOption, $copyFilesKey, $expectedResponseStatusCode, $expectedContainer
return [
'pimple-minimal' => [OptionalPackages::INSTALL_MINIMAL, 1, 2, 'minimal-files', 404, PimpleContainer::class],
'pimple-flat' => [OptionalPackages::INSTALL_FLAT, 1, 2, 'copy-files', 200, PimpleContainer::class],
'pimple-modular' => [OptionalPackages::INSTALL_MODULAR, 1, 2, 'copy-files', 200, PimpleContainer::class],
'laminas-sm-minimal' => [OptionalPackages::INSTALL_MINIMAL, 2, 2, 'minimal-files', 404, LaminasManagerContainer::class],
'laminas-sm-flat' => [OptionalPackages::INSTALL_FLAT, 2, 2, 'copy-files', 200, LaminasManagerContainer::class],
'laminas-sm-modular' => [OptionalPackages::INSTALL_MODULAR, 2, 2, 'copy-files', 200, LaminasManagerContainer::class],
'sf-di-minimal' => [OptionalPackages::INSTALL_MINIMAL, 3, 2, 'minimal-files', 404, SfContainerBuilder::class],
'sf-di-flat' => [OptionalPackages::INSTALL_FLAT, 3, 2, 'copy-files', 200, SfContainerBuilder::class],
'sf-di-modular' => [OptionalPackages::INSTALL_MODULAR, 3, 2, 'copy-files', 200, SfContainerBuilder::class],
'php-di-minimal' => [OptionalPackages::INSTALL_MINIMAL, 4, 2, 'minimal-files', 404, PhpDIContainer::class],
'php-di-flat' => [OptionalPackages::INSTALL_FLAT, 4, 2, 'copy-files', 200, PhpDIContainer::class],
'php-di-modular' => [OptionalPackages::INSTALL_MODULAR, 4, 2, 'copy-files', 200, PhpDIContainer::class],
'chubbyphp-c-minimal' => [OptionalPackages::INSTALL_MINIMAL, 5, 2, 'minimal-files', 404, ChubbyphpMinimalContainer::class],
'chubbyphp-c-flat' => [OptionalPackages::INSTALL_FLAT, 5, 2, 'copy-files', 200, ChubbyphpMinimalContainer::class],
'chubbyphp-c-modular' => [OptionalPackages::INSTALL_MODULAR, 5, 2, 'copy-files', 200, ChubbyphpMinimalContainer::class],
'laminas-sm-minimal' => [OptionalPackages::INSTALL_MINIMAL, 1, 2, 'minimal-files', 404, LaminasManagerContainer::class],
'laminas-sm-flat' => [OptionalPackages::INSTALL_FLAT, 1, 2, 'copy-files', 200, LaminasManagerContainer::class],
'laminas-sm-modular' => [OptionalPackages::INSTALL_MODULAR, 1, 2, 'copy-files', 200, LaminasManagerContainer::class],
'sf-di-minimal' => [OptionalPackages::INSTALL_MINIMAL, 2, 2, 'minimal-files', 404, SfContainerBuilder::class],
'sf-di-flat' => [OptionalPackages::INSTALL_FLAT, 2, 2, 'copy-files', 200, SfContainerBuilder::class],
'sf-di-modular' => [OptionalPackages::INSTALL_MODULAR, 2, 2, 'copy-files', 200, SfContainerBuilder::class],
'php-di-minimal' => [OptionalPackages::INSTALL_MINIMAL, 3, 2, 'minimal-files', 404, PhpDIContainer::class],
'php-di-flat' => [OptionalPackages::INSTALL_FLAT, 3, 2, 'copy-files', 200, PhpDIContainer::class],
'php-di-modular' => [OptionalPackages::INSTALL_MODULAR, 3, 2, 'copy-files', 200, PhpDIContainer::class],
'chubbyphp-c-minimal' => [OptionalPackages::INSTALL_MINIMAL, 4, 2, 'minimal-files', 404, ChubbyphpMinimalContainer::class],
'chubbyphp-c-flat' => [OptionalPackages::INSTALL_FLAT, 4, 2, 'copy-files', 200, ChubbyphpMinimalContainer::class],
'chubbyphp-c-modular' => [OptionalPackages::INSTALL_MODULAR, 4, 2, 'copy-files', 200, ChubbyphpMinimalContainer::class],
];
// phpcs:enable Generic.Files.LineLength.TooLong
}
Expand Down
6 changes: 3 additions & 3 deletions test/MezzioInstallerTest/ErrorHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public function errorHandlerProvider(): array
{
// $installType, $containerOption, $errorHandlerOption, $expectedErrorHandler
return [
'whoops-minimal' => [OptionalPackages::INSTALL_MINIMAL, 3, 1, WhoopsErrorResponseGeneratorFactory::class],
'whoops-full' => [OptionalPackages::INSTALL_FLAT, 3, 1, WhoopsErrorResponseGeneratorFactory::class],
'whoops-modular' => [OptionalPackages::INSTALL_MODULAR, 3, 1, WhoopsErrorResponseGeneratorFactory::class],
'whoops-minimal' => [OptionalPackages::INSTALL_MINIMAL, 2, 1, WhoopsErrorResponseGeneratorFactory::class],
'whoops-full' => [OptionalPackages::INSTALL_FLAT, 2, 1, WhoopsErrorResponseGeneratorFactory::class],
'whoops-modular' => [OptionalPackages::INSTALL_MODULAR, 2, 1, WhoopsErrorResponseGeneratorFactory::class],
];
}
}
14 changes: 4 additions & 10 deletions test/MezzioInstallerTest/HomePageResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Mezzio\Twig\ConfigProvider as TwigRendererConfigProvider;
use Mezzio\Twig\TwigRenderer;
use MezzioInstaller\OptionalPackages;
use Pimple\Psr11\Container as PimpleContainer;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder as SfContainerBuilder;

Expand Down Expand Up @@ -91,19 +90,14 @@ class HomePageResponseTest extends OptionalPackagesTestCase
// $containerOption, $containerClass
/** @var array<string, array<int|class-string<ContainerInterface>>> */
private array $containerTypes = [
'pimple' => [1, PimpleContainer::class],
'laminas-servicemanager' => [2, LaminasServiceManagerContainer::class],
'sf-di' => [3, SfContainerBuilder::class],
'php-di' => [4, PhpDIContainer::class],
'chubbyphp-container' => [5, ChubbyphpContainer::class],
'laminas-servicemanager' => [1, LaminasServiceManagerContainer::class],
'sf-di' => [2, SfContainerBuilder::class],
'php-di' => [3, PhpDIContainer::class],
'chubbyphp-container' => [4, ChubbyphpContainer::class],
];

/** @var array<class-string<ContainerInterface>, array<string, string>> */
private array $expectedContainerAttributes = [
PimpleContainer::class => [
'containerName' => 'Pimple',
'containerDocs' => 'https://pimple.symfony.com/',
],
LaminasServiceManagerContainer::class => [
'containerName' => 'Laminas Servicemanager',
'containerDocs' => 'https://docs.laminas.dev/laminas-servicemanager/',
Expand Down
4 changes: 2 additions & 2 deletions test/MezzioInstallerTest/ProcessAnswersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testAnsweredWithValidOption(): void
->expects($this->exactly(2))
->method('write')
->withConsecutive(

Check failure on line 79 in test/MezzioInstallerTest/ProcessAnswersTest.php

View workflow job for this annotation

GitHub Actions / QA Checks (Psalm [8.0, locked], ubuntu-latest, laminas/laminas-continuous-integration-action@v1, ...

DeprecatedMethod

test/MezzioInstallerTest/ProcessAnswersTest.php:79:15: DeprecatedMethod: The method PHPUnit\Framework\MockObject\Builder\InvocationMocker::withConsecutive has been marked as deprecated (see https://psalm.dev/001)
[$this->stringContains('Adding package <info>laminas/laminas-pimple-config</info>')],
[$this->stringContains('Adding package <info>laminas/laminas-servicemanager</info>')],
[$this->stringContains('Copying <info>config/container.php</info>')],
);

Expand All @@ -88,7 +88,7 @@ public function testAnsweredWithValidOption(): void

self::assertTrue($result);
self::assertFileExists($this->projectRoot . '/config/container.php');
self::assertPackage('laminas/laminas-pimple-config', $this->installer);
self::assertPackage('laminas/laminas-servicemanager', $this->installer);
}

public function testAnsweredWithPackage(): void
Expand Down
12 changes: 6 additions & 6 deletions test/MezzioInstallerTest/TemplateRenderersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ public static function templateRendererProvider(): Generator
// Minimal framework installation test cases; no templates installed.
// Must be run before those that install templates and test the output.
// $installType, $containerOption, $routerOption, $templateRendererOption, $expectedResponseStatusCode, $expectedTemplateRenderer
yield 'plates-minimal' => [OptionalPackages::INSTALL_MINIMAL, 3, 2, 1, 404, PlatesRenderer::class];
yield 'twig-minimal' => [OptionalPackages::INSTALL_MINIMAL, 3, 2, 2, 404, TwigRenderer::class];
yield 'laminas-view-minimal' => [OptionalPackages::INSTALL_MINIMAL, 3, 2, 3, 404, LaminasViewRenderer::class];
yield 'plates-minimal' => [OptionalPackages::INSTALL_MINIMAL, 2, 2, 1, 404, PlatesRenderer::class];
yield 'twig-minimal' => [OptionalPackages::INSTALL_MINIMAL, 2, 2, 2, 404, TwigRenderer::class];
yield 'laminas-view-minimal' => [OptionalPackages::INSTALL_MINIMAL, 2, 2, 3, 404, LaminasViewRenderer::class];

// Full framework installation test cases; installation options that install templates.
$testCases = [
// $containerOption, $routerOption, $templateRendererOption, $expectedResponseStatusCode, $expectedTemplateRenderer
'plates-full' => [3, 2, 1, 200, PlatesRenderer::class],
'twig-full' => [3, 2, 2, 200, TwigRenderer::class],
'laminas-view-full' => [3, 2, 3, 200, LaminasViewRenderer::class],
'plates-full' => [2, 2, 1, 200, PlatesRenderer::class],
'twig-full' => [2, 2, 2, 200, TwigRenderer::class],
'laminas-view-full' => [2, 2, 3, 200, LaminasViewRenderer::class],
];
// phpcs:enable Generic.Files.LineLength.TooLong

Expand Down

0 comments on commit d6f0d7c

Please sign in to comment.