From 4882dae9c289624dedbcae60bdf8ec0c775dcb5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Thu, 19 May 2022 00:13:02 +0200 Subject: [PATCH 01/19] Added a mocking framework to test against the API client responses --- composer.json | 4 +- composer.lock | 179 +++++++++++++++++- src/Builder/AlternativeLookup.php | 7 +- src/Builder/Extractor.php | 8 +- src/Builder/Loader.php | 8 +- src/Builder/Lookup.php | 5 +- src/Factory/Extractor.php | 4 +- src/Factory/Lookup.php | 13 +- tests/functional/Builder/ExtractorTest.php | 78 ++++++++ .../Factory/Repository/ExtractorTest.php | 14 +- .../Factory/Repository/LoaderTest.php | 14 +- .../Factory/Repository/LookupTest.php | 14 +- .../functional/Mock/ApiClientMockBuilder.php | 149 +++++++++++++++ tests/functional/Mock/ExceptionBuilder.php | 33 ++++ tests/functional/Mock/FileSystemBuilder.php | 17 ++ tests/functional/Mock/HttpClientBuilder.php | 93 +++++++++ .../functional/Mock/RequestFactoryBuilder.php | 16 ++ .../RequestMatcher/RequestMatcherBuilder.php | 60 ++++++ .../RequestMatcherBuilderInterface.php | 9 + tests/functional/Mock/ResponseBuilder.php | 35 ++++ .../Mock/ResponseFactoryBuilder.php | 16 ++ .../functional/Mock/StreamFactoryBuilder.php | 17 ++ tests/functional/PipelineRunner.php | 45 +++++ 23 files changed, 802 insertions(+), 36 deletions(-) create mode 100644 tests/functional/Builder/ExtractorTest.php create mode 100644 tests/functional/Mock/ApiClientMockBuilder.php create mode 100644 tests/functional/Mock/ExceptionBuilder.php create mode 100644 tests/functional/Mock/FileSystemBuilder.php create mode 100644 tests/functional/Mock/HttpClientBuilder.php create mode 100644 tests/functional/Mock/RequestFactoryBuilder.php create mode 100644 tests/functional/Mock/RequestMatcher/RequestMatcherBuilder.php create mode 100644 tests/functional/Mock/RequestMatcher/RequestMatcherBuilderInterface.php create mode 100644 tests/functional/Mock/ResponseBuilder.php create mode 100644 tests/functional/Mock/ResponseFactoryBuilder.php create mode 100644 tests/functional/Mock/StreamFactoryBuilder.php create mode 100644 tests/functional/PipelineRunner.php diff --git a/composer.json b/composer.json index 65c3a79..7b4e6c9 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,9 @@ "php-http/message": "^1.11", "php-http/curl-client": "^2.0", "mikey179/vfsstream": "^1.6", - "infection/infection": "^0.26.10" + "infection/infection": "^0.26.10", + "php-etl/phpunit-extension": "^0.4", + "fakerphp/faker": "^1.19" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 076383d..cbf89c2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7bd0cb002badc254c623a5cc3aaaf66e", + "content-hash": "528c5f0fae78f999815ddfd3df144fe2", "packages": [ { "name": "doctrine/inflector", @@ -2306,6 +2306,66 @@ } ], "packages-dev": [ + { + "name": "adlawson/vfs", + "version": "0.12.1", + "source": { + "type": "git", + "url": "https://github.com/adlawson/php-vfs.git", + "reference": "e955034419d6a8f92c9a8ea2e626eeed96b41095" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/adlawson/php-vfs/zipball/e955034419d6a8f92c9a8ea2e626eeed96b41095", + "reference": "e955034419d6a8f92c9a8ea2e626eeed96b41095", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "psr/log": "^1.0" + }, + "require-dev": { + "adlawson/timezone": "^1.0", + "fabpot/php-cs-fixer": "^1.9", + "mockery/mockery": "^0.9", + "phpunit/phpunit": "^4.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Vfs\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrew Lawson", + "homepage": "http://adlawson.com" + } + ], + "description": "Virtual file system", + "homepage": "https://github.com/adlawson/php-vfs", + "keywords": [ + "dir", + "directory", + "file", + "fs", + "read", + "stream", + "system", + "virtual", + "wrapper", + "write" + ], + "support": { + "issues": "https://github.com/adlawson/php-vfs/issues", + "source": "https://github.com/adlawson/php-vfs/tree/develop" + }, + "time": "2016-02-20T12:46:01+00:00" + }, { "name": "akeneo/api-php-client", "version": "v4.0.2", @@ -2684,6 +2744,73 @@ ], "time": "2020-11-10T18:47:58+00:00" }, + { + "name": "fakerphp/faker", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "ext-intl": "*", + "symfony/phpunit-bridge": "^4.4 || ^5.2" + }, + "suggest": { + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "v1.19-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" + }, + "time": "2022-02-02T17:38:57+00:00" + }, { "name": "guzzlehttp/psr7", "version": "2.0.0", @@ -3743,6 +3870,56 @@ }, "time": "2021-06-28T21:40:35+00:00" }, + { + "name": "php-etl/phpunit-extension", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/php-etl/phpunit-extension.git", + "reference": "88da32b280743278877794c9b6865b6b2ee252d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-etl/phpunit-extension/zipball/88da32b280743278877794c9b6865b6b2ee252d9", + "reference": "88da32b280743278877794c9b6865b6b2ee252d9", + "shasum": "" + }, + "require": { + "adlawson/vfs": "*", + "nikic/php-parser": "^4.10", + "php": "^8.0", + "php-etl/pipeline-contracts": "^0.3.0", + "phpunit/phpunit": "^9" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Kiboko\\Component\\PHPUnitExtension\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Grégory Planchat", + "email": "gregory@kiboko.fr" + } + ], + "description": "Extension for testing FastMap and ETL components with PHPUnit testing framework", + "support": { + "issues": "https://github.com/php-etl/phpunit-extension/issues", + "source": "https://github.com/php-etl/phpunit-extension/tree/main" + }, + "time": "2022-05-18T10:01:06+00:00" + }, { "name": "php-etl/pipeline-contracts", "version": "v0.3.3", diff --git a/src/Builder/AlternativeLookup.php b/src/Builder/AlternativeLookup.php index 53a6e61..1f5d9b4 100644 --- a/src/Builder/AlternativeLookup.php +++ b/src/Builder/AlternativeLookup.php @@ -10,12 +10,11 @@ final class AlternativeLookup implements Builder { - private ?Builder $capacity; private ?Builder $merge; - public function __construct() - { - $this->capacity = null; + public function __construct( + private Builder $capacity, + ) { $this->merge = null; } diff --git a/src/Builder/Extractor.php b/src/Builder/Extractor.php index 5ecb71d..c88daef 100644 --- a/src/Builder/Extractor.php +++ b/src/Builder/Extractor.php @@ -5,21 +5,19 @@ use Kiboko\Contract\Configurator\StepBuilderInterface; use PhpParser\Builder; use PhpParser\Node; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; final class Extractor implements StepBuilderInterface { private ?Node\Expr $logger; private bool $withEnterpriseSupport; private ?Node\Expr $client; - private ?Builder $capacity; - public function __construct() - { + public function __construct( + private Builder $capacity, + ) { $this->logger = null; $this->withEnterpriseSupport = false; $this->client = null; - $this->capacity = null; } public function withEnterpriseSupport(bool $withEnterpriseSupport): self diff --git a/src/Builder/Loader.php b/src/Builder/Loader.php index 5212607..0faf9a1 100644 --- a/src/Builder/Loader.php +++ b/src/Builder/Loader.php @@ -3,7 +3,6 @@ namespace Kiboko\Plugin\Akeneo\Builder; use Kiboko\Contract\Configurator\StepBuilderInterface; -use Kiboko\Plugin\Akeneo; use PhpParser\Builder; use PhpParser\Node; @@ -12,14 +11,13 @@ final class Loader implements StepBuilderInterface private ?Node\Expr $logger; private bool $withEnterpriseSupport; private ?Node\Expr $client; - private ?Builder $capacity; - public function __construct() - { + public function __construct( + private Builder $capacity, + ) { $this->logger = null; $this->withEnterpriseSupport = false; $this->client = null; - $this->capacity = null; } public function withEnterpriseSupport(bool $withEnterpriseSupport): self diff --git a/src/Builder/Lookup.php b/src/Builder/Lookup.php index 9adfe89..456f7fc 100644 --- a/src/Builder/Lookup.php +++ b/src/Builder/Lookup.php @@ -13,8 +13,9 @@ final class Lookup implements StepBuilderInterface private bool $withEnterpriseSupport; private ?Node\Expr $client; - public function __construct(private AlternativeLookup $alternative) - { + public function __construct( + private AlternativeLookup $alternative, + ) { $this->logger = null; $this->withEnterpriseSupport = false; $this->client = null; diff --git a/src/Factory/Extractor.php b/src/Factory/Extractor.php index a59a408..fee658a 100644 --- a/src/Factory/Extractor.php +++ b/src/Factory/Extractor.php @@ -75,10 +75,8 @@ private function findCapacity(array $config): Akeneo\Capacity\CapacityInterface public function compile(array $config): Repository\Extractor { - $builder = new Akeneo\Builder\Extractor(); - try { - $builder->withCapacity( + $builder = new Akeneo\Builder\Extractor( $this->findCapacity($config)->getBuilder($config) ); } catch (NoApplicableCapacityException $exception) { diff --git a/src/Factory/Lookup.php b/src/Factory/Lookup.php index fed20ef..e6a5116 100644 --- a/src/Factory/Lookup.php +++ b/src/Factory/Lookup.php @@ -98,14 +98,10 @@ public function compile(array $config): Repository\Lookup { try { if (!array_key_exists('conditional', $config)) { - $alternativeBuilder = new Akeneo\Builder\AlternativeLookup(); - $builder = new Akeneo\Builder\Lookup($alternativeBuilder); - $repository = new Repository\Lookup($builder); - try { - $alternativeBuilder->withCapacity( - $this->findCapacity($config)->getBuilder($config) - ); + $alternativeBuilder = new Akeneo\Builder\AlternativeLookup($this->findCapacity($config)->getBuilder($config)); + $builder = new Akeneo\Builder\Lookup($alternativeBuilder); + $repository = new Repository\Lookup($builder); } catch (NoApplicableCapacityException $exception) { throw new Configurator\InvalidConfigurationException( message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', @@ -119,10 +115,9 @@ public function compile(array $config): Repository\Lookup $repository = new Repository\Lookup($builder); foreach ($config['conditional'] as $alternative) { - $alternativeBuilder = new Akeneo\Builder\AlternativeLookup(); try { - $alternativeBuilder->withCapacity( + $alternativeBuilder = new Akeneo\Builder\AlternativeLookup( $this->findCapacity($alternative)->getBuilder($alternative) ); } catch (NoApplicableCapacityException $exception) { diff --git a/tests/functional/Builder/ExtractorTest.php b/tests/functional/Builder/ExtractorTest.php new file mode 100644 index 0000000..9e428ba --- /dev/null +++ b/tests/functional/Builder/ExtractorTest.php @@ -0,0 +1,78 @@ +fs = vfsStream::setup(); + } + + protected function tearDown(): void + { + $this->fs = null; + vfsStreamWrapper::unregister(); + } + + protected function getBuilderCompilePath(): string + { + return $this->fs->url(); + } + + public function pipelineRunner(): PipelineRunnerInterface + { + return new PipelineRunner(); + } + + public function testAllProducts(): void + { + $httpClient = new Mock\HttpClientBuilder(new Mock\ResponseFactoryBuilder()); + + $httpClient + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/product', methods: ['GET']), + new Mock\ResponseBuilder(status: 200) + ); + + $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client + ->withHttpClient($httpClient) + ->withRequestFactory(new Mock\RequestFactoryBuilder()) + ->withStreamFactory(new Mock\StreamFactoryBuilder()) + ->withFileSystem(new Mock\FileSystemBuilder()) + ->withAuthenticatedByPassword(); + + $capacity = new Capacity\Extractor\All(); + $capacity->withEndpoint(new Node\Identifier('getProductApi')); + $capacity->withType('product'); + + $builder = new Extractor($capacity); + $builder->withClient($client->getNode()); + + $this->assertBuildsExtractorExtractsLike( + [ + [], + [], + [], + ], + $builder, + ); + } +} diff --git a/tests/functional/Factory/Repository/ExtractorTest.php b/tests/functional/Factory/Repository/ExtractorTest.php index 4092e04..928149f 100644 --- a/tests/functional/Factory/Repository/ExtractorTest.php +++ b/tests/functional/Factory/Repository/ExtractorTest.php @@ -6,6 +6,8 @@ use Kiboko\Contract\Packaging\FileInterface; use Kiboko\Plugin\Akeneo\Builder; use Kiboko\Plugin\Akeneo\Factory\Repository; +use PhpParser\Builder as Capacity; +use PhpParser\Node; use PHPUnit\Framework\TestCase; final class ExtractorTest extends TestCase @@ -26,7 +28,11 @@ public function fileMock(string $filename): FileInterface public function testMergeWithPackages(): void { - $builder = new Builder\Extractor(); + $capacity = $this->getMockBuilder(Capacity::class)->getMock(); + + $capacity->method('getNode')->willReturn(new Node\Stmt\Nop()); + + $builder = new Builder\Extractor($capacity); $child = $this->getMockBuilder(RepositoryInterface::class)->getMock(); @@ -44,7 +50,11 @@ public function testMergeWithPackages(): void public function testMergeWithFiles(): void { - $builder = new Builder\Extractor(); + $capacity = $this->getMockBuilder(Capacity::class)->getMock(); + + $capacity->method('getNode')->willReturn(new Node\Stmt\Nop()); + + $builder = new Builder\Extractor($capacity); $child = $this->getMockBuilder(RepositoryInterface::class)->getMock(); diff --git a/tests/functional/Factory/Repository/LoaderTest.php b/tests/functional/Factory/Repository/LoaderTest.php index f01d5c6..63498dc 100644 --- a/tests/functional/Factory/Repository/LoaderTest.php +++ b/tests/functional/Factory/Repository/LoaderTest.php @@ -6,6 +6,8 @@ use Kiboko\Contract\Packaging\FileInterface; use Kiboko\Plugin\Akeneo\Builder; use Kiboko\Plugin\Akeneo\Factory\Repository; +use PhpParser\Builder as Capacity; +use PhpParser\Node; use PHPUnit\Framework\TestCase; final class LoaderTest extends TestCase @@ -26,7 +28,11 @@ public function fileMock(string $filename): FileInterface public function testMergeWithPackages(): void { - $builder = new Builder\Loader(); + $capacity = $this->getMockBuilder(Capacity::class)->getMock(); + + $capacity->method('getNode')->willReturn(new Node\Stmt\Nop()); + + $builder = new Builder\Loader($capacity); $child = $this->getMockBuilder(RepositoryInterface::class)->getMock(); @@ -44,7 +50,11 @@ public function testMergeWithPackages(): void public function testMergeWithFiles(): void { - $builder = new Builder\Loader(); + $capacity = $this->getMockBuilder(Capacity::class)->getMock(); + + $capacity->method('getNode')->willReturn(new Node\Stmt\Nop()); + + $builder = new Builder\Loader($capacity); $child = $this->getMockBuilder(RepositoryInterface::class)->getMock(); diff --git a/tests/functional/Factory/Repository/LookupTest.php b/tests/functional/Factory/Repository/LookupTest.php index f49bb3f..c03a409 100644 --- a/tests/functional/Factory/Repository/LookupTest.php +++ b/tests/functional/Factory/Repository/LookupTest.php @@ -7,6 +7,8 @@ use Kiboko\Plugin\Akeneo\Builder; use Kiboko\Plugin\Akeneo\Builder\AlternativeLookup; use Kiboko\Plugin\Akeneo\Factory\Repository; +use PhpParser\Builder as Capacity; +use PhpParser\Node; use PHPUnit\Framework\TestCase; final class LookupTest extends TestCase @@ -27,7 +29,11 @@ public function fileMock(string $filename): FileInterface public function testMergeWithPackages(): void { - $builder = new Builder\Lookup(new AlternativeLookup()); + $capacity = $this->getMockBuilder(Capacity::class)->getMock(); + + $capacity->method('getNode')->willReturn(new Node\Stmt\Nop()); + + $builder = new Builder\Lookup(new AlternativeLookup($capacity)); $child = $this->getMockBuilder(RepositoryInterface::class)->getMock(); @@ -45,7 +51,11 @@ public function testMergeWithPackages(): void public function testMergeWithFiles(): void { - $builder = new Builder\Lookup(new AlternativeLookup()); + $capacity = $this->getMockBuilder(Capacity::class)->getMock(); + + $capacity->method('getNode')->willReturn(new Node\Stmt\Nop()); + + $builder = new Builder\Lookup(new AlternativeLookup($capacity)); $child = $this->getMockBuilder(RepositoryInterface::class)->getMock(); diff --git a/tests/functional/Mock/ApiClientMockBuilder.php b/tests/functional/Mock/ApiClientMockBuilder.php new file mode 100644 index 0000000..196a13c --- /dev/null +++ b/tests/functional/Mock/ApiClientMockBuilder.php @@ -0,0 +1,149 @@ +node = new Node\Expr\New_( + class: new Node\Name\FullyQualified( + $withEnterpriseSupport === true ? AkeneoPimEnterpriseClientBuilder::class : AkeneoPimClientBuilder::class + ), + args: [ + new Node\Arg( + new Node\Scalar\String_('https://akeneo.'.$faker->safeEmailDomain()), + ), + ], + );; + } + + public function withHttpClient(Mock\HttpClientBuilder $httpClient): self + { + $this->node = new Node\Expr\MethodCall( + var: $this->node, + name: new Node\Identifier('setHttpClient'), + args: [ + new Node\Arg( + $httpClient->getNode(), + ), + ], + ); + + return $this; + } + + public function withRequestFactory(Mock\RequestFactoryBuilder $requestFactory): self + { + $this->node = new Node\Expr\MethodCall( + var: $this->node, + name: new Node\Identifier('withRequestFactory'), + args: [ + new Node\Arg( + $requestFactory->getNode(), + ), + ], + ); + + return $this; + } + + public function withStreamFactory(Mock\StreamFactoryBuilder $streamFactory): self + { + $this->node = new Node\Expr\MethodCall( + var: $this->node, + name: new Node\Identifier('withStreamFactory'), + args: [ + new Node\Arg( + $streamFactory->getNode(), + ), + ], + ); + + return $this; + } + + public function withFileSystem(Mock\FileSystemBuilder $fileSystem): self + { + $this->node = new Node\Expr\MethodCall( + var: $this->node, + name: new Node\Identifier('withFileSystem'), + args: [ + new Node\Arg( + $fileSystem->getNode(), + ), + ], + ); + + return $this; + } + + public function withAuthenticatedByPassword(): self + { + $faker = Factory::create(); + + $this->node = new Node\Expr\MethodCall( + var: $this->node, + name: new Node\Identifier('buildAuthenticatedByPassword'), + args: [ + new Node\Arg( + new Node\Scalar\String_($faker->regexify('\d{1,2}_[0-9a-f]{48}')), + ), + new Node\Arg( + new Node\Scalar\String_($faker->regexify('[0-9a-z]{64}')), + ), + new Node\Arg( + new Node\Scalar\String_($faker->userName()), + ), + new Node\Arg( + new Node\Scalar\String_($faker->password()), + ), + ], + ); + + return $this; + } + + public function withAuthenticatedByToken(): self + { + $faker = Factory::create(); + + $this->node = new Node\Expr\MethodCall( + var: $this->node, + name: new Node\Identifier('buildAuthenticatedByPassword'), + args: [ + new Node\Arg( + new Node\Scalar\String_($faker->regexify('\d{1,2}_[0-9a-f]{48}')), + ), + new Node\Arg( + new Node\Scalar\String_($faker->regexify('[0-9a-z]{64}')), + ), + new Node\Arg( + new Node\Scalar\String_($faker->regexify('[0-9a-z/-]{48}')), + ), + new Node\Arg( + new Node\Scalar\String_($faker->regexify('[0-9a-z/-]{128}')), + ), + ], + ); + + return $this; + } + + public function getNode(): Node\Expr + { + return $this->node; + } +} diff --git a/tests/functional/Mock/ExceptionBuilder.php b/tests/functional/Mock/ExceptionBuilder.php new file mode 100644 index 0000000..24d0c1c --- /dev/null +++ b/tests/functional/Mock/ExceptionBuilder.php @@ -0,0 +1,33 @@ +arguments = $arguments; + } + + public function getNode(): Node + { + return new Node\Expr\New_( + class: new Node\Name\FullyQualified($this->class), + args: [ + array_map( + fn (Node\Expr $value, int|string $key) => !is_string($key) ? new Node\Arg(value: $value) : new Node\Arg(value: $value, name: new Node\Identifier($key)), + $this->arguments, + array_keys($this->arguments), + ) + ] + ); + } +} diff --git a/tests/functional/Mock/FileSystemBuilder.php b/tests/functional/Mock/FileSystemBuilder.php new file mode 100644 index 0000000..69f0411 --- /dev/null +++ b/tests/functional/Mock/FileSystemBuilder.php @@ -0,0 +1,17 @@ +nodes[] = new Node\Expr\MethodCall( + var: new Node\Expr\Variable('client'), + name: new Node\Identifier('on'), + args: [ + new Node\Arg( + value: $requestMatcher->getNode(), + ), + new Node\Arg( + value: $response->getNode(), + ), + ], + ); + + return $this; + } + + public function expectException( + Mock\RequestMatcher\RequestMatcherBuilderInterface $requestMatcher, + Mock\ExceptionBuilder $exception, + ): self { + $this->node = new Node\Expr\MethodCall( + var: new Node\Expr\Variable('client'), + name: new Node\Identifier('on'), + args: [ + new Node\Arg( + value: $requestMatcher->getNode(), + ), + new Node\Arg( + value: $exception->getNode(), + ), + ], + ); + + return $this; + } + + public function getNode(): Node\Expr + { + return new Node\Expr\FuncCall( + name: new Node\Expr\Closure( + subNodes: [ + 'stmts' => [ + new Node\Stmt\Expression( + new Node\Expr\Assign( + var: new Node\Expr\Variable('client'), + expr: new Node\Expr\New_( + class: new Node\Name\FullyQualified( + name: Client::class + ), + args: [ + new Node\Arg( + $this->responseFactory->getNode(), + ), + ], + ), + ), + ), + ...array_map( + fn (Node\Expr $node) => new Node\Stmt\Expression($node), + $this->nodes, + ), + new Node\Stmt\Return_( + expr: new Node\Expr\Variable('client'), + ), + ], + ], + ), + ); + } +} diff --git a/tests/functional/Mock/RequestFactoryBuilder.php b/tests/functional/Mock/RequestFactoryBuilder.php new file mode 100644 index 0000000..fba4e26 --- /dev/null +++ b/tests/functional/Mock/RequestFactoryBuilder.php @@ -0,0 +1,16 @@ +path !== null ? new Node\Scalar\String_($this->path) : new Node\Expr\ConstFetch(new Node\Name('null')), + name: new Node\Identifier('path'), + ), + new Node\Arg( + value: $this->host !== null ? new Node\Scalar\String_($this->host) : new Node\Expr\ConstFetch(new Node\Name('null')), + name: new Node\Identifier('host'), + ), + new Node\Arg( + value: new Node\Expr\Array_( + items: array_map( + fn (string $value): Node\Expr => new Node\Expr\ArrayItem( + new Node\Scalar\String_($value), + ), + $this->methods + ), + attributes: [ + 'kind' => Node\Expr\Array_::KIND_SHORT + ], + ), + name: new Node\Identifier('methods'), + ), + new Node\Arg( + value: new Node\Expr\Array_( + items: array_map( + fn (string $value): Node\Expr => new Node\Expr\ArrayItem( + new Node\Scalar\String_($value), + ), + $this->schemes + ), + attributes: [ + 'kind' => Node\Expr\Array_::KIND_SHORT + ], + ), + name: new Node\Identifier('schemes'), + ), + ], + ); + } +} diff --git a/tests/functional/Mock/RequestMatcher/RequestMatcherBuilderInterface.php b/tests/functional/Mock/RequestMatcher/RequestMatcherBuilderInterface.php new file mode 100644 index 0000000..cd9fb00 --- /dev/null +++ b/tests/functional/Mock/RequestMatcher/RequestMatcherBuilderInterface.php @@ -0,0 +1,9 @@ +a(); + return $instance; + } + + public function getNode(): Node + { + return new Node\Expr\New_( + class: new Node\Name(Response::class), + args: [ + new Node\Arg( + value: new Node\Scalar\LNumber($this->status), + name: new Node\Identifier('status'), + ), + ] + ); + } +} diff --git a/tests/functional/Mock/ResponseFactoryBuilder.php b/tests/functional/Mock/ResponseFactoryBuilder.php new file mode 100644 index 0000000..03a62d4 --- /dev/null +++ b/tests/functional/Mock/ResponseFactoryBuilder.php @@ -0,0 +1,16 @@ +initialize(); + $rejection->initialize(); + + $source->rewind(); + $async->rewind(); + + while ($source->valid() && $async->valid()) { + $bucket = $async->send($source->current()); + + if ($bucket instanceof RejectionResultBucketInterface) { + foreach ($bucket->walkRejection() as $line) { + $rejection->reject($line); + $state->reject(); + } + } + if ($bucket instanceof AcceptanceResultBucketInterface) { + yield from $bucket->walkAcceptance(); + $state->accept(); + } + + $source->next(); + } + + $rejection->teardown(); + $state->teardown(); + } +} From bd3d595f206bc568f2c327fdc122bb3de28fcf9e Mon Sep 17 00:00:00 2001 From: clemzarch Date: Mon, 23 May 2022 14:20:57 +0200 Subject: [PATCH 02/19] mock the token response to pass the extractor test --- composer.json | 7 +- composer.lock | 1085 +++++++++-------- tests/functional/Builder/ExtractorTest.php | 109 +- tests/functional/Builder/body.json | 124 ++ tests/functional/Builder/fake-token.php | 3 + tests/functional/Builder/products.all.php | 3 + tests/functional/Builder/token.json | 7 + .../functional/Mock/ApiClientMockBuilder.php | 6 +- tests/functional/Mock/ResponseBuilder.php | 19 +- 9 files changed, 818 insertions(+), 545 deletions(-) create mode 100644 tests/functional/Builder/body.json create mode 100644 tests/functional/Builder/fake-token.php create mode 100644 tests/functional/Builder/products.all.php create mode 100644 tests/functional/Builder/token.json diff --git a/composer.json b/composer.json index 7b4e6c9..7642722 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "mybuilder/phpunit-accelerator": "*", "php-etl/pipeline-contracts": "^0.3.0", "php-etl/bucket-contracts": "^0.1.0", - "akeneo/api-php-client-ee": "^4.0", + "akeneo/api-php-client-ee": "^5.0", "php-etl/bucket": "^0.2.0", "guzzlehttp/psr7": "^2.0", "php-http/message": "^1.11", @@ -61,6 +61,9 @@ } }, "config": { - "bin-dir": "bin" + "bin-dir": "bin", + "allow-plugins": { + "infection/extension-installer": true + } } } diff --git a/composer.lock b/composer.lock index cbf89c2..73bf685 100644 --- a/composer.lock +++ b/composer.lock @@ -4,38 +4,34 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "528c5f0fae78f999815ddfd3df144fe2", + "content-hash": "debe00c78e2a208318f098333d7eb705", "packages": [ { "name": "doctrine/inflector", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "9cf661f4eb38f7c881cac67c75ea9b00bf97b210" + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/9cf661f4eb38f7c881cac67c75ea9b00bf97b210", - "reference": "9cf661f4eb38f7c881cac67c75ea9b00bf97b210", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^7.0", - "phpstan/phpstan": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "doctrine/coding-standard": "^8.2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "vimeo/psalm": "^4.10" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" @@ -83,7 +79,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.x" + "source": "https://github.com/doctrine/inflector/tree/2.0.4" }, "funding": [ { @@ -99,7 +95,7 @@ "type": "tidelift" } ], - "time": "2020-05-29T15:13:26+00:00" + "time": "2021-10-22T20:16:43+00:00" }, { "name": "nikic/php-parser", @@ -211,16 +207,16 @@ }, { "name": "php-etl/fast-map", - "version": "dev-master", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/php-etl/fast-map.git", - "reference": "f2844f6d9ad7c8e70e1609396f7d95f9d3a02191" + "reference": "3d5a7e5fd5a4502dab86a256a05b27bdbb59e7bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/fast-map/zipball/f2844f6d9ad7c8e70e1609396f7d95f9d3a02191", - "reference": "f2844f6d9ad7c8e70e1609396f7d95f9d3a02191", + "url": "https://api.github.com/repos/php-etl/fast-map/zipball/3d5a7e5fd5a4502dab86a256a05b27bdbb59e7bb", + "reference": "3d5a7e5fd5a4502dab86a256a05b27bdbb59e7bb", "shasum": "" }, "require": { @@ -249,7 +245,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.2.x-dev" + "dev-main": "0.2.x-dev" } }, "autoload": { @@ -274,22 +270,22 @@ "description": "This library implements a compiled data mapping library", "support": { "issues": "https://github.com/php-etl/fast-map/issues", - "source": "https://github.com/php-etl/fast-map/tree/master" + "source": "https://github.com/php-etl/fast-map/tree/main" }, - "time": "2021-09-21T21:54:46+00:00" + "time": "2022-05-16T19:37:26+00:00" }, { "name": "php-etl/fast-map-config", - "version": "dev-master", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/php-etl/fast-map-config.git", - "reference": "56bdf2447328465df53ec171608ec03aa644ab4b" + "reference": "4c8e3ac81fcef28f1852af493ae9c59bd8a11a95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/fast-map-config/zipball/56bdf2447328465df53ec171608ec03aa644ab4b", - "reference": "56bdf2447328465df53ec171608ec03aa644ab4b", + "url": "https://api.github.com/repos/php-etl/fast-map-config/zipball/4c8e3ac81fcef28f1852af493ae9c59bd8a11a95", + "reference": "4c8e3ac81fcef28f1852af493ae9c59bd8a11a95", "shasum": "" }, "require": { @@ -310,7 +306,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.3.x-dev" + "dev-main": "0.3.x-dev" } }, "autoload": { @@ -335,32 +331,32 @@ "description": "This library implements the Extract-Transform-Load pattern asynchronously in PHP with the help of iterators and generators", "support": { "issues": "https://github.com/php-etl/fast-map-config/issues", - "source": "https://github.com/php-etl/fast-map-config/tree/master" + "source": "https://github.com/php-etl/fast-map-config/tree/main" }, - "time": "2021-06-03T09:09:09+00:00" + "time": "2022-05-16T19:37:25+00:00" }, { "name": "php-etl/fast-map-plugin", - "version": "dev-master", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/php-etl/fast-map-plugin.git", - "reference": "abdffe1a5bf305f897fd5b78af1cb96f8b1afdab" + "reference": "c7d8936ac497736e89d66bf61bc59ae7aa16fcee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/fast-map-plugin/zipball/abdffe1a5bf305f897fd5b78af1cb96f8b1afdab", - "reference": "abdffe1a5bf305f897fd5b78af1cb96f8b1afdab", + "url": "https://api.github.com/repos/php-etl/fast-map-plugin/zipball/c7d8936ac497736e89d66bf61bc59ae7aa16fcee", + "reference": "c7d8936ac497736e89d66bf61bc59ae7aa16fcee", "shasum": "" }, "require": { "ext-json": "*", "nikic/php-parser": "^4.10", "php": "^8.0", - "php-etl/configurator-contracts": "^0.4.0@dev", - "php-etl/fast-map-config": "^0.3.0@dev", - "php-etl/packaging-contracts": "^0.1.0@dev", - "php-etl/satellite-toolbox": "^0.2.0@dev", + "php-etl/configurator-contracts": "^0.4.0", + "php-etl/fast-map-config": "^0.3.0", + "php-etl/packaging-contracts": "^0.1.1", + "php-etl/satellite-toolbox": "^0.2.0", "symfony/config": "^5.2" }, "require-dev": { @@ -378,10 +374,12 @@ "type": "gyroscops-plugin", "extra": { "branch-alias": { - "dev-master": "0.6.x-dev" + "dev-main": "0.6.x-dev" }, - "satellite": { - "class": "Kiboko\\Plugin\\FastMap\\Service" + "gyroscops": { + "plugins": [ + "Kiboko\\Plugin\\FastMap\\Service" + ] } }, "autoload": { @@ -402,22 +400,22 @@ "description": "Adapters for the Fast Map mapping library", "support": { "issues": "https://github.com/php-etl/fast-map-plugin/issues", - "source": "https://github.com/php-etl/fast-map-plugin/tree/master" + "source": "https://github.com/php-etl/fast-map-plugin/tree/main" }, - "time": "2021-10-05T14:05:12+00:00" + "time": "2022-05-16T19:37:24+00:00" }, { "name": "php-etl/mapping-contracts", - "version": "dev-master", + "version": "v0.2.0", "source": { "type": "git", "url": "https://github.com/php-etl/mapping-contracts.git", - "reference": "0189b05848a09fd901bc187b18d9f173c7902b57" + "reference": "6d69ed77a969278b6e5ca13209d7a5c0ca447844" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/mapping-contracts/zipball/0189b05848a09fd901bc187b18d9f173c7902b57", - "reference": "0189b05848a09fd901bc187b18d9f173c7902b57", + "url": "https://api.github.com/repos/php-etl/mapping-contracts/zipball/6d69ed77a969278b6e5ca13209d7a5c0ca447844", + "reference": "6d69ed77a969278b6e5ca13209d7a5c0ca447844", "shasum": "" }, "require": { @@ -426,7 +424,6 @@ "php-etl/metadata-contracts": "^0.1.0", "symfony/property-access": "^5.2" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -452,25 +449,25 @@ "email": "gregory@kiboko.fr" } ], - "description": "Interfaces for FastMap", + "description": "Contracts for building compiled data mappers", "support": { "issues": "https://github.com/php-etl/mapping-contracts/issues", - "source": "https://github.com/php-etl/mapping-contracts/tree/master" + "source": "https://github.com/php-etl/mapping-contracts/tree/v0.2.0" }, - "time": "2021-06-28T07:02:18+00:00" + "time": "2021-09-26T20:04:54+00:00" }, { "name": "php-etl/metadata", - "version": "dev-master", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/php-etl/metadata.git", - "reference": "16bd2980a576bc3e65715ef1ba595f39cf830920" + "reference": "2240d8ea1eb53152a715d7f35a2259ca866e0c2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/metadata/zipball/16bd2980a576bc3e65715ef1ba595f39cf830920", - "reference": "16bd2980a576bc3e65715ef1ba595f39cf830920", + "url": "https://api.github.com/repos/php-etl/metadata/zipball/2240d8ea1eb53152a715d7f35a2259ca866e0c2f", + "reference": "2240d8ea1eb53152a715d7f35a2259ca866e0c2f", "shasum": "" }, "require": { @@ -492,7 +489,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.2.x-dev" + "dev-main": "0.2.x-dev" } }, "autoload": { @@ -517,22 +514,22 @@ "description": "Describe data structures, to auto-configure and handle data transformation and data manipulation.", "support": { "issues": "https://github.com/php-etl/metadata/issues", - "source": "https://github.com/php-etl/metadata/tree/master" + "source": "https://github.com/php-etl/metadata/tree/main" }, - "time": "2021-02-08T09:54:43+00:00" + "time": "2022-05-16T19:37:26+00:00" }, { "name": "php-etl/metadata-contracts", - "version": "dev-master", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/php-etl/metadata-contracts.git", - "reference": "652cddefa328c2819715a6ac1bc46f73d2b1666e" + "reference": "1f15158446f02e6397a0f95c728f377a3dcbb49f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/metadata-contracts/zipball/652cddefa328c2819715a6ac1bc46f73d2b1666e", - "reference": "652cddefa328c2819715a6ac1bc46f73d2b1666e", + "url": "https://api.github.com/repos/php-etl/metadata-contracts/zipball/1f15158446f02e6397a0f95c728f377a3dcbb49f", + "reference": "1f15158446f02e6397a0f95c728f377a3dcbb49f", "shasum": "" }, "require": { @@ -542,7 +539,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.1.x-dev" + "dev-main": "0.1.x-dev" } }, "autoload": { @@ -567,22 +564,22 @@ "description": "Interfaces for the Metadata package whose role is to describe data structures.", "support": { "issues": "https://github.com/php-etl/metadata-contracts/issues", - "source": "https://github.com/php-etl/metadata-contracts/tree/master" + "source": "https://github.com/php-etl/metadata-contracts/tree/main" }, - "time": "2021-02-04T13:29:20+00:00" + "time": "2022-05-16T19:37:24+00:00" }, { "name": "php-etl/packaging-contracts", - "version": "v0.1.0", + "version": "v0.1.1", "source": { "type": "git", "url": "https://github.com/php-etl/packaging-contracts.git", - "reference": "349dc9b75c75eb96bffbddd941c072354db83a81" + "reference": "1cea04542b05a721ec1433d4425247c2aaa47f0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/packaging-contracts/zipball/349dc9b75c75eb96bffbddd941c072354db83a81", - "reference": "349dc9b75c75eb96bffbddd941c072354db83a81", + "url": "https://api.github.com/repos/php-etl/packaging-contracts/zipball/1cea04542b05a721ec1433d4425247c2aaa47f0b", + "reference": "1cea04542b05a721ec1433d4425247c2aaa47f0b", "shasum": "" }, "require": { @@ -617,22 +614,22 @@ "description": "This library aims at providing contracts for building TAR archives, using PHP resources and streams", "support": { "issues": "https://github.com/php-etl/packaging-contracts/issues", - "source": "https://github.com/php-etl/packaging-contracts/tree/v0.1.0" + "source": "https://github.com/php-etl/packaging-contracts/tree/v0.1.1" }, - "time": "2021-05-28T15:26:06+00:00" + "time": "2021-09-26T19:38:57+00:00" }, { "name": "php-etl/satellite-toolbox", - "version": "dev-master", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/php-etl/satellite-toolbox.git", - "reference": "306204b5d57beb0c0435ad072f76d8b24ee86a76" + "reference": "0009fd2be16d07b860b45b46b4ab99329b597417" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/satellite-toolbox/zipball/306204b5d57beb0c0435ad072f76d8b24ee86a76", - "reference": "306204b5d57beb0c0435ad072f76d8b24ee86a76", + "url": "https://api.github.com/repos/php-etl/satellite-toolbox/zipball/0009fd2be16d07b860b45b46b4ab99329b597417", + "reference": "0009fd2be16d07b860b45b46b4ab99329b597417", "shasum": "" }, "require": { @@ -653,17 +650,17 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.2.x-dev" + "dev-main": "0.2.x-dev" } }, "autoload": { - "psr-4": { - "Kiboko\\Component\\SatelliteToolbox\\": "src/" - }, "files": [ "src/ast.php", "src/configuration.php" - ] + ], + "psr-4": { + "Kiboko\\Component\\SatelliteToolbox\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -682,22 +679,22 @@ "description": "This library aims at building and running lambda PHP functions", "support": { "issues": "https://github.com/php-etl/satellite-toolbox/issues", - "source": "https://github.com/php-etl/satellite-toolbox/tree/master" + "source": "https://github.com/php-etl/satellite-toolbox/tree/main" }, - "time": "2021-09-21T21:51:45+00:00" + "time": "2022-05-18T15:53:16+00:00" }, { "name": "phpactor/docblock", - "version": "0.3.4", + "version": "0.3.6", "source": { "type": "git", "url": "https://github.com/phpactor/docblock.git", - "reference": "a82cde09f49e388bb7a505465135aeff68c51647" + "reference": "a5567feab7b36938d6a1018a60efc5a7c4fd696c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpactor/docblock/zipball/a82cde09f49e388bb7a505465135aeff68c51647", - "reference": "a82cde09f49e388bb7a505465135aeff68c51647", + "url": "https://api.github.com/repos/phpactor/docblock/zipball/a5567feab7b36938d6a1018a60efc5a7c4fd696c", + "reference": "a5567feab7b36938d6a1018a60efc5a7c4fd696c", "shasum": "" }, "require": { @@ -734,9 +731,10 @@ "description": "Simple Docblock Parser", "support": { "issues": "https://github.com/phpactor/docblock/issues", - "source": "https://github.com/phpactor/docblock/tree/0.3.4" + "source": "https://github.com/phpactor/docblock/tree/0.3.6" }, - "time": "2021-02-06T14:38:53+00:00" + "abandoned": true, + "time": "2022-03-08T11:46:42+00:00" }, { "name": "psr/cache", @@ -789,22 +787,27 @@ }, { "name": "psr/container", - "version": "1.1.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -831,9 +834,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/log", @@ -887,16 +890,16 @@ }, { "name": "symfony/cache", - "version": "v5.3.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "864867b13bd67347497ce956f4b253f8fe18b80c" + "reference": "4c6747cf7e56c6b8e3094dd24852bd3e364375b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/864867b13bd67347497ce956f4b253f8fe18b80c", - "reference": "864867b13bd67347497ce956f4b253f8fe18b80c", + "url": "https://api.github.com/repos/symfony/cache/zipball/4c6747cf7e56c6b8e3094dd24852bd3e364375b1", + "reference": "4c6747cf7e56c6b8e3094dd24852bd3e364375b1", "shasum": "" }, "require": { @@ -904,35 +907,35 @@ "psr/cache": "^1.0|^2.0", "psr/log": "^1.1|^2|^3", "symfony/cache-contracts": "^1.1.7|^2", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "conflict": { - "doctrine/dbal": "<2.10", + "doctrine/dbal": "<2.13.1", "symfony/dependency-injection": "<4.4", "symfony/http-kernel": "<4.4", "symfony/var-dumper": "<4.4" }, "provide": { "psr/cache-implementation": "1.0|2.0", - "psr/simple-cache-implementation": "1.0", + "psr/simple-cache-implementation": "1.0|2.0", "symfony/cache-implementation": "1.0|2.0" }, "require-dev": { "cache/integration-tests": "dev-master", "doctrine/cache": "^1.6|^2.0", - "doctrine/dbal": "^2.10|^3.0", + "doctrine/dbal": "^2.13.1|^3.0", "predis/predis": "^1.1", - "psr/simple-cache": "^1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/filesystem": "^4.4|^5.0", - "symfony/http-kernel": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/simple-cache": "^1.0|^2.0", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/filesystem": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/messenger": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { @@ -964,7 +967,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.3.7" + "source": "https://github.com/symfony/cache/tree/v5.4.8" }, "funding": [ { @@ -980,20 +983,20 @@ "type": "tidelift" } ], - "time": "2021-08-29T15:08:21+00:00" + "time": "2022-04-26T13:19:20+00:00" }, { "name": "symfony/cache-contracts", - "version": "v2.4.0", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/symfony/cache-contracts.git", - "reference": "c0446463729b89dd4fa62e9aeecc80287323615d" + "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/c0446463729b89dd4fa62e9aeecc80287323615d", - "reference": "c0446463729b89dd4fa62e9aeecc80287323615d", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", + "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", "shasum": "" }, "require": { @@ -1006,7 +1009,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -1043,7 +1046,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/cache-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/cache-contracts/tree/v2.5.1" }, "funding": [ { @@ -1059,26 +1062,26 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/config", - "version": "v5.3.4", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "4268f3059c904c61636275182707f81645517a37" + "reference": "9f8964f56f7234f8ace16f66cb3fbae950c04e68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/4268f3059c904c61636275182707f81645517a37", - "reference": "4268f3059c904c61636275182707f81645517a37", + "url": "https://api.github.com/repos/symfony/config/zipball/9f8964f56f7234f8ace16f66cb3fbae950c04e68", + "reference": "9f8964f56f7234f8ace16f66cb3fbae950c04e68", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/filesystem": "^4.4|^5.0", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/filesystem": "^4.4|^5.0|^6.0", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-php80": "^1.16", "symfony/polyfill-php81": "^1.22" @@ -1087,11 +1090,11 @@ "symfony/finder": "<4.4" }, "require-dev": { - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/yaml": "^4.4|^5.0" + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/messenger": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/yaml": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -1122,7 +1125,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v5.3.4" + "source": "https://github.com/symfony/config/tree/v5.4.8" }, "funding": [ { @@ -1138,29 +1141,29 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2022-04-12T16:02:29+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v3.0.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -1189,7 +1192,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.1" }, "funding": [ { @@ -1205,26 +1208,26 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/expression-language", - "version": "v5.3.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "fe696e2669cb47507e5635223ac4b64500339658" + "reference": "9d186e1eecf9e3461c6adbdf1acf614b8da9def9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/fe696e2669cb47507e5635223ac4b64500339658", - "reference": "fe696e2669cb47507e5635223ac4b64500339658", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/9d186e1eecf9e3461c6adbdf1acf614b8da9def9", + "reference": "9d186e1eecf9e3461c6adbdf1acf614b8da9def9", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/cache": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2" + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3" }, "type": "library", "autoload": { @@ -1252,7 +1255,7 @@ "description": "Provides an engine that can compile and evaluate expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/expression-language/tree/v5.3.7" + "source": "https://github.com/symfony/expression-language/tree/v5.4.8" }, "funding": [ { @@ -1268,26 +1271,26 @@ "type": "tidelift" } ], - "time": "2021-08-23T12:57:24+00:00" + "time": "2022-04-08T05:07:18+00:00" }, { "name": "symfony/filesystem", - "version": "v5.3.4", + "version": "v6.0.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32" + "reference": "6c9e4c41f2c51dfde3db298594ed9cba55dbf5ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/343f4fe324383ca46792cae728a3b6e2f708fb32", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/6c9e4c41f2c51dfde3db298594ed9cba55dbf5ff", + "reference": "6c9e4c41f2c51dfde3db298594ed9cba55dbf5ff", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", "autoload": { @@ -1315,7 +1318,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.3.4" + "source": "https://github.com/symfony/filesystem/tree/v6.0.7" }, "funding": [ { @@ -1331,25 +1334,28 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2022-04-01T12:54:51+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -1364,12 +1370,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1394,7 +1400,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, "funding": [ { @@ -1410,20 +1416,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", "shasum": "" }, "require": { @@ -1443,12 +1449,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1475,7 +1481,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" }, "funding": [ { @@ -1491,11 +1497,11 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-23T21:10:46+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -1524,12 +1530,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1559,7 +1565,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" }, "funding": [ { @@ -1579,21 +1585,24 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, @@ -1608,12 +1617,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1639,7 +1648,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" }, "funding": [ { @@ -1655,20 +1664,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", "shasum": "" }, "require": { @@ -1685,12 +1694,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1718,7 +1727,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" }, "funding": [ { @@ -1734,20 +1743,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-06-05T21:20:04+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", "shasum": "" }, "require": { @@ -1764,12 +1773,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1801,7 +1810,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" }, "funding": [ { @@ -1817,20 +1826,20 @@ "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2022-03-04T08:16:47+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.23.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "e66119f3de95efc359483f810c4c3e6436279436" + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/e66119f3de95efc359483f810c4c3e6436279436", - "reference": "e66119f3de95efc359483f810c4c3e6436279436", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", "shasum": "" }, "require": { @@ -1847,12 +1856,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1880,7 +1889,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" }, "funding": [ { @@ -1896,30 +1905,30 @@ "type": "tidelift" } ], - "time": "2021-05-21T13:25:03+00:00" + "time": "2021-09-13T13:58:11+00:00" }, { "name": "symfony/property-access", - "version": "v5.3.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "a4bbf09b8f3e2d2c89cc2c8b3d6682bf4c3d5589" + "reference": "fe501d498d6ec7e9efe928c90fabedf629116495" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/a4bbf09b8f3e2d2c89cc2c8b3d6682bf4c3d5589", - "reference": "a4bbf09b8f3e2d2c89cc2c8b3d6682bf4c3d5589", + "url": "https://api.github.com/repos/symfony/property-access/zipball/fe501d498d6ec7e9efe928c90fabedf629116495", + "reference": "fe501d498d6ec7e9efe928c90fabedf629116495", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php80": "^1.16", - "symfony/property-info": "^5.2" + "symfony/property-info": "^5.2|^6.0" }, "require-dev": { - "symfony/cache": "^4.4|^5.0" + "symfony/cache": "^4.4|^5.0|^6.0" }, "suggest": { "psr/cache-implementation": "To cache access methods." @@ -1961,7 +1970,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v5.3.7" + "source": "https://github.com/symfony/property-access/tree/v5.4.8" }, "funding": [ { @@ -1977,39 +1986,38 @@ "type": "tidelift" } ], - "time": "2021-08-09T12:23:10+00:00" + "time": "2022-04-12T15:48:08+00:00" }, { "name": "symfony/property-info", - "version": "v5.3.7", + "version": "v6.0.7", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "7202b6c93a07df5df83eb58e3757dffb77fc5d90" + "reference": "0f26f0870f05d65d5c06681ecbf36e546204f4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/7202b6c93a07df5df83eb58e3757dffb77fc5d90", - "reference": "7202b6c93a07df5df83eb58e3757dffb77fc5d90", + "url": "https://api.github.com/repos/symfony/property-info/zipball/0f26f0870f05d65d5c06681ecbf36e546204f4b5", + "reference": "0f26f0870f05d65d5c06681ecbf36e546204f4b5", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php80": "^1.16", - "symfony/string": "^5.1" + "php": ">=8.0.2", + "symfony/string": "^5.4|^6.0" }, "conflict": { - "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/reflection-docblock": "<5.2", "phpdocumentor/type-resolver": "<1.4.0", - "symfony/dependency-injection": "<4.4" + "symfony/dependency-injection": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.10.4", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/cache": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/serializer": "^4.4|^5.0" + "phpdocumentor/reflection-docblock": "^5.2", + "phpstan/phpdoc-parser": "^1.0", + "symfony/cache": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/serializer": "^5.4|^6.0" }, "suggest": { "phpdocumentor/reflection-docblock": "To use the PHPDoc", @@ -2051,7 +2059,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v5.3.7" + "source": "https://github.com/symfony/property-info/tree/v6.0.7" }, "funding": [ { @@ -2067,25 +2075,28 @@ "type": "tidelift" } ], - "time": "2021-08-23T12:57:24+00:00" + "time": "2022-03-31T17:18:25+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.4.0", + "version": "v3.0.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e517458f278c2131ca9f262f8fbaf01410f2c65c", + "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1" + "php": ">=8.0.2", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -2093,7 +2104,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -2130,7 +2141,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.1" }, "funding": [ { @@ -2146,44 +2157,46 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2022-03-13T20:10:05+00:00" }, { "name": "symfony/string", - "version": "v5.3.7", + "version": "v6.0.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" + "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", + "url": "https://api.github.com/repos/symfony/string/zipball/ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", + "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -2213,7 +2226,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.7" + "source": "https://github.com/symfony/string/tree/v6.0.8" }, "funding": [ { @@ -2229,28 +2242,27 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:00:08+00:00" + "time": "2022-04-22T08:18:02+00:00" }, { "name": "symfony/var-exporter", - "version": "v5.3.7", + "version": "v6.0.8", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "2ded877ab0574d8b646f4eb3f716f8ed7ee7f392" + "reference": "74b272979a490747c6775b0228d06cf246306a99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/2ded877ab0574d8b646f4eb3f716f8ed7ee7f392", - "reference": "2ded877ab0574d8b646f4eb3f716f8ed7ee7f392", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/74b272979a490747c6775b0228d06cf246306a99", + "reference": "74b272979a490747c6775b0228d06cf246306a99", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2" }, "require-dev": { - "symfony/var-dumper": "^4.4.9|^5.0.9" + "symfony/var-dumper": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -2286,7 +2298,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v5.3.7" + "source": "https://github.com/symfony/var-exporter/tree/v6.0.8" }, "funding": [ { @@ -2302,7 +2314,7 @@ "type": "tidelift" } ], - "time": "2021-08-04T22:42:42+00:00" + "time": "2022-04-26T13:22:23+00:00" } ], "packages-dev": [ @@ -2368,34 +2380,35 @@ }, { "name": "akeneo/api-php-client", - "version": "v4.0.2", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/akeneo/api-php-client.git", - "reference": "b8121b4d78392a35a48aa2aef5752aa65c07c259" + "reference": "4d676bb1372243dc943a335f5df381665bdc0a4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/akeneo/api-php-client/zipball/b8121b4d78392a35a48aa2aef5752aa65c07c259", - "reference": "b8121b4d78392a35a48aa2aef5752aa65c07c259", + "url": "https://api.github.com/repos/akeneo/api-php-client/zipball/4d676bb1372243dc943a335f5df381665bdc0a4a", + "reference": "4d676bb1372243dc943a335f5df381665bdc0a4a", "shasum": "" }, "require": { "php": ">=7.1", - "php-http/client-implementation": "^1.0", "php-http/discovery": "^1.6", "php-http/httplug": "^2.0", - "php-http/message": "^1.7", - "php-http/message-factory": "^v1.0", "php-http/multipart-stream-builder": "^1.0", - "psr/http-message": "^1.0" + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "psr/http-message-implementation": "^1.0" }, "require-dev": { "donatj/mock-webserver": "^2.0", "friendsofphp/php-cs-fixer": "^2.14", + "http-interop/http-factory-guzzle": "^1.0", "php-http/guzzle6-adapter": "^2.0", "phpspec/phpspec": "^5.0", - "phpunit/phpunit": "^5.7", + "phpunit/phpunit": "^7.0", "symfony/yaml": "^4.2" }, "suggest": { @@ -2420,33 +2433,34 @@ "description": "Akeneo PIM client for the API", "support": { "issues": "https://github.com/akeneo/api-php-client/issues", - "source": "https://github.com/akeneo/api-php-client/tree/4.0" + "source": "https://github.com/akeneo/api-php-client/tree/master" }, - "time": "2019-06-13T15:31:24+00:00" + "time": "2019-09-09T15:46:29+00:00" }, { "name": "akeneo/api-php-client-ee", - "version": "v4.0.2", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/akeneo/api-php-client-ee.git", - "reference": "df3946f27ff0080e7339fd8bc268b0932cbfbd99" + "reference": "39bc35795fde4ee492f3b10c926e83244d97fbb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/akeneo/api-php-client-ee/zipball/df3946f27ff0080e7339fd8bc268b0932cbfbd99", - "reference": "df3946f27ff0080e7339fd8bc268b0932cbfbd99", + "url": "https://api.github.com/repos/akeneo/api-php-client-ee/zipball/39bc35795fde4ee492f3b10c926e83244d97fbb7", + "reference": "39bc35795fde4ee492f3b10c926e83244d97fbb7", "shasum": "" }, "require": { - "akeneo/api-php-client": "^4.0" + "akeneo/api-php-client": "^5.0" }, "require-dev": { "donatj/mock-webserver": "^2.0", "friendsofphp/php-cs-fixer": "^2.14", + "http-interop/http-factory-guzzle": "^1.0", "php-http/guzzle6-adapter": "^2.0", "phpspec/phpspec": "^5.0", - "phpunit/phpunit": "^5.7", + "phpunit/phpunit": "^7.0", "symfony/yaml": "^4.2" }, "type": "library", @@ -2468,22 +2482,23 @@ "description": "Akeneo PIM ENTERPRISE client for the API", "support": { "issues": "https://github.com/akeneo/api-php-client-ee/issues", - "source": "https://github.com/akeneo/api-php-client-ee/tree/4.0" + "source": "https://github.com/akeneo/api-php-client-ee/tree/master" }, - "time": "2019-06-13T15:35:14+00:00" + "abandoned": "akeneo/api-php-client", + "time": "2019-10-11T15:06:55+00:00" }, { "name": "clue/stream-filter", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/clue/stream-filter.git", - "reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320" + "reference": "d6169430c7731d8509da7aecd0af756a5747b78e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/clue/stream-filter/zipball/aeb7d8ea49c7963d3b581378955dbf5bc49aa320", - "reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320", + "url": "https://api.github.com/repos/clue/stream-filter/zipball/d6169430c7731d8509da7aecd0af756a5747b78e", + "reference": "d6169430c7731d8509da7aecd0af756a5747b78e", "shasum": "" }, "require": { @@ -2494,12 +2509,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "Clue\\StreamFilter\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "Clue\\StreamFilter\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2524,7 +2539,7 @@ ], "support": { "issues": "https://github.com/clue/stream-filter/issues", - "source": "https://github.com/clue/stream-filter/tree/v1.5.0" + "source": "https://github.com/clue/stream-filter/tree/v1.6.0" }, "funding": [ { @@ -2536,7 +2551,7 @@ "type": "github" } ], - "time": "2020-10-02T12:38:20+00:00" + "time": "2022-02-21T13:15:14+00:00" }, { "name": "composer/pcre", @@ -2677,29 +2692,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -2726,7 +2742,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -2742,7 +2758,7 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "fakerphp/faker", @@ -2813,16 +2829,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.0.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "1dc8d9cba3897165e16d12bb13d813afb1eb3fe7" + "reference": "c94a94f120803a18554c1805ef2e539f8285f9a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/1dc8d9cba3897165e16d12bb13d813afb1eb3fe7", - "reference": "1dc8d9cba3897165e16d12bb13d813afb1eb3fe7", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c94a94f120803a18554c1805ef2e539f8285f9a2", + "reference": "c94a94f120803a18554c1805ef2e539f8285f9a2", "shasum": "" }, "require": { @@ -2846,7 +2862,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.2-dev" } }, "autoload": { @@ -2859,13 +2875,34 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, { "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" }, { @@ -2887,9 +2924,23 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.0.0" + "source": "https://github.com/guzzle/psr7/tree/2.2.1" }, - "time": "2021-06-30T20:03:07+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2022-03-20T21:55:58+00:00" }, { "name": "infection/abstract-testframework-adapter", @@ -3318,16 +3369,16 @@ }, { "name": "laminas/laminas-diactoros", - "version": "2.8.0", + "version": "2.11.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-diactoros.git", - "reference": "0c26ef1d95b6d7e6e3943a243ba3dc0797227199" + "reference": "d1bc565b23c2040fafde398a8a5db083c47928c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/0c26ef1d95b6d7e6e3943a243ba3dc0797227199", - "reference": "0c26ef1d95b6d7e6e3943a243ba3dc0797227199", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/d1bc565b23c2040fafde398a8a5db083c47928c0", + "reference": "d1bc565b23c2040fafde398a8a5db083c47928c0", "shasum": "" }, "require": { @@ -3413,7 +3464,7 @@ "type": "community_bridge" } ], - "time": "2021-09-22T03:54:36+00:00" + "time": "2022-05-17T10:57:52+00:00" }, { "name": "mikey179/vfsstream", @@ -3517,37 +3568,38 @@ }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3563,7 +3615,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -3571,7 +3623,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "ondram/ci-detector", @@ -3713,16 +3765,16 @@ }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -3758,33 +3810,36 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "php-etl/bucket", - "version": "dev-master", + "version": "v0.2.0", "source": { "type": "git", "url": "https://github.com/php-etl/bucket.git", - "reference": "457df5ed4ad034e56adf29e4bb225f4fb5cb79c3" + "reference": "a5a20ac8a33d9460f30b57ff92761031bc66a062" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/bucket/zipball/457df5ed4ad034e56adf29e4bb225f4fb5cb79c3", - "reference": "457df5ed4ad034e56adf29e4bb225f4fb5cb79c3", + "url": "https://api.github.com/repos/php-etl/bucket/zipball/a5a20ac8a33d9460f30b57ff92761031bc66a062", + "reference": "a5a20ac8a33d9460f30b57ff92761031bc66a062", "shasum": "" }, "require": { "php": "^8.0", - "php-etl/bucket-contracts": "^0.1.0@dev" + "php-etl/bucket-contracts": "^0.1.0" }, "require-dev": { "friends-of-phpspec/phpspec-code-coverage": "6.x-dev", - "phpspec/phpspec": "^7.0" + "johnkary/phpunit-speedtrap": "*", + "mybuilder/phpunit-accelerator": "*", + "phpspec/phpspec": "^7.0", + "phpunit/php-invoker": "*", + "phpunit/phpunit": "^9.0" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -3813,22 +3868,22 @@ "description": "This library implements the Extract-Transform-Load pattern asynchronously in PHP with the help of iterators and generators", "support": { "issues": "https://github.com/php-etl/bucket/issues", - "source": "https://github.com/php-etl/bucket/tree/master" + "source": "https://github.com/php-etl/bucket/tree/v0.2.0" }, - "time": "2021-06-28T22:06:57+00:00" + "time": "2021-09-29T07:03:50+00:00" }, { "name": "php-etl/bucket-contracts", - "version": "dev-master", + "version": "v0.1.0", "source": { "type": "git", "url": "https://github.com/php-etl/bucket-contracts.git", - "reference": "e538bcba3db35c2d0adb85ad8449444e0481f02e" + "reference": "b5d682329b7f8ff66e0987f75fad190607c10ddf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/bucket-contracts/zipball/e538bcba3db35c2d0adb85ad8449444e0481f02e", - "reference": "e538bcba3db35c2d0adb85ad8449444e0481f02e", + "url": "https://api.github.com/repos/php-etl/bucket-contracts/zipball/b5d682329b7f8ff66e0987f75fad190607c10ddf", + "reference": "b5d682329b7f8ff66e0987f75fad190607c10ddf", "shasum": "" }, "require": { @@ -3837,7 +3892,6 @@ "require-dev": { "phpstan/phpstan": "0.12.x-dev" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -3866,9 +3920,9 @@ "description": "This library describes contracts for the data-interchange buckets.", "support": { "issues": "https://github.com/php-etl/bucket-contracts/issues", - "source": "https://github.com/php-etl/bucket-contracts/tree/master" + "source": "https://github.com/php-etl/bucket-contracts/tree/v0.1.0" }, - "time": "2021-06-28T21:40:35+00:00" + "time": "2021-09-25T16:53:47+00:00" }, { "name": "php-etl/phpunit-extension", @@ -3972,16 +4026,16 @@ }, { "name": "php-http/client-common", - "version": "2.4.0", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/php-http/client-common.git", - "reference": "29e0c60d982f04017069483e832b92074d0a90b2" + "reference": "d135751167d57e27c74de674d6a30cef2dc8e054" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/29e0c60d982f04017069483e832b92074d0a90b2", - "reference": "29e0c60d982f04017069483e832b92074d0a90b2", + "url": "https://api.github.com/repos/php-http/client-common/zipball/d135751167d57e27c74de674d6a30cef2dc8e054", + "reference": "d135751167d57e27c74de674d6a30cef2dc8e054", "shasum": "" }, "require": { @@ -3992,14 +4046,14 @@ "psr/http-client": "^1.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0", - "symfony/options-resolver": "^2.6 || ^3.4.20 || ~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0", + "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0", "symfony/polyfill-php80": "^1.17" }, "require-dev": { "doctrine/instantiator": "^1.1", "guzzlehttp/psr7": "^1.4", "nyholm/psr7": "^1.2", - "phpspec/phpspec": "^5.1 || ^6.0", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", "phpspec/prophecy": "^1.10.2", "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3" }, @@ -4041,22 +4095,22 @@ ], "support": { "issues": "https://github.com/php-http/client-common/issues", - "source": "https://github.com/php-http/client-common/tree/2.4.0" + "source": "https://github.com/php-http/client-common/tree/2.5.0" }, - "time": "2021-07-05T08:19:25+00:00" + "time": "2021-11-26T15:01:24+00:00" }, { "name": "php-http/curl-client", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/php-http/curl-client.git", - "reference": "15b11b7c2f39fe61ef6a70e0c247b4a84e845cdb" + "reference": "2ed4245a817d859dd0c1d51c7078cdb343cf5233" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/curl-client/zipball/15b11b7c2f39fe61ef6a70e0c247b4a84e845cdb", - "reference": "15b11b7c2f39fe61ef6a70e0c247b4a84e845cdb", + "url": "https://api.github.com/repos/php-http/curl-client/zipball/2ed4245a817d859dd0c1d51c7078cdb343cf5233", + "reference": "2ed4245a817d859dd0c1d51c7078cdb343cf5233", "shasum": "" }, "require": { @@ -4067,7 +4121,7 @@ "php-http/message": "^1.2", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "symfony/options-resolver": "^3.4 || ^4.0 || ^5.0" + "symfony/options-resolver": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, "provide": { "php-http/async-client-implementation": "1.0", @@ -4110,9 +4164,9 @@ ], "support": { "issues": "https://github.com/php-http/curl-client/issues", - "source": "https://github.com/php-http/curl-client/tree/2.2.0" + "source": "https://github.com/php-http/curl-client/tree/2.2.1" }, - "time": "2020-12-14T08:36:51+00:00" + "time": "2021-12-10T18:02:07+00:00" }, { "name": "php-http/discovery", @@ -4184,16 +4238,16 @@ }, { "name": "php-http/httplug", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/php-http/httplug.git", - "reference": "191a0a1b41ed026b717421931f8d3bd2514ffbf9" + "reference": "f640739f80dfa1152533976e3c112477f69274eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/191a0a1b41ed026b717421931f8d3bd2514ffbf9", - "reference": "191a0a1b41ed026b717421931f8d3bd2514ffbf9", + "url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb", + "reference": "f640739f80dfa1152533976e3c112477f69274eb", "shasum": "" }, "require": { @@ -4240,22 +4294,22 @@ ], "support": { "issues": "https://github.com/php-http/httplug/issues", - "source": "https://github.com/php-http/httplug/tree/master" + "source": "https://github.com/php-http/httplug/tree/2.3.0" }, - "time": "2020-07-13T15:43:23+00:00" + "time": "2022-02-21T09:52:22+00:00" }, { "name": "php-http/message", - "version": "1.12.0", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/php-http/message.git", - "reference": "39eb7548be982a81085fe5a6e2a44268cd586291" + "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/39eb7548be982a81085fe5a6e2a44268cd586291", - "reference": "39eb7548be982a81085fe5a6e2a44268cd586291", + "url": "https://api.github.com/repos/php-http/message/zipball/7886e647a30a966a1a8d1dad1845b71ca8678361", + "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361", "shasum": "" }, "require": { @@ -4272,7 +4326,7 @@ "ext-zlib": "*", "guzzlehttp/psr7": "^1.0", "laminas/laminas-diactoros": "^2.0", - "phpspec/phpspec": "^5.1 || ^6.3", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", "slim/slim": "^3.0" }, "suggest": { @@ -4288,12 +4342,12 @@ } }, "autoload": { - "psr-4": { - "Http\\Message\\": "src/" - }, "files": [ "src/filters.php" - ] + ], + "psr-4": { + "Http\\Message\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4314,9 +4368,9 @@ ], "support": { "issues": "https://github.com/php-http/message/issues", - "source": "https://github.com/php-http/message/tree/1.12.0" + "source": "https://github.com/php-http/message/tree/1.13.0" }, - "time": "2021-08-29T09:13:12+00:00" + "time": "2022-02-11T13:41:14+00:00" }, { "name": "php-http/message-factory", @@ -4614,16 +4668,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -4634,7 +4688,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -4664,22 +4719,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f" + "reference": "77a32518733312af16a44300404e945338981de3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f", - "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", "shasum": "" }, "require": { @@ -4714,22 +4769,22 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" }, - "time": "2021-09-17T15:28:14+00:00" + "time": "2022-03-15T21:29:03+00:00" }, { "name": "phpspec/prophecy", - "version": "1.14.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { @@ -4781,29 +4836,29 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.14.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2021-09-10T09:02:12+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.7", + "version": "9.2.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.12.0", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -4852,7 +4907,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" }, "funding": [ { @@ -4860,20 +4915,20 @@ "type": "github" } ], - "time": "2021-09-17T05:39:03+00:00" + "time": "2022-03-07T09:28:20+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -4912,7 +4967,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -4920,7 +4975,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -5105,16 +5160,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.9", + "version": "9.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b" + "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", - "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba", + "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba", "shasum": "" }, "require": { @@ -5130,7 +5185,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -5144,7 +5199,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.0", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -5165,11 +5220,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -5192,11 +5247,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.9" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -5204,7 +5259,7 @@ "type": "github" } ], - "time": "2021-08-31T06:47:40+00:00" + "time": "2022-04-01T12:37:26+00:00" }, { "name": "psr/http-client", @@ -5899,16 +5954,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { @@ -5950,7 +6005,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -5958,20 +6013,20 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -6020,14 +6075,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -6035,20 +6090,20 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -6091,7 +6146,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -6099,7 +6154,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -6390,28 +6445,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -6434,7 +6489,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" }, "funding": [ { @@ -6442,7 +6497,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-03-15T09:54:48+00:00" }, { "name": "sebastian/version", @@ -6563,46 +6618,42 @@ }, { "name": "symfony/console", - "version": "v5.4.8", + "version": "v6.0.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b" + "reference": "0d00aa289215353aa8746a31d101f8e60826285c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b", - "reference": "ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b", + "url": "https://api.github.com/repos/symfony/console/zipball/0d00aa289215353aa8746a31d101f8e60826285c", + "reference": "0d00aa289215353aa8746a31d101f8e60826285c", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.0.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" + "symfony/string": "^5.4|^6.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/lock": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -6642,7 +6693,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.8" + "source": "https://github.com/symfony/console/tree/v6.0.8" }, "funding": [ { @@ -6658,7 +6709,7 @@ "type": "tidelift" } ], - "time": "2022-04-12T16:02:29+00:00" + "time": "2022-04-20T15:01:42+00:00" }, { "name": "symfony/finder", @@ -6723,23 +6774,21 @@ }, { "name": "symfony/options-resolver", - "version": "v5.3.7", + "version": "v6.0.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "4b78e55b179003a42523a362cc0e8327f7a69b5e" + "reference": "51f7006670febe4cbcbae177cbffe93ff833250d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4b78e55b179003a42523a362cc0e8327f7a69b5e", - "reference": "4b78e55b179003a42523a362cc0e8327f7a69b5e", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/51f7006670febe4cbcbae177cbffe93ff833250d", + "reference": "51f7006670febe4cbcbae177cbffe93ff833250d", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2", + "symfony/deprecation-contracts": "^2.1|^3" }, "type": "library", "autoload": { @@ -6772,7 +6821,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.3.7" + "source": "https://github.com/symfony/options-resolver/tree/v6.0.3" }, "funding": [ { @@ -6788,7 +6837,7 @@ "type": "tidelift" } ], - "time": "2021-08-04T21:20:46+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/process", @@ -6853,28 +6902,28 @@ }, { "name": "symfony/yaml", - "version": "v5.3.6", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7" + "reference": "e80f87d2c9495966768310fc531b487ce64237a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7", - "reference": "4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e80f87d2c9495966768310fc531b487ce64237a2", + "reference": "e80f87d2c9495966768310fc531b487ce64237a2", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-ctype": "~1.8" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<4.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "^4.4|^5.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -6908,7 +6957,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.3.6" + "source": "https://github.com/symfony/yaml/tree/v5.4.3" }, "funding": [ { @@ -6924,7 +6973,7 @@ "type": "tidelift" } ], - "time": "2021-07-29T06:20:01+00:00" + "time": "2022-01-26T16:32:32+00:00" }, { "name": "thecodingmachine/safe", @@ -7236,5 +7285,5 @@ "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/tests/functional/Builder/ExtractorTest.php b/tests/functional/Builder/ExtractorTest.php index 9e428ba..0800736 100644 --- a/tests/functional/Builder/ExtractorTest.php +++ b/tests/functional/Builder/ExtractorTest.php @@ -47,8 +47,12 @@ public function testAllProducts(): void $httpClient ->expectResponse( - new Mock\RequestMatcher\RequestMatcherBuilder('/product', methods: ['GET']), - new Mock\ResponseBuilder(status: 200) + new Mock\RequestMatcher\RequestMatcherBuilder('/api/oauth/v1/token', methods: ['POST']), + new Mock\ResponseBuilder(__DIR__ . '/fake-token.php') + ) + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/products', methods: ['GET']), + new Mock\ResponseBuilder(__DIR__ . '/products.all.php') ); $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); @@ -68,9 +72,104 @@ public function testAllProducts(): void $this->assertBuildsExtractorExtractsLike( [ - [], - [], - [], + [ + '_links' => [ + 'self' => [ + 'href' => 'http://test.com/api/rest/v1/products/123qwerty' + ] + ], + 'identifier' => '123qwerty', + 'enabled' => true, + 'family' => 'all_in_the_family', + 'categories' => ['pizza'], + 'groups' => [], + 'parent' => '321azerty', + 'values' => [ + 'color' => [ + [ + "locale" => null, + "scope" => null, + "data" => "#fff" + ] + ], + 'brand' => [ + [ + "locale" => null, + "scope" => null, + "data" => ["8"] + ] + ], + 'weight' => [ + [ + "locale" => null, + "scope" => null, + "data" => "0.5300" + ] + ] + ], + 'created' => '2021-06-18T03:30:11+00:00', + 'updated' => '2022-05-16T08:37:11+00:00', + 'associations' => [ + 'UPSELL' => [ + 'products' => [], + 'product_models' => [], + 'groups' => [] + ] + ], + 'quantified_associations' => [], + 'metadata' => [ + 'workflow_status' => 'working_copy' + ] + ], + [ + '_links' => [ + 'self' => [ + 'href' => 'http://test.com/api/rest/v1/products/0987uiop' + ] + ], + 'identifier' => '0987uiop', + 'enabled' => true, + 'family' => 'family_feud', + 'categories' => ['pizza'], + 'groups' => [], + 'parent' => '0987azerty', + 'values' => [ + 'color' => [ + [ + "locale" => null, + "scope" => null, + "data" => "#f00" + ] + ], + 'brand' => [ + [ + "locale" => null, + "scope" => null, + "data" => ["3"] + ] + ], + 'weight' => [ + [ + "locale" => null, + "scope" => null, + "data" => "0.1000" + ] + ] + ], + 'created' => '2021-06-18T03:30:11+00:00', + 'updated' => '2022-05-16T08:37:11+00:00', + 'associations' => [ + 'UPSELL' => [ + 'products' => [], + 'product_models' => [], + 'groups' => [] + ] + ], + 'quantified_associations' => [], + 'metadata' => [ + 'workflow_status' => 'working_copy' + ] + ] ], $builder, ); diff --git a/tests/functional/Builder/body.json b/tests/functional/Builder/body.json new file mode 100644 index 0000000..eb2793b --- /dev/null +++ b/tests/functional/Builder/body.json @@ -0,0 +1,124 @@ +{ + "_links": { + "self": { + "href": "http://test.com/api/rest/v1/products?page=1&with_count=false&pagination_type=page&limit=10" + }, + "first": { + "href": "http://test.com/api/rest/v1/products?page=1&with_count=false&pagination_type=page&limit=10" + }, + "next": { + "href": "http://test.com/api/rest/v1/products?page=2&with_count=false&pagination_type=page&limit=10" + } + }, + "current_page": 1, + "_embedded": { + "items": [ + { + "_links": { + "self": { + "href": "http://test.com/api/rest/v1/products/123qwerty" + } + }, + "identifier": "123qwerty", + "enabled": true, + "family": "all_in_the_family", + "categories": [ + "pizza" + ], + "groups": [], + "parent": "321azerty", + "values": { + "color": [ + { + "locale": null, + "scope": null, + "data": "#fff" + } + ], + "brand": [ + { + "locale": null, + "scope": null, + "data": [ + "8" + ] + } + ], + "weight": [ + { + "locale": null, + "scope": null, + "data": "0.5300" + } + ] + }, + "created": "2021-06-18T03:30:11+00:00", + "updated": "2022-05-16T08:37:11+00:00", + "associations": { + "UPSELL": { + "products": [], + "product_models": [], + "groups": [] + } + }, + "quantified_associations": {}, + "metadata": { + "workflow_status": "working_copy" + } + }, + { + "_links": { + "self": { + "href": "http://test.com/api/rest/v1/products/0987uiop" + } + }, + "identifier": "0987uiop", + "enabled": true, + "family": "family_feud", + "categories": [ + "pizza" + ], + "groups": [], + "parent": "0987azerty", + "values": { + "color": [ + { + "locale": null, + "scope": null, + "data": "#f00" + } + ], + "brand": [ + { + "locale": null, + "scope": null, + "data": [ + "3" + ] + } + ], + "weight": [ + { + "locale": null, + "scope": null, + "data": "0.1000" + } + ] + }, + "created": "2021-06-18T03:30:11+00:00", + "updated": "2022-05-16T08:37:11+00:00", + "associations": { + "UPSELL": { + "products": [], + "product_models": [], + "groups": [] + } + }, + "quantified_associations": {}, + "metadata": { + "workflow_status": "working_copy" + } + } + ] + } +} diff --git a/tests/functional/Builder/fake-token.php b/tests/functional/Builder/fake-token.php new file mode 100644 index 0000000..5dd8080 --- /dev/null +++ b/tests/functional/Builder/fake-token.php @@ -0,0 +1,3 @@ +node = new Node\Expr\MethodCall( var: $this->node, - name: new Node\Identifier('withRequestFactory'), + name: new Node\Identifier('setRequestFactory'), args: [ new Node\Arg( $requestFactory->getNode(), @@ -64,7 +64,7 @@ public function withStreamFactory(Mock\StreamFactoryBuilder $streamFactory): sel { $this->node = new Node\Expr\MethodCall( var: $this->node, - name: new Node\Identifier('withStreamFactory'), + name: new Node\Identifier('setStreamFactory'), args: [ new Node\Arg( $streamFactory->getNode(), @@ -79,7 +79,7 @@ public function withFileSystem(Mock\FileSystemBuilder $fileSystem): self { $this->node = new Node\Expr\MethodCall( var: $this->node, - name: new Node\Identifier('withFileSystem'), + name: new Node\Identifier('setFileSystem'), args: [ new Node\Arg( $fileSystem->getNode(), diff --git a/tests/functional/Mock/ResponseBuilder.php b/tests/functional/Mock/ResponseBuilder.php index caaec5e..4006e94 100644 --- a/tests/functional/Mock/ResponseBuilder.php +++ b/tests/functional/Mock/ResponseBuilder.php @@ -9,27 +9,12 @@ final class ResponseBuilder implements Builder { public function __construct( - private int $status, + private string $path, ) { } - public static function fromFile(string $path, int $status): self - { - $instance = new self($status); - $instance->a(); - return $instance; - } - public function getNode(): Node { - return new Node\Expr\New_( - class: new Node\Name(Response::class), - args: [ - new Node\Arg( - value: new Node\Scalar\LNumber($this->status), - name: new Node\Identifier('status'), - ), - ] - ); + return new Node\Expr\Include_(new Node\Scalar\String_($this->path), Node\Expr\Include_::TYPE_INCLUDE); } } From 29a62266bcee27af94252a4812f41eef17e0e564 Mon Sep 17 00:00:00 2001 From: clemzarch Date: Tue, 24 May 2022 17:22:12 +0200 Subject: [PATCH 03/19] raise the minimum MSI to 30%, add tests for the Lookup, ConditionalLookup and Loader Builders --- infection.json.dist | 2 +- src/Factory/Loader.php | 4 +- tests/functional/Builder/BuilderTestCase.php | 12 + .../ConditionalLookupTest.php | 63 +++ .../get-product.php} | 2 +- .../Builder/ConditionalLookup/product.json | 48 +++ .../Builder/Extractor/ExtractorTest.php | 367 ++++++++++++++++++ .../Builder/Extractor/get-all-products.php | 3 + .../get-product.php} | 2 +- .../functional/Builder/Extractor/product.json | 48 +++ .../products.all.json} | 6 +- tests/functional/Builder/ExtractorTest.php | 177 --------- .../functional/Builder/Loader/LoaderTest.php | 118 ++++++ .../Builder/Loader/post-product.php | 3 + tests/functional/Builder/Loader/product.php | 50 +++ tests/functional/Builder/Loader/products.php | 52 +++ .../functional/Builder/Lookup/LookupTest.php | 113 ++++++ .../functional/Builder/Lookup/get-product.php | 3 + tests/functional/Builder/Lookup/product.json | 48 +++ .../Builder/{token.json => token-body.json} | 0 tests/functional/Builder/token.php | 3 + 21 files changed, 938 insertions(+), 186 deletions(-) create mode 100644 tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php rename tests/functional/Builder/{fake-token.php => ConditionalLookup/get-product.php} (65%) create mode 100644 tests/functional/Builder/ConditionalLookup/product.json create mode 100644 tests/functional/Builder/Extractor/ExtractorTest.php create mode 100644 tests/functional/Builder/Extractor/get-all-products.php rename tests/functional/Builder/{products.all.php => Extractor/get-product.php} (65%) create mode 100644 tests/functional/Builder/Extractor/product.json rename tests/functional/Builder/{body.json => Extractor/products.all.json} (97%) delete mode 100644 tests/functional/Builder/ExtractorTest.php create mode 100644 tests/functional/Builder/Loader/LoaderTest.php create mode 100644 tests/functional/Builder/Loader/post-product.php create mode 100644 tests/functional/Builder/Loader/product.php create mode 100644 tests/functional/Builder/Loader/products.php create mode 100644 tests/functional/Builder/Lookup/LookupTest.php create mode 100644 tests/functional/Builder/Lookup/get-product.php create mode 100644 tests/functional/Builder/Lookup/product.json rename tests/functional/Builder/{token.json => token-body.json} (100%) create mode 100644 tests/functional/Builder/token.php diff --git a/infection.json.dist b/infection.json.dist index 519cb02..9e6f4e2 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -20,6 +20,6 @@ }, "testFramework":"phpunit", "initialTestsPhpOptions": "-d zend_extension=xdebug -d xdebug.mode=coverage", - "minMsi": 20, + "minMsi": 30, "minCoveredMsi": 70 } diff --git a/src/Factory/Loader.php b/src/Factory/Loader.php index f435880..24dad2e 100644 --- a/src/Factory/Loader.php +++ b/src/Factory/Loader.php @@ -74,10 +74,8 @@ private function findCapacity(array $config): Akeneo\Capacity\CapacityInterface public function compile(array $config): Repository\Loader { - $builder = new Akeneo\Builder\Loader(); - try { - $builder->withCapacity( + $builder = new Akeneo\Builder\Loader( $this->findCapacity($config)->getBuilder($config) ); } catch (NoApplicableCapacityException $exception) { diff --git a/tests/functional/Builder/BuilderTestCase.php b/tests/functional/Builder/BuilderTestCase.php index d5e736d..e8ef9b6 100644 --- a/tests/functional/Builder/BuilderTestCase.php +++ b/tests/functional/Builder/BuilderTestCase.php @@ -2,6 +2,8 @@ namespace functional\Kiboko\Plugin\Akeneo\Builder; +use functional\Kiboko\Plugin\Akeneo\PipelineRunner; +use Kiboko\Contract\Pipeline\PipelineRunnerInterface; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; use org\bovigo\vfs\vfsStreamWrapper; @@ -25,6 +27,16 @@ protected function tearDown(): void vfsStreamWrapper::unregister(); } + protected function getBuilderCompilePath(): string + { + return $this->fs->url(); + } + + public function pipelineRunner(): PipelineRunnerInterface + { + return new PipelineRunner(); + } + protected function assertNodeIsInstanceOf(string $expected, DefaultBuilder $builder, string $message = '') { $printer = new PrettyPrinter\Standard(); diff --git a/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php b/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php new file mode 100644 index 0000000..2bcc7ef --- /dev/null +++ b/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php @@ -0,0 +1,63 @@ +markTestSkipped(); + $httpClient = new Mock\HttpClientBuilder(new Mock\ResponseFactoryBuilder()); + + $httpClient + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/oauth/v1/token', methods: ['POST']), + new Mock\ResponseBuilder(__DIR__ . '/../token.php') + ) + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/rest/v1/products/0987uiop', methods: ['GET']), + new Mock\ResponseBuilder(__DIR__ . '/get-product.php') + ) + ; + + $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client + ->withHttpClient($httpClient) + ->withRequestFactory(new Mock\RequestFactoryBuilder()) + ->withStreamFactory(new Mock\StreamFactoryBuilder()) + ->withFileSystem(new Mock\FileSystemBuilder()) + ->withAuthenticatedByPassword(); + + $capacity = new Capacity\Lookup\Get(); + $capacity + ->withEndpoint(new Node\Identifier('getProductApi')) + ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); + + $builder = new ConditionalLookup(new AlternativeLookup($capacity)); + $builder->withClient($client->getNode()); + + $this->assertBuildsTransformerTransformsLike( + [ + [ + "code" => "0987uiop" + ] + ], + [ + [ + "code" => "0987uiop" + ] + ], + $builder, + ); + } +} diff --git a/tests/functional/Builder/fake-token.php b/tests/functional/Builder/ConditionalLookup/get-product.php similarity index 65% rename from tests/functional/Builder/fake-token.php rename to tests/functional/Builder/ConditionalLookup/get-product.php index 5dd8080..1fdb0ae 100644 --- a/tests/functional/Builder/fake-token.php +++ b/tests/functional/Builder/ConditionalLookup/get-product.php @@ -1,3 +1,3 @@ expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/oauth/v1/token', methods: ['POST']), + new Mock\ResponseBuilder(__DIR__ . '/../token.php') + ) + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/products', methods: ['GET']), + new Mock\ResponseBuilder(__DIR__ . '/get-all-products.php') + ) + ; + + $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client + ->withHttpClient($httpClient) + ->withRequestFactory(new Mock\RequestFactoryBuilder()) + ->withStreamFactory(new Mock\StreamFactoryBuilder()) + ->withFileSystem(new Mock\FileSystemBuilder()) + ->withAuthenticatedByPassword() + ; + + $capacity = new Capacity\Extractor\All(); + $capacity->withEndpoint(new Node\Identifier('getProductApi')); + $capacity->withType('product'); + + $builder = new Extractor($capacity); + $builder->withClient($client->getNode()); + + $this->assertBuildsExtractorExtractsExactly( + [ + [ + '_links' => [ + 'self' => [ + 'href' => 'http://test.com/api/rest/v1/products/123qwerty' + ] + ], + 'identifier' => '123qwerty', + 'enabled' => true, + 'family' => 'all_in_the_family', + 'categories' => ['pizza'], + 'groups' => [], + 'parent' => '987qwerty', + 'values' => [ + 'color' => [ + [ + "locale" => null, + "scope" => null, + "data" => "#fff" + ] + ], + 'brand' => [ + [ + "locale" => null, + "scope" => null, + "data" => ["8"] + ] + ], + 'weight' => [ + [ + "locale" => null, + "scope" => null, + "data" => "0.5300" + ] + ] + ], + 'created' => '2021-06-18T03:30:11+00:00', + 'updated' => '2022-05-16T08:37:11+00:00', + 'associations' => [ + 'UPSELL' => [ + 'products' => [], + 'product_models' => [], + 'groups' => [] + ] + ], + 'quantified_associations' => [], + 'metadata' => [ + 'workflow_status' => 'working_copy' + ] + ], + [ + '_links' => [ + 'self' => [ + 'href' => 'http://test.com/api/rest/v1/products/123uiop' + ] + ], + 'identifier' => '123uiop', + 'enabled' => true, + 'family' => 'family_feud', + 'categories' => ['pizza'], + 'groups' => [], + 'parent' => '0987azerty', + 'values' => [ + 'color' => [ + [ + "locale" => null, + "scope" => null, + "data" => "#f00" + ] + ], + 'brand' => [ + [ + "locale" => null, + "scope" => null, + "data" => ["3"] + ] + ], + 'weight' => [ + [ + "locale" => null, + "scope" => null, + "data" => "0.1000" + ] + ] + ], + 'created' => '2021-06-18T03:30:11+00:00', + 'updated' => '2022-05-16T08:37:11+00:00', + 'associations' => [ + 'UPSELL' => [ + 'products' => [], + 'product_models' => [], + 'groups' => [] + ] + ], + 'quantified_associations' => [], + 'metadata' => [ + 'workflow_status' => 'working_copy' + ] + ] + ], + $builder, + ); + } + + public function testGetProduct(): void + { + $httpClient = new Mock\HttpClientBuilder(new Mock\ResponseFactoryBuilder()); + + $httpClient + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/oauth/v1/token', methods: ['POST']), + new Mock\ResponseBuilder(__DIR__ . '/../token.php') + ) + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/rest/v1/products/123qwerty', methods: ['GET']), + new Mock\ResponseBuilder(__DIR__ . '/get-product.php') + ) + ; + + $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client + ->withHttpClient($httpClient) + ->withRequestFactory(new Mock\RequestFactoryBuilder()) + ->withStreamFactory(new Mock\StreamFactoryBuilder()) + ->withFileSystem(new Mock\FileSystemBuilder()) + ->withAuthenticatedByPassword() + ; + + $capacity = new Capacity\Extractor\Get(); + $capacity->withEndpoint(new Node\Identifier('getProductApi')); + $capacity->withIdentifier(new Node\Scalar\String_('123qwerty')); + + $builder = new Extractor($capacity); + $builder->withClient($client->getNode()); + + $this->assertBuildsExtractorExtractsExactly( + [ + 'identifier' => '123qwerty', + 'enabled' => true, + 'family' => 'all_in_the_family', + 'categories' => ['pizza'], + 'groups' => [], + 'parent' => '987qwerty', + 'values' => [ + 'color' => [ + [ + "locale" => null, + "scope" => null, + "data" => "#fff" + ] + ], + 'brand' => [ + [ + "locale" => null, + "scope" => null, + "data" => ["8"] + ] + ], + 'weight' => [ + [ + "locale" => null, + "scope" => null, + "data" => "0.5300" + ] + ] + ], + 'created' => '2021-06-18T03:30:11+00:00', + 'updated' => '2022-05-16T08:37:11+00:00', + 'associations' => [ + 'UPSELL' => [ + 'products' => [], + 'product_models' => [], + 'groups' => [] + ] + ], + 'quantified_associations' => [], + 'metadata' => [ + 'workflow_status' => 'working_copy' + ] + ], + $builder, + ); + } + + public function testSearchProduct(): void + { + $httpClient = new Mock\HttpClientBuilder(new Mock\ResponseFactoryBuilder()); + + $httpClient + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/oauth/v1/token', methods: ['POST']), + new Mock\ResponseBuilder(__DIR__ . '/../token.php') + ) + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/rest/v1/products', methods: ['GET']), + new Mock\ResponseBuilder(__DIR__ . '/get-all-products.php') + ) + ; + + $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client + ->withHttpClient($httpClient) + ->withRequestFactory(new Mock\RequestFactoryBuilder()) + ->withStreamFactory(new Mock\StreamFactoryBuilder()) + ->withFileSystem(new Mock\FileSystemBuilder()) + ->withAuthenticatedByPassword() + ; + + $capacity = new Capacity\Extractor\All(); + $capacity->withEndpoint(new Node\Identifier('getProductApi')); + $capacity->withSearch(new Node\Scalar\String_('123')); + + $builder = new Extractor($capacity); + $builder->withClient($client->getNode()); + + $this->assertBuildsExtractorExtractsExactly( + [ + [ + '_links' => [ + 'self' => [ + 'href' => 'http://test.com/api/rest/v1/products/123qwerty' + ] + ], + 'identifier' => '123qwerty', + 'enabled' => true, + 'family' => 'all_in_the_family', + 'categories' => ['pizza'], + 'groups' => [], + 'parent' => '987qwerty', + 'values' => [ + 'color' => [ + [ + "locale" => null, + "scope" => null, + "data" => "#fff" + ] + ], + 'brand' => [ + [ + "locale" => null, + "scope" => null, + "data" => ["8"] + ] + ], + 'weight' => [ + [ + "locale" => null, + "scope" => null, + "data" => "0.5300" + ] + ] + ], + 'created' => '2021-06-18T03:30:11+00:00', + 'updated' => '2022-05-16T08:37:11+00:00', + 'associations' => [ + 'UPSELL' => [ + 'products' => [], + 'product_models' => [], + 'groups' => [] + ] + ], + 'quantified_associations' => [], + 'metadata' => [ + 'workflow_status' => 'working_copy' + ] + ], + [ + '_links' => [ + 'self' => [ + 'href' => 'http://test.com/api/rest/v1/products/123uiop' + ] + ], + 'identifier' => '123uiop', + 'enabled' => true, + 'family' => 'family_feud', + 'categories' => ['pizza'], + 'groups' => [], + 'parent' => '0987azerty', + 'values' => [ + 'color' => [ + [ + "locale" => null, + "scope" => null, + "data" => "#f00" + ] + ], + 'brand' => [ + [ + "locale" => null, + "scope" => null, + "data" => ["3"] + ] + ], + 'weight' => [ + [ + "locale" => null, + "scope" => null, + "data" => "0.1000" + ] + ] + ], + 'created' => '2021-06-18T03:30:11+00:00', + 'updated' => '2022-05-16T08:37:11+00:00', + 'associations' => [ + 'UPSELL' => [ + 'products' => [], + 'product_models' => [], + 'groups' => [] + ] + ], + 'quantified_associations' => [], + 'metadata' => [ + 'workflow_status' => 'working_copy' + ] + ] + ], + $builder, + ); + } +} diff --git a/tests/functional/Builder/Extractor/get-all-products.php b/tests/functional/Builder/Extractor/get-all-products.php new file mode 100644 index 0000000..e4816cf --- /dev/null +++ b/tests/functional/Builder/Extractor/get-all-products.php @@ -0,0 +1,3 @@ +fs = vfsStream::setup(); - } - - protected function tearDown(): void - { - $this->fs = null; - vfsStreamWrapper::unregister(); - } - - protected function getBuilderCompilePath(): string - { - return $this->fs->url(); - } - - public function pipelineRunner(): PipelineRunnerInterface - { - return new PipelineRunner(); - } - - public function testAllProducts(): void - { - $httpClient = new Mock\HttpClientBuilder(new Mock\ResponseFactoryBuilder()); - - $httpClient - ->expectResponse( - new Mock\RequestMatcher\RequestMatcherBuilder('/api/oauth/v1/token', methods: ['POST']), - new Mock\ResponseBuilder(__DIR__ . '/fake-token.php') - ) - ->expectResponse( - new Mock\RequestMatcher\RequestMatcherBuilder('/products', methods: ['GET']), - new Mock\ResponseBuilder(__DIR__ . '/products.all.php') - ); - - $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); - $client - ->withHttpClient($httpClient) - ->withRequestFactory(new Mock\RequestFactoryBuilder()) - ->withStreamFactory(new Mock\StreamFactoryBuilder()) - ->withFileSystem(new Mock\FileSystemBuilder()) - ->withAuthenticatedByPassword(); - - $capacity = new Capacity\Extractor\All(); - $capacity->withEndpoint(new Node\Identifier('getProductApi')); - $capacity->withType('product'); - - $builder = new Extractor($capacity); - $builder->withClient($client->getNode()); - - $this->assertBuildsExtractorExtractsLike( - [ - [ - '_links' => [ - 'self' => [ - 'href' => 'http://test.com/api/rest/v1/products/123qwerty' - ] - ], - 'identifier' => '123qwerty', - 'enabled' => true, - 'family' => 'all_in_the_family', - 'categories' => ['pizza'], - 'groups' => [], - 'parent' => '321azerty', - 'values' => [ - 'color' => [ - [ - "locale" => null, - "scope" => null, - "data" => "#fff" - ] - ], - 'brand' => [ - [ - "locale" => null, - "scope" => null, - "data" => ["8"] - ] - ], - 'weight' => [ - [ - "locale" => null, - "scope" => null, - "data" => "0.5300" - ] - ] - ], - 'created' => '2021-06-18T03:30:11+00:00', - 'updated' => '2022-05-16T08:37:11+00:00', - 'associations' => [ - 'UPSELL' => [ - 'products' => [], - 'product_models' => [], - 'groups' => [] - ] - ], - 'quantified_associations' => [], - 'metadata' => [ - 'workflow_status' => 'working_copy' - ] - ], - [ - '_links' => [ - 'self' => [ - 'href' => 'http://test.com/api/rest/v1/products/0987uiop' - ] - ], - 'identifier' => '0987uiop', - 'enabled' => true, - 'family' => 'family_feud', - 'categories' => ['pizza'], - 'groups' => [], - 'parent' => '0987azerty', - 'values' => [ - 'color' => [ - [ - "locale" => null, - "scope" => null, - "data" => "#f00" - ] - ], - 'brand' => [ - [ - "locale" => null, - "scope" => null, - "data" => ["3"] - ] - ], - 'weight' => [ - [ - "locale" => null, - "scope" => null, - "data" => "0.1000" - ] - ] - ], - 'created' => '2021-06-18T03:30:11+00:00', - 'updated' => '2022-05-16T08:37:11+00:00', - 'associations' => [ - 'UPSELL' => [ - 'products' => [], - 'product_models' => [], - 'groups' => [] - ] - ], - 'quantified_associations' => [], - 'metadata' => [ - 'workflow_status' => 'working_copy' - ] - ] - ], - $builder, - ); - } -} diff --git a/tests/functional/Builder/Loader/LoaderTest.php b/tests/functional/Builder/Loader/LoaderTest.php new file mode 100644 index 0000000..8707b62 --- /dev/null +++ b/tests/functional/Builder/Loader/LoaderTest.php @@ -0,0 +1,118 @@ +expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/oauth/v1/token', methods: ['POST']), + new Mock\ResponseBuilder(__DIR__ . '/../token.php') + ) + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('api/rest/v1/products/[^/]+', methods: ['PATCH']), + new Mock\ResponseBuilder(__DIR__ . '/post-product.php') + ) + ; + + $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client + ->withHttpClient($httpClient) + ->withRequestFactory(new Mock\RequestFactoryBuilder()) + ->withStreamFactory(new Mock\StreamFactoryBuilder()) + ->withFileSystem(new Mock\FileSystemBuilder()) + ->withAuthenticatedByPassword(); + + $capacity = new Capacity\Loader\Upsert(); + $capacity + ->withEndpoint(new Node\Identifier('getProductApi')) + ->withCode(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('line'), new Node\Scalar\String_('code'))) + ->withData(new Node\Expr\Variable('line')); + + $builder = new Loader($capacity); + $builder->withClient($client->getNode()); + + $this->assertBuildsLoaderLoadsExactly( + [ + [ + "code" => "0987uiop" + ] + ], + [ + [ + "code" => "0987uiop" + ] + ], + $builder, + ); + } + + public function testUpsertProductsList(): void + { + $httpClient = new Mock\HttpClientBuilder(new Mock\ResponseFactoryBuilder()); + + $httpClient + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/oauth/v1/token', methods: ['POST']), + new Mock\ResponseBuilder(__DIR__ . '/../token.php') + ) + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('api/rest/v1/products', methods: ['PATCH']), + new Mock\ResponseBuilder(__DIR__ . '/post-product.php') + ) + ; + + $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client + ->withHttpClient($httpClient) + ->withRequestFactory(new Mock\RequestFactoryBuilder()) + ->withStreamFactory(new Mock\StreamFactoryBuilder()) + ->withFileSystem(new Mock\FileSystemBuilder()) + ->withAuthenticatedByPassword(); + + $capacity = new Capacity\Loader\UpsertList(); + $capacity + ->withEndpoint(new Node\Identifier('getProductApi')) + ->withData(new Node\Expr\Variable('line')); + + $builder = new Loader($capacity); + $builder->withClient($client->getNode()); + + $this->assertBuildsLoaderLoadsExactly( + expected: [ + [ + [ + "code" => "0987uiop" + ], + [ + "code" => "0987uiop" + ] + ] + ], + input: [ + [ + [ + "code" => "0987uiop" + ], + [ + "code" => "0987uiop" + ] + ] + ], + builder: $builder, + ); + } +} diff --git a/tests/functional/Builder/Loader/post-product.php b/tests/functional/Builder/Loader/post-product.php new file mode 100644 index 0000000..db5b942 --- /dev/null +++ b/tests/functional/Builder/Loader/post-product.php @@ -0,0 +1,3 @@ + 'http://test.com/api/rest/v1/products/0987uiop']); diff --git a/tests/functional/Builder/Loader/product.php b/tests/functional/Builder/Loader/product.php new file mode 100644 index 0000000..56449a0 --- /dev/null +++ b/tests/functional/Builder/Loader/product.php @@ -0,0 +1,50 @@ + "123qwerty", + "enabled" => true, + "family" => "all_in_the_family", + "categories" => [ + "pizza" + ], + "groups" => [], + "parent" => "321azerty", + "values" => [ + "color" => [ + [ + "locale" => null, + "scope" => null, + "data" => "#fff" + ] + ], + "brand" => [ + [ + "locale" => null, + "scope" => null, + "data" => [ + "8" + ] + ] + ], + "weight" => [ + [ + "locale" => null, + "scope" => null, + "data" => "0.5300" + ] + ] + ], + "created" => "2021-06-18T03:30:11+00:00", + "updated" => "2022-05-16T08:37:11+00:00", + "associations" => [ + "UPSELL" => [ + "products" => [], + "product_models" => [], + "groups" => [] + ] + ], + "quantified_associations" => [], + "metadata" => [ + "workflow_status" => "working_copy" + ] +]; diff --git a/tests/functional/Builder/Loader/products.php b/tests/functional/Builder/Loader/products.php new file mode 100644 index 0000000..e2f1e8c --- /dev/null +++ b/tests/functional/Builder/Loader/products.php @@ -0,0 +1,52 @@ + "123qwerty", + "enabled" => true, + "family" => "all_in_the_family", + "categories" => [ + "pizza" + ], + "groups" => [], + "parent" => "321azerty", + "values" => [ + "color" => [ + [ + "locale" => null, + "scope" => null, + "data" => "#fff" + ] + ], + "brand" => [ + [ + "locale" => null, + "scope" => null, + "data" => [ + "8" + ] + ] + ], + "weight" => [ + [ + "locale" => null, + "scope" => null, + "data" => "0.5300" + ] + ] + ], + "created" => "2021-06-18T03:30:11+00:00", + "updated" => "2022-05-16T08:37:11+00:00", + "associations" => [ + "UPSELL" => [ + "products" => [], + "product_models" => [], + "groups" => [] + ] + ], + "quantified_associations" => [], + "metadata" => [ + "workflow_status" => "working_copy" + ] + ] +]; diff --git a/tests/functional/Builder/Lookup/LookupTest.php b/tests/functional/Builder/Lookup/LookupTest.php new file mode 100644 index 0000000..8bc8529 --- /dev/null +++ b/tests/functional/Builder/Lookup/LookupTest.php @@ -0,0 +1,113 @@ +expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/oauth/v1/token', methods: ['POST']), + new Mock\ResponseBuilder(__DIR__ . '/../token.php') + ) + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/rest/v1/products/0987uiop', methods: ['GET']), + new Mock\ResponseBuilder(__DIR__ . '/get-product.php') + ) + ; + + $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client + ->withHttpClient($httpClient) + ->withRequestFactory(new Mock\RequestFactoryBuilder()) + ->withStreamFactory(new Mock\StreamFactoryBuilder()) + ->withFileSystem(new Mock\FileSystemBuilder()) + ->withAuthenticatedByPassword(); + + $capacity = new Capacity\Lookup\Get(); + $capacity + ->withEndpoint(new Node\Identifier('getProductApi')) + ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); + + $builder = new Lookup(new AlternativeLookup($capacity)); + $builder->withClient($client->getNode()); + + $this->assertBuildsTransformerTransformsLike( + [ + [ + "code" => "0987uiop" + ] + ], + [ + [ + "code" => "0987uiop" + ] + ], + $builder, + ); + } + + public function testConditionalLookupProduct() + { + $httpClient = new Mock\HttpClientBuilder(new Mock\ResponseFactoryBuilder()); + + $httpClient + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/oauth/v1/token', methods: ['POST']), + new Mock\ResponseBuilder(__DIR__ . '/../token.php') + ) + ->expectResponse( + new Mock\RequestMatcher\RequestMatcherBuilder('/api/rest/v1/products/0987uiop', methods: ['GET']), + new Mock\ResponseBuilder(__DIR__ . '/get-product.php') + ) + ; + + $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client + ->withHttpClient($httpClient) + ->withRequestFactory(new Mock\RequestFactoryBuilder()) + ->withStreamFactory(new Mock\StreamFactoryBuilder()) + ->withFileSystem(new Mock\FileSystemBuilder()) + ->withAuthenticatedByPassword(); + + $capacity = new Capacity\Lookup\Get(); + $capacity + ->withEndpoint(new Node\Identifier('getProductApi')) + ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); + + $builder = new ConditionalLookup(); + $builder->withClient($client->getNode()); + $builder->addAlternative( + condition: new Node\Expr\Isset_([new Node\Expr\Variable('output')]), + lookup: new AlternativeLookup($capacity) + ); + + $this->assertBuildsTransformerTransformsLike( + [ + [ + "code" => "0987uiop" + ] + ], + [ + [ + "code" => "0987uiop" + ] + ], + $builder, + ); + } +} diff --git a/tests/functional/Builder/Lookup/get-product.php b/tests/functional/Builder/Lookup/get-product.php new file mode 100644 index 0000000..1fdb0ae --- /dev/null +++ b/tests/functional/Builder/Lookup/get-product.php @@ -0,0 +1,3 @@ + Date: Tue, 24 May 2022 17:31:53 +0200 Subject: [PATCH 04/19] check if Akeneo responds with code 201 during an upsert, make "type" nullable (should be "attributeCode" by default), remove function "withCapacity" because the capacity is required when instancing those classes anyway --- src/Builder/AlternativeLookup.php | 7 -- src/Builder/Capacity/Loader/Upsert.php | 88 ++++++++++++++++++++++---- src/Builder/Capacity/Lookup/Get.php | 4 +- src/Builder/Extractor.php | 7 -- src/Builder/Loader.php | 7 -- src/Service.php | 2 +- 6 files changed, 80 insertions(+), 35 deletions(-) diff --git a/src/Builder/AlternativeLookup.php b/src/Builder/AlternativeLookup.php index 1f5d9b4..fa63739 100644 --- a/src/Builder/AlternativeLookup.php +++ b/src/Builder/AlternativeLookup.php @@ -18,13 +18,6 @@ public function __construct( $this->merge = null; } - public function withCapacity(Builder $capacity): self - { - $this->capacity = $capacity; - - return $this; - } - public function withMerge(Builder $merge): self { $this->merge = $merge; diff --git a/src/Builder/Capacity/Loader/Upsert.php b/src/Builder/Capacity/Loader/Upsert.php index 431a072..17dd6cc 100644 --- a/src/Builder/Capacity/Loader/Upsert.php +++ b/src/Builder/Capacity/Loader/Upsert.php @@ -69,21 +69,87 @@ public function getNode(): Node new Node\Stmt\TryCatch( stmts: [ new Node\Stmt\Expression( - expr: new Node\Expr\MethodCall( - new Node\Expr\MethodCall( - var: new Node\Expr\PropertyFetch( - var: new Node\Expr\Variable('this'), - name: new Node\Identifier('client'), + expr: new Node\Expr\Assign( + var: new Node\Expr\Variable('status'), + expr: new Node\Expr\MethodCall( + new Node\Expr\MethodCall( + var: new Node\Expr\PropertyFetch( + var: new Node\Expr\Variable('this'), + name: new Node\Identifier('client'), + ), + name: $this->endpoint, ), - name: $this->endpoint, + new Node\Identifier('upsert'), + [ + new Node\Arg(value: $this->code), + new Node\Arg(value: $this->data), + ], ), - new Node\Identifier('upsert'), - [ - new Node\Arg(value: $this->code), - new Node\Arg(value: $this->data), - ], ), ), + new Node\Stmt\If_( + cond: new Node\Expr\BinaryOp\NotIdentical( + new Node\Expr\Variable('status'), + new Node\Scalar\LNumber(201), + ), + subNodes: [ + 'stmts' => [ + new Node\Stmt\Expression( + expr: new Node\Expr\MethodCall( + var: new Node\Expr\PropertyFetch( + var: new Node\Expr\Variable('this'), + name: 'logger', + ), + name: new Node\Identifier('error'), + args: [ + new Node\Arg( + value: new Node\Expr\FuncCall( + name: new Node\Name\FullyQualified('sprintf'), + args: [ + new Node\Arg( + value: new Node\Scalar\String_('An item was not accepted by the Akeneo API, please check your rejections for product %s.') + ), + new Node\Arg( + value: $this->code + ) + ] + ), + ), + new Node\Arg( + value: new Node\Expr\Array_( + items: [ + new Node\Expr\ArrayItem( + value: new Node\Expr\Variable('line'), + key: new Node\Scalar\String_('item'), + ), + ], + attributes: [ + 'kind' => Node\Expr\Array_::KIND_SHORT, + ], + ), + ), + ], + ), + ), + new Node\Stmt\Expression( + expr: new Node\Expr\Assign( + var: new Node\Expr\Variable('line'), + expr: new Node\Expr\Yield_( + value: new Node\Expr\New_( + class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\RejectionResultBucket'), + args: [ + new Node\Arg( + value: new Node\Expr\Variable('line'), + ), + ], + ), + ), + ) + ), + new Node\Stmt\Continue_(), + ], + ], + ), new Node\Stmt\Expression( expr: new Node\Expr\Assign( var: new Node\Expr\Variable('line'), diff --git a/src/Builder/Capacity/Lookup/Get.php b/src/Builder/Capacity/Lookup/Get.php index e90aa88..f3adaef 100644 --- a/src/Builder/Capacity/Lookup/Get.php +++ b/src/Builder/Capacity/Lookup/Get.php @@ -86,7 +86,7 @@ public function getNode(): Node ); } - private function compileCodeNamedArgument(string $type): Node\Identifier + private function compileCodeNamedArgument(?string $type): Node\Identifier { return match ($type) { 'referenceEntityRecord' => new Node\Identifier('referenceEntityCode'), @@ -95,7 +95,7 @@ private function compileCodeNamedArgument(string $type): Node\Identifier }; } - private function compileIdentifierNamedArgument(string $type): Node\Identifier + private function compileIdentifierNamedArgument(?string $type): Node\Identifier { return match ($type) { 'referenceEntityRecord' => new Node\Identifier('recordCode'), diff --git a/src/Builder/Extractor.php b/src/Builder/Extractor.php index c88daef..49de31d 100644 --- a/src/Builder/Extractor.php +++ b/src/Builder/Extractor.php @@ -51,13 +51,6 @@ public function withState(Node\Expr $state): self return $this; } - public function withCapacity(Builder $capacity): self - { - $this->capacity = $capacity; - - return $this; - } - public function getNode(): Node { return new Node\Expr\New_( diff --git a/src/Builder/Loader.php b/src/Builder/Loader.php index 0faf9a1..37311dc 100644 --- a/src/Builder/Loader.php +++ b/src/Builder/Loader.php @@ -51,13 +51,6 @@ public function withState(Node\Expr $state): self return $this; } - public function withCapacity(Builder $capacity): self - { - $this->capacity = $capacity; - - return $this; - } - public function getNode(): Node { return new Node\Expr\New_( diff --git a/src/Service.php b/src/Service.php index f660d8c..f30a291 100644 --- a/src/Service.php +++ b/src/Service.php @@ -52,7 +52,7 @@ public function normalize(array $config): array try { return $this->processor->processConfiguration($this->configuration, $config); } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { - throw new COnfigurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); + throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } From 60d66dc41a8f3acd52c381348d6263bb4aca90c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Mon, 30 May 2022 12:11:22 +0200 Subject: [PATCH 05/19] Added Infection logging --- infection.json.dist | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/infection.json.dist b/infection.json.dist index 9e6f4e2..b6d1c95 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -10,7 +10,11 @@ "html": "infection/infection.html", "summary": "infection/summary.log", "json": "infection/infection-log.json", - "perMutator": "infection/per-mutator.md" + "perMutator": "infection/per-mutator.md", + "stryker": { + "badge": "/^(main$|feature\/)/", + "report": "/^(main$|feature\/)/" + } }, "phpUnit": { "configDir": "." From 276086926c1b82a90bb8a83b0e6c9043357a2987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Mon, 30 May 2022 12:35:24 +0200 Subject: [PATCH 06/19] Upgraded the Akeneo client and removed the withEnterpriseSupport flag --- composer.json | 4 +- composer.lock | 72 +++---------------- infection.json.dist | 3 +- src/Builder/Client.php | 13 +--- tests/functional/Builder/BuilderTestCase.php | 1 - tests/functional/Builder/ClientTest.php | 4 -- .../ConditionalLookupTest.php | 2 +- .../Builder/Extractor/ExtractorTest.php | 6 +- .../functional/Builder/Loader/LoaderTest.php | 4 +- .../functional/Builder/Lookup/LookupTest.php | 4 +- .../functional/Mock/ApiClientMockBuilder.php | 10 +-- 11 files changed, 26 insertions(+), 97 deletions(-) diff --git a/composer.json b/composer.json index 7642722..b3cd023 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,6 @@ "mybuilder/phpunit-accelerator": "*", "php-etl/pipeline-contracts": "^0.3.0", "php-etl/bucket-contracts": "^0.1.0", - "akeneo/api-php-client-ee": "^5.0", "php-etl/bucket": "^0.2.0", "guzzlehttp/psr7": "^2.0", "php-http/message": "^1.11", @@ -40,7 +39,8 @@ "mikey179/vfsstream": "^1.6", "infection/infection": "^0.26.10", "php-etl/phpunit-extension": "^0.4", - "fakerphp/faker": "^1.19" + "fakerphp/faker": "^1.19", + "akeneo/api-php-client": "^9.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 73bf685..6553660 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "debe00c78e2a208318f098333d7eb705", + "content-hash": "02ddede0105f487d3945eaf2814963a2", "packages": [ { "name": "doctrine/inflector", @@ -2380,20 +2380,20 @@ }, { "name": "akeneo/api-php-client", - "version": "v5.0.0", + "version": "v9.0.1", "source": { "type": "git", "url": "https://github.com/akeneo/api-php-client.git", - "reference": "4d676bb1372243dc943a335f5df381665bdc0a4a" + "reference": "f7e510c69ba0f3e3db2387118e0248b5d800b2c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/akeneo/api-php-client/zipball/4d676bb1372243dc943a335f5df381665bdc0a4a", - "reference": "4d676bb1372243dc943a335f5df381665bdc0a4a", + "url": "https://api.github.com/repos/akeneo/api-php-client/zipball/f7e510c69ba0f3e3db2387118e0248b5d800b2c8", + "reference": "f7e510c69ba0f3e3db2387118e0248b5d800b2c8", "shasum": "" }, "require": { - "php": ">=7.1", + "php": ">=7.4", "php-http/discovery": "^1.6", "php-http/httplug": "^2.0", "php-http/multipart-stream-builder": "^1.0", @@ -2404,10 +2404,10 @@ }, "require-dev": { "donatj/mock-webserver": "^2.0", - "friendsofphp/php-cs-fixer": "^2.14", + "friendsofphp/php-cs-fixer": "^3.5", "http-interop/http-factory-guzzle": "^1.0", "php-http/guzzle6-adapter": "^2.0", - "phpspec/phpspec": "^5.0", + "phpspec/phpspec": "^7.1", "phpunit/phpunit": "^7.0", "symfony/yaml": "^4.2" }, @@ -2433,59 +2433,9 @@ "description": "Akeneo PIM client for the API", "support": { "issues": "https://github.com/akeneo/api-php-client/issues", - "source": "https://github.com/akeneo/api-php-client/tree/master" - }, - "time": "2019-09-09T15:46:29+00:00" - }, - { - "name": "akeneo/api-php-client-ee", - "version": "v5.0.0", - "source": { - "type": "git", - "url": "https://github.com/akeneo/api-php-client-ee.git", - "reference": "39bc35795fde4ee492f3b10c926e83244d97fbb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/akeneo/api-php-client-ee/zipball/39bc35795fde4ee492f3b10c926e83244d97fbb7", - "reference": "39bc35795fde4ee492f3b10c926e83244d97fbb7", - "shasum": "" - }, - "require": { - "akeneo/api-php-client": "^5.0" - }, - "require-dev": { - "donatj/mock-webserver": "^2.0", - "friendsofphp/php-cs-fixer": "^2.14", - "http-interop/http-factory-guzzle": "^1.0", - "php-http/guzzle6-adapter": "^2.0", - "phpspec/phpspec": "^5.0", - "phpunit/phpunit": "^7.0", - "symfony/yaml": "^4.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Akeneo\\PimEnterprise\\ApiClient\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "OSL-3.0" - ], - "authors": [ - { - "name": "Akeneo", - "homepage": "http://www.akeneo.com" - } - ], - "description": "Akeneo PIM ENTERPRISE client for the API", - "support": { - "issues": "https://github.com/akeneo/api-php-client-ee/issues", - "source": "https://github.com/akeneo/api-php-client-ee/tree/master" + "source": "https://github.com/akeneo/api-php-client/tree/v9.0.1" }, - "abandoned": "akeneo/api-php-client", - "time": "2019-10-11T15:06:55+00:00" + "time": "2022-05-30T07:36:48+00:00" }, { "name": "clue/stream-filter", @@ -7285,5 +7235,5 @@ "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.1.0" } diff --git a/infection.json.dist b/infection.json.dist index b6d1c95..88d3cf6 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -12,8 +12,7 @@ "json": "infection/infection-log.json", "perMutator": "infection/per-mutator.md", "stryker": { - "badge": "/^(main$|feature\/)/", - "report": "/^(main$|feature\/)/" + "badge": "/^(main$|feature\\/)/" } }, "phpUnit": { diff --git a/src/Builder/Client.php b/src/Builder/Client.php index 9306ac0..5d56762 100644 --- a/src/Builder/Client.php +++ b/src/Builder/Client.php @@ -8,7 +8,6 @@ final class Client implements Builder { - private bool $withEnterpriseSupport; private ?Node\Expr $username; private ?Node\Expr $password; private ?Node\Expr $token; @@ -23,7 +22,6 @@ public function __construct( private Node\Expr $clientId, private Node\Expr $secret ) { - $this->withEnterpriseSupport = false; $this->username = null; $this->password = null; $this->token = null; @@ -34,13 +32,6 @@ public function __construct( $this->fileSystem = null; } - public function withEnterpriseSupport(bool $withEnterpriseSupport): self - { - $this->withEnterpriseSupport = $withEnterpriseSupport; - - return $this; - } - public function withToken(Node\Expr $token, Node\Expr $refreshToken): self { $this->token = $token; @@ -88,9 +79,7 @@ public function withFileSystem(Node\Expr $fileSystem): self public function getNode(): Node\Expr\MethodCall { $instance = new Node\Expr\New_( - !$this->withEnterpriseSupport ? - new Node\Name\FullyQualified('Akeneo\\Pim\\ApiClient\\AkeneoPimClientBuilder') : - new Node\Name\FullyQualified('Akeneo\\PimEnterprise\\ApiClient\\AkeneoPimEnterpriseClientBuilder'), + new Node\Name\FullyQualified('Akeneo\\Pim\\ApiClient\\AkeneoPimClientBuilder'), [ new Node\Arg($this->baseUrl), ], diff --git a/tests/functional/Builder/BuilderTestCase.php b/tests/functional/Builder/BuilderTestCase.php index e8ef9b6..4d18db8 100644 --- a/tests/functional/Builder/BuilderTestCase.php +++ b/tests/functional/Builder/BuilderTestCase.php @@ -24,7 +24,6 @@ protected function setUp(): void protected function tearDown(): void { $this->fs = null; - vfsStreamWrapper::unregister(); } protected function getBuilderCompilePath(): string diff --git a/tests/functional/Builder/ClientTest.php b/tests/functional/Builder/ClientTest.php index 97a0d6f..665f816 100644 --- a/tests/functional/Builder/ClientTest.php +++ b/tests/functional/Builder/ClientTest.php @@ -56,7 +56,6 @@ public function testWithToken(): void $client->withHttpClient($this->getClientNode()); $this->assertNodeIsInstanceOf(AkeneoPimClientInterface::class, $client); - $this->assertNodeIsNotInstanceOf(AkeneoPimEnterpriseClientInterface::class, $client); } public function testWithTokenForEnterprise(): void @@ -74,9 +73,6 @@ public function testWithTokenForEnterprise(): void $client->withHttpClient($this->getClientNode()); - $client->withEnterpriseSupport(true); - $this->assertNodeIsInstanceOf(AkeneoPimClientInterface::class, $client); - $this->assertNodeIsInstanceOf(AkeneoPimEnterpriseClientInterface::class, $client); } } diff --git a/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php b/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php index 2bcc7ef..1359563 100644 --- a/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php +++ b/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php @@ -30,7 +30,7 @@ public function testLookupProduct() ) ; - $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client = new Mock\ApiClientMockBuilder(); $client ->withHttpClient($httpClient) ->withRequestFactory(new Mock\RequestFactoryBuilder()) diff --git a/tests/functional/Builder/Extractor/ExtractorTest.php b/tests/functional/Builder/Extractor/ExtractorTest.php index b5d4817..4e92393 100644 --- a/tests/functional/Builder/Extractor/ExtractorTest.php +++ b/tests/functional/Builder/Extractor/ExtractorTest.php @@ -28,7 +28,7 @@ public function testAllProducts(): void ) ; - $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client = new Mock\ApiClientMockBuilder(); $client ->withHttpClient($httpClient) ->withRequestFactory(new Mock\RequestFactoryBuilder()) @@ -164,7 +164,7 @@ public function testGetProduct(): void ) ; - $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client = new Mock\ApiClientMockBuilder(); $client ->withHttpClient($httpClient) ->withRequestFactory(new Mock\RequestFactoryBuilder()) @@ -244,7 +244,7 @@ public function testSearchProduct(): void ) ; - $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client = new Mock\ApiClientMockBuilder(); $client ->withHttpClient($httpClient) ->withRequestFactory(new Mock\RequestFactoryBuilder()) diff --git a/tests/functional/Builder/Loader/LoaderTest.php b/tests/functional/Builder/Loader/LoaderTest.php index 8707b62..cb56bf2 100644 --- a/tests/functional/Builder/Loader/LoaderTest.php +++ b/tests/functional/Builder/Loader/LoaderTest.php @@ -28,7 +28,7 @@ public function testUpsertProduct(): void ) ; - $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client = new Mock\ApiClientMockBuilder(); $client ->withHttpClient($httpClient) ->withRequestFactory(new Mock\RequestFactoryBuilder()) @@ -75,7 +75,7 @@ public function testUpsertProductsList(): void ) ; - $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client = new Mock\ApiClientMockBuilder(); $client ->withHttpClient($httpClient) ->withRequestFactory(new Mock\RequestFactoryBuilder()) diff --git a/tests/functional/Builder/Lookup/LookupTest.php b/tests/functional/Builder/Lookup/LookupTest.php index 8bc8529..79c0ff7 100644 --- a/tests/functional/Builder/Lookup/LookupTest.php +++ b/tests/functional/Builder/Lookup/LookupTest.php @@ -30,7 +30,7 @@ public function testLookupProduct() ) ; - $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client = new Mock\ApiClientMockBuilder(); $client ->withHttpClient($httpClient) ->withRequestFactory(new Mock\RequestFactoryBuilder()) @@ -76,7 +76,7 @@ public function testConditionalLookupProduct() ) ; - $client = new Mock\ApiClientMockBuilder(withEnterpriseSupport: false); + $client = new Mock\ApiClientMockBuilder(); $client ->withHttpClient($httpClient) ->withRequestFactory(new Mock\RequestFactoryBuilder()) diff --git a/tests/functional/Mock/ApiClientMockBuilder.php b/tests/functional/Mock/ApiClientMockBuilder.php index a476207..4098e4f 100644 --- a/tests/functional/Mock/ApiClientMockBuilder.php +++ b/tests/functional/Mock/ApiClientMockBuilder.php @@ -3,7 +3,6 @@ namespace functional\Kiboko\Plugin\Akeneo\Mock; use Akeneo\Pim\ApiClient\AkeneoPimClientBuilder; -use Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientBuilder; use Faker\Factory; use functional\Kiboko\Plugin\Akeneo\Mock; use PhpParser\Builder; @@ -13,15 +12,12 @@ final class ApiClientMockBuilder implements Builder { private Node\Expr $node; - public function __construct( - bool $withEnterpriseSupport = false, - ) { + public function __construct() + { $faker = Factory::create(); $this->node = new Node\Expr\New_( - class: new Node\Name\FullyQualified( - $withEnterpriseSupport === true ? AkeneoPimEnterpriseClientBuilder::class : AkeneoPimClientBuilder::class - ), + class: new Node\Name\FullyQualified(AkeneoPimClientBuilder::class), args: [ new Node\Arg( new Node\Scalar\String_('https://akeneo.'.$faker->safeEmailDomain()), From bd5edc2725329e850d3961a3d83350eeb97e341c Mon Sep 17 00:00:00 2001 From: clemzarch Date: Tue, 31 May 2022 16:42:41 +0200 Subject: [PATCH 07/19] raise minimum MSI to 50%, add tests to check if the Capacities throw errors when providing wrong and right configurations, test the builders by providing the capacity's configuration as an array (closer to user-written YAML) to cover more code --- infection.json.dist | 2 +- .../Builder/Capacity/Extractor/AllTest.php | 7 +- .../Builder/Capacity/Extractor/GetTest.php | 44 +++++ .../Capacity/Extractor/ListPerPageTest.php | 4 +- .../Capacity/Loader/UpsertListTest.php | 46 ++++++ .../Builder/Capacity/Lookup/AllTest.php | 24 +++ .../Builder/Capacity/Lookup/DownloadTest.php | 29 ++++ .../Capacity/Lookup/ListPerPageTest.php | 20 +++ .../ConditionalLookupTest.php | 7 +- .../Builder/Extractor/ExtractorTest.php | 24 +-- .../functional/Builder/Loader/LoaderTest.php | 22 +-- .../functional/Builder/Lookup/LookupTest.php | 7 +- .../functional/Capacity/Extractor/AllTest.php | 87 ++++++++++ .../Capacity/Extractor/ListPerPageTest.php | 87 ++++++++++ tests/functional/Factory/ExtractorTest.php | 37 +++++ tests/functional/Factory/LoaderTest.php | 37 +++++ tests/functional/Factory/LookupTest.php | 37 +++++ tests/functional/ServiceTest.php | 151 ++++++++++++++++++ 18 files changed, 636 insertions(+), 36 deletions(-) create mode 100644 tests/functional/Builder/Capacity/Extractor/GetTest.php create mode 100644 tests/functional/Builder/Capacity/Loader/UpsertListTest.php create mode 100644 tests/functional/Builder/Capacity/Lookup/AllTest.php create mode 100644 tests/functional/Builder/Capacity/Lookup/DownloadTest.php create mode 100644 tests/functional/Builder/Capacity/Lookup/ListPerPageTest.php create mode 100644 tests/functional/Capacity/Extractor/AllTest.php create mode 100644 tests/functional/Capacity/Extractor/ListPerPageTest.php create mode 100644 tests/functional/ServiceTest.php diff --git a/infection.json.dist b/infection.json.dist index 9e6f4e2..89e0485 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -20,6 +20,6 @@ }, "testFramework":"phpunit", "initialTestsPhpOptions": "-d zend_extension=xdebug -d xdebug.mode=coverage", - "minMsi": 30, + "minMsi": 50, "minCoveredMsi": 70 } diff --git a/tests/functional/Builder/Capacity/Extractor/AllTest.php b/tests/functional/Builder/Capacity/Extractor/AllTest.php index 36235e5..4728cea 100644 --- a/tests/functional/Builder/Capacity/Extractor/AllTest.php +++ b/tests/functional/Builder/Capacity/Extractor/AllTest.php @@ -6,23 +6,24 @@ use Kiboko\Plugin\Akeneo\Builder\Capacity\Extractor\All; use Kiboko\Plugin\Akeneo\MissingEndpointException; use PhpParser\Node; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; final class AllTest extends BuilderTestCase { public function testWithoutEndpoint() { - $capacity = new All(new ExpressionLanguage()); + $capacity = new All(); $this->expectException(MissingEndpointException::class); $this->expectExceptionMessage('Please check your capacity builder, you should have selected an endpoint.'); + $capacity->withCode(new Node\Scalar\String_('foo')); + $capacity->getNode(); } public function testWithEndpoint() { - $capacity = new All(new ExpressionLanguage()); + $capacity = new All(); $capacity->withEndpoint(new Node\Identifier('foo')); diff --git a/tests/functional/Builder/Capacity/Extractor/GetTest.php b/tests/functional/Builder/Capacity/Extractor/GetTest.php new file mode 100644 index 0000000..40b21ae --- /dev/null +++ b/tests/functional/Builder/Capacity/Extractor/GetTest.php @@ -0,0 +1,44 @@ +withIdentifier(new Node\Scalar\String_('foo')); + + $this->expectException(MissingEndpointException::class); + $this->expectExceptionMessage('Please check your capacity builder, you should have selected an endpoint.'); + + $capacity->getNode(); + } + + public function testWithoutIdentifier() + { + $capacity = new Get(); + + $capacity->withEndpoint(new Node\Identifier('foo')); + + $this->expectException(\TypeError::class); + + $this->assertInstanceOf(Node\Stmt\Expression::class, $capacity->getNode()); + } + + public function testWithEndpoint() + { + $capacity = new Get(); + + $capacity->withEndpoint(new Node\Identifier('foo')); + $capacity->withIdentifier(new Node\Scalar\String_('foo')); + + $this->assertInstanceOf(Node\Stmt\Expression::class, $capacity->getNode()); + } +} diff --git a/tests/functional/Builder/Capacity/Extractor/ListPerPageTest.php b/tests/functional/Builder/Capacity/Extractor/ListPerPageTest.php index 93be48b..a976f91 100644 --- a/tests/functional/Builder/Capacity/Extractor/ListPerPageTest.php +++ b/tests/functional/Builder/Capacity/Extractor/ListPerPageTest.php @@ -12,7 +12,7 @@ final class ListPerPageTest extends BuilderTestCase { public function testWithoutEndpoint() { - $capacity = new ListPerPage(new ExpressionLanguage()); + $capacity = new ListPerPage(); $this->expectException(MissingEndpointException::class); $this->expectExceptionMessage('Please check your capacity builder, you should have selected an endpoint.'); @@ -22,7 +22,7 @@ public function testWithoutEndpoint() public function testWithEndpoint() { - $capacity = new ListPerPage(new ExpressionLanguage()); + $capacity = new ListPerPage(); $capacity->withEndpoint(new Node\Identifier('foo')); diff --git a/tests/functional/Builder/Capacity/Loader/UpsertListTest.php b/tests/functional/Builder/Capacity/Loader/UpsertListTest.php new file mode 100644 index 0000000..d12631d --- /dev/null +++ b/tests/functional/Builder/Capacity/Loader/UpsertListTest.php @@ -0,0 +1,46 @@ +withData(new Node\Expr\Array_()); + + $this->expectException(MissingEndpointException::class); + $this->expectExceptionMessage('Please check your capacity builder, you should have selected an endpoint.'); + + $capacity->getNode(); + } + + public function testWithoutData() + { + $capacity = new UpsertList(); + + $capacity->withEndpoint(new Node\Identifier('foo')); + + $this->expectException(MissingParameterException::class); + $this->expectExceptionMessage('Please check your capacity builder, you should have provided some data.'); + + $capacity->getNode(); + } + + public function testWithEndpoint() + { + $capacity = new UpsertList(); + + $capacity->withEndpoint(new Node\Identifier('foo')); + $capacity->withData(new Node\Expr\Array_()); + + $this->assertInstanceOf(Node\Stmt\While_::class, $capacity->getNode()); + } +} diff --git a/tests/functional/Builder/Capacity/Lookup/AllTest.php b/tests/functional/Builder/Capacity/Lookup/AllTest.php new file mode 100644 index 0000000..cd5748d --- /dev/null +++ b/tests/functional/Builder/Capacity/Lookup/AllTest.php @@ -0,0 +1,24 @@ +expectException(MissingEndpointException::class); + $this->expectExceptionMessage('Please check your capacity builder, you should have selected an endpoint.'); + + $capacity->withCode(new Node\Scalar\String_('foo')); + $capacity->withSearch(new Node\Scalar\String_('foo')); + + $capacity->getNode(); + } +} diff --git a/tests/functional/Builder/Capacity/Lookup/DownloadTest.php b/tests/functional/Builder/Capacity/Lookup/DownloadTest.php new file mode 100644 index 0000000..6750119 --- /dev/null +++ b/tests/functional/Builder/Capacity/Lookup/DownloadTest.php @@ -0,0 +1,29 @@ +expectException(MissingEndpointException::class); + $this->expectExceptionMessage('Please check your capacity builder, you should have selected an endpoint.'); + + $capacity->getNode(); + } + + public function testWithEndpoint() + { + $capacity = new Download(); + $capacity->withEndpoint(new Node\Scalar\String_('foo')); + + $this->assertInstanceOf(Node\Stmt\Expression::class, $capacity->getNode()); + } +} diff --git a/tests/functional/Builder/Capacity/Lookup/ListPerPageTest.php b/tests/functional/Builder/Capacity/Lookup/ListPerPageTest.php new file mode 100644 index 0000000..4c861f4 --- /dev/null +++ b/tests/functional/Builder/Capacity/Lookup/ListPerPageTest.php @@ -0,0 +1,20 @@ +expectException(MissingEndpointException::class); + $this->expectExceptionMessage('Please check your capacity builder, you should have selected an endpoint.'); + + $capacity->getNode(); + } +} diff --git a/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php b/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php index 2bcc7ef..f6667a7 100644 --- a/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php +++ b/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php @@ -16,7 +16,6 @@ final class ConditionalLookupTest extends BuilderTestCase public function testLookupProduct() { - $this->markTestSkipped(); $httpClient = new Mock\HttpClientBuilder(new Mock\ResponseFactoryBuilder()); $httpClient @@ -43,8 +42,12 @@ public function testLookupProduct() ->withEndpoint(new Node\Identifier('getProductApi')) ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); - $builder = new ConditionalLookup(new AlternativeLookup($capacity)); + $builder = new ConditionalLookup(); $builder->withClient($client->getNode()); + $builder->addAlternative( + condition: new Node\Expr\Isset_([new Node\Expr\Variable('output')]), + lookup: new AlternativeLookup($capacity) + ); $this->assertBuildsTransformerTransformsLike( [ diff --git a/tests/functional/Builder/Extractor/ExtractorTest.php b/tests/functional/Builder/Extractor/ExtractorTest.php index b5d4817..f83300e 100644 --- a/tests/functional/Builder/Extractor/ExtractorTest.php +++ b/tests/functional/Builder/Extractor/ExtractorTest.php @@ -5,9 +5,9 @@ use functional\Kiboko\Plugin\Akeneo\Builder\BuilderTestCase; use functional\Kiboko\Plugin\Akeneo\Mock; use Kiboko\Component\PHPUnitExtension\Assert\ExtractorBuilderAssertTrait; -use Kiboko\Plugin\Akeneo\Builder\Capacity; use Kiboko\Plugin\Akeneo\Builder\Extractor; -use PhpParser\Node; +use Kiboko\Plugin\Akeneo\Capacity; +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; final class ExtractorTest extends BuilderTestCase { @@ -37,9 +37,9 @@ public function testAllProducts(): void ->withAuthenticatedByPassword() ; - $capacity = new Capacity\Extractor\All(); - $capacity->withEndpoint(new Node\Identifier('getProductApi')); - $capacity->withType('product'); + $capacity = (new Capacity\Extractor\All(new ExpressionLanguage()))->getBuilder([ + 'type' => 'product', + ]); $builder = new Extractor($capacity); $builder->withClient($client->getNode()); @@ -173,9 +173,10 @@ public function testGetProduct(): void ->withAuthenticatedByPassword() ; - $capacity = new Capacity\Extractor\Get(); - $capacity->withEndpoint(new Node\Identifier('getProductApi')); - $capacity->withIdentifier(new Node\Scalar\String_('123qwerty')); + $capacity = (new Capacity\Extractor\Get(new ExpressionLanguage()))->getBuilder([ + 'type' => 'product', + 'identifier' => '123qwerty' + ]); $builder = new Extractor($capacity); $builder->withClient($client->getNode()); @@ -253,9 +254,10 @@ public function testSearchProduct(): void ->withAuthenticatedByPassword() ; - $capacity = new Capacity\Extractor\All(); - $capacity->withEndpoint(new Node\Identifier('getProductApi')); - $capacity->withSearch(new Node\Scalar\String_('123')); + $capacity = (new Capacity\Extractor\All(new ExpressionLanguage()))->getBuilder([ + 'type' => 'product', + 'search' => '123', + ]); $builder = new Extractor($capacity); $builder->withClient($client->getNode()); diff --git a/tests/functional/Builder/Loader/LoaderTest.php b/tests/functional/Builder/Loader/LoaderTest.php index 8707b62..d2cb2ce 100644 --- a/tests/functional/Builder/Loader/LoaderTest.php +++ b/tests/functional/Builder/Loader/LoaderTest.php @@ -5,9 +5,9 @@ use functional\Kiboko\Plugin\Akeneo\Builder\BuilderTestCase; use functional\Kiboko\Plugin\Akeneo\Mock; use Kiboko\Component\PHPUnitExtension\Assert\LoaderBuilderAssertTrait; -use Kiboko\Plugin\Akeneo\Builder\Capacity; use Kiboko\Plugin\Akeneo\Builder\Loader; -use PhpParser\Node; +use Kiboko\Plugin\Akeneo\Capacity; +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; final class LoaderTest extends BuilderTestCase { @@ -36,11 +36,11 @@ public function testUpsertProduct(): void ->withFileSystem(new Mock\FileSystemBuilder()) ->withAuthenticatedByPassword(); - $capacity = new Capacity\Loader\Upsert(); - $capacity - ->withEndpoint(new Node\Identifier('getProductApi')) - ->withCode(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('line'), new Node\Scalar\String_('code'))) - ->withData(new Node\Expr\Variable('line')); + $capacity = (new Capacity\Loader\Upsert(new ExpressionLanguage()))->getBuilder([ + 'type' => 'product', + 'method' => 'all', + 'code' => 'line[code]' + ]); $builder = new Loader($capacity); $builder->withClient($client->getNode()); @@ -83,10 +83,10 @@ public function testUpsertProductsList(): void ->withFileSystem(new Mock\FileSystemBuilder()) ->withAuthenticatedByPassword(); - $capacity = new Capacity\Loader\UpsertList(); - $capacity - ->withEndpoint(new Node\Identifier('getProductApi')) - ->withData(new Node\Expr\Variable('line')); + $capacity = (new Capacity\Loader\UpsertList())->getBuilder([ + 'type' => 'product', + 'code' => 'line' + ]); $builder = new Loader($capacity); $builder->withClient($client->getNode()); diff --git a/tests/functional/Builder/Lookup/LookupTest.php b/tests/functional/Builder/Lookup/LookupTest.php index 8bc8529..d8e6d31 100644 --- a/tests/functional/Builder/Lookup/LookupTest.php +++ b/tests/functional/Builder/Lookup/LookupTest.php @@ -7,7 +7,6 @@ use Kiboko\Component\PHPUnitExtension\Assert\TransformerBuilderAssertTrait; use Kiboko\Plugin\Akeneo\Builder\AlternativeLookup; use Kiboko\Plugin\Akeneo\Builder\Capacity; -use Kiboko\Plugin\Akeneo\Builder\ConditionalLookup; use Kiboko\Plugin\Akeneo\Builder\Lookup; use PhpParser\Node; @@ -89,12 +88,8 @@ public function testConditionalLookupProduct() ->withEndpoint(new Node\Identifier('getProductApi')) ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); - $builder = new ConditionalLookup(); + $builder = new Lookup(new AlternativeLookup($capacity)); $builder->withClient($client->getNode()); - $builder->addAlternative( - condition: new Node\Expr\Isset_([new Node\Expr\Variable('output')]), - lookup: new AlternativeLookup($capacity) - ); $this->assertBuildsTransformerTransformsLike( [ diff --git a/tests/functional/Capacity/Extractor/AllTest.php b/tests/functional/Capacity/Extractor/AllTest.php new file mode 100644 index 0000000..83a457f --- /dev/null +++ b/tests/functional/Capacity/Extractor/AllTest.php @@ -0,0 +1,87 @@ + [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => 'EMPTY', + 'value' => 'bar' + ] + ] + ], + 'expected_message' => 'You should not provide a value for the EMPTY operator' + ]; + + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => '=', + 'field' => 'foo' + ] + ] + ], + 'expected_message' => 'You should provide a value for the = operator' + ]; + } + + public function goodConfigs(): \Generator + { + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => 'EMPTY', + 'field' => 'foo', + ] + ] + ] + ]; + + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => '=', + 'value' => 'bar', + 'field' => 'foo', + ] + ] + ] + ]; + } + + /** @dataProvider wrongConfigs */ + public function testWrongConfigs(array $config, string $expected_message): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionMessage($expected_message); + + (new Capacity\Extractor\All(new ExpressionLanguage()))->getBuilder($config); + } + + /** @dataProvider goodConfigs */ + public function testGoodConfigs(array $config): void + { + $this->assertInstanceOf( + 'PhpParser\Builder', + (new Capacity\Extractor\All(new ExpressionLanguage()))->getBuilder($config) + ); + } + +} diff --git a/tests/functional/Capacity/Extractor/ListPerPageTest.php b/tests/functional/Capacity/Extractor/ListPerPageTest.php new file mode 100644 index 0000000..a88ccec --- /dev/null +++ b/tests/functional/Capacity/Extractor/ListPerPageTest.php @@ -0,0 +1,87 @@ + [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => 'EMPTY', + 'value' => 'bar' + ] + ] + ], + 'expected_message' => 'You should not provide a value for the EMPTY operator' + ]; + + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => '=', + 'field' => 'foo' + ] + ] + ], + 'expected_message' => 'You should provide a value for the = operator' + ]; + } + + public function goodConfigs(): \Generator + { + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => 'EMPTY', + 'field' => 'foo', + ] + ] + ] + ]; + + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => '=', + 'value' => 'bar', + 'field' => 'foo', + ] + ] + ] + ]; + } + + /** @dataProvider wrongConfigs */ + public function testWrongConfigs(array $config, string $expected_message): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionMessage($expected_message); + + (new Capacity\Extractor\ListPerPage(new ExpressionLanguage()))->getBuilder($config); + } + + /** @dataProvider goodConfigs */ + public function testGoodConfigs(array $config): void + { + $this->assertInstanceOf( + 'PhpParser\Builder', + (new Capacity\Extractor\ListPerPage(new ExpressionLanguage()))->getBuilder($config) + ); + } + +} diff --git a/tests/functional/Factory/ExtractorTest.php b/tests/functional/Factory/ExtractorTest.php index ccd807a..6cf6231 100644 --- a/tests/functional/Factory/ExtractorTest.php +++ b/tests/functional/Factory/ExtractorTest.php @@ -24,4 +24,41 @@ public function testValidateEmptyConfiguration() $client = new Extractor(new ExpressionLanguage()); $this->assertFalse($client->validate([])); } + + public function testMissingType(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); + + $client = new Extractor(new ExpressionLanguage()); + $this->assertFalse($client->validate(['wrong'])); + $client->compile(['wrong']); + } + + public function testTypeNotFound(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); + + $client = new Extractor(new ExpressionLanguage()); + $client->compile([ + 'type' => 'wrong', + 'method' => 'all', + ]); + } + + public function testCapacityNotFound(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); + + $client = new Extractor(new ExpressionLanguage()); + $client->compile([ + 'type' => 'product', + 'method' => 'wrong', + ]); + } } diff --git a/tests/functional/Factory/LoaderTest.php b/tests/functional/Factory/LoaderTest.php index a2c1da6..2e63987 100644 --- a/tests/functional/Factory/LoaderTest.php +++ b/tests/functional/Factory/LoaderTest.php @@ -24,4 +24,41 @@ public function testValidateEmptyConfiguration() $client = new Loader(new ExpressionLanguage()); $this->assertFalse($client->validate([])); } + + public function testMissingType(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); + + $client = new Loader(new ExpressionLanguage()); + $this->assertFalse($client->validate(['wrong'])); + $client->compile(['wrong']); + } + + public function testTypeNotFound(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); + + $client = new Loader(new ExpressionLanguage()); + $client->compile([ + 'type' => 'wrong', + 'method' => 'upsert', + ]); + } + + public function testCapacityNotFound(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); + + $client = new Loader(new ExpressionLanguage()); + $client->compile([ + 'type' => 'product', + 'method' => 'wrong', + ]); + } } diff --git a/tests/functional/Factory/LookupTest.php b/tests/functional/Factory/LookupTest.php index 927dbac..813829f 100644 --- a/tests/functional/Factory/LookupTest.php +++ b/tests/functional/Factory/LookupTest.php @@ -30,4 +30,41 @@ public function testValidateEmptyConfiguration() 'type' => 'product', ])); } + + public function testMissingType(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); + + $client = new Lookup(new ExpressionLanguage()); + $this->assertFalse($client->validate(['wrong'])); + $client->compile(['wrong']); + } + + public function testTypeNotFound(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); + + $client = new Lookup(new ExpressionLanguage()); + $client->compile([ + 'type' => 'wrong', + 'method' => 'all', + ]); + } + + public function testCapacityNotFound(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); + + $client = new Lookup(new ExpressionLanguage()); + $client->compile([ + 'type' => 'product', + 'method' => 'wrong', + ]); + } } diff --git a/tests/functional/ServiceTest.php b/tests/functional/ServiceTest.php new file mode 100644 index 0000000..dfd396c --- /dev/null +++ b/tests/functional/ServiceTest.php @@ -0,0 +1,151 @@ + [ + 'enterprise' => true, + 'expression_language' => [], + 'extractor' => [ + 'type' => 'product', + 'method' => 'get', + 'identifier' => 'azerty123', + 'search' => [] + ], + 'client' => [ + 'api_url' => '1234', + 'client_id' => '1234', + 'secret' => '1234', + 'username' => '1234', + 'password' => '1234' + ] + ], + 'expected_class' => 'Kiboko\\Plugin\\Akeneo\\Factory\\Repository\\Extractor', + 'actual' => [ + [ + 'enterprise' => true, + 'extractor' => [ + 'type' => 'product', + 'method' => 'get', + 'identifier' => 'azerty123' + ], + 'client' => [ + 'api_url' => '1234', + 'client_id' => '1234', + 'secret' => '1234', + 'username' => '1234', + 'password' => '1234' + ] + ] + ] + ]; + + /** Upsert */ + yield [ + 'expected' => [ + 'enterprise' => false, + 'expression_language' => [], + 'loader' => [ + 'type' => 'product', + 'method' => 'upsert', + 'code' => 'azerty123', + ], + 'client' => [ + 'api_url' => '1234', + 'client_id' => '1234', + 'secret' => '1234', + 'username' => '1234', + 'password' => '1234' + ] + ], + 'expected_class' => 'Kiboko\\Plugin\\Akeneo\\Factory\\Repository\\Loader', + 'actual' => [ + [ + 'enterprise' => false, + 'expression_language' => [], + 'loader' => [ + 'type' => 'product', + 'method' => 'upsert', + 'code' => 'azerty123', + ], + 'client' => [ + 'api_url' => '1234', + 'client_id' => '1234', + 'secret' => '1234', + 'username' => '1234', + 'password' => '1234' + ] + ] + ] + ]; + } + + public function testEmptyConfiguration(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Could not determine if the factory should build an extractor or a loader.'); + + $service = new Akeneo\Service(); + $this->assertTrue($service->validate(['akeneo' => []])); + $service->compile([ + 'akeneo' => [] + ]); + } + + public function testWrongConfiguration(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Invalid type for path "akeneo". Expected "array", but got "string"'); + + $service = new Akeneo\Service(); + $service->normalize(['akeneo' => 'wrong']); + } + + public function testMissingAuthentication(): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionCode(0); + $this->expectExceptionMessage('Your Akeneo API configuration is missing an authentication method, you should either define "username" or "token" options.'); + + $service = new Akeneo\Service(); + $service->compile([ + 'enterprise' => false, + 'loader' => [ + 'type' => 'product', + 'method' => 'upsert', + 'code' => 'azerty123', + ], + 'client' => [ + 'api_url' => '1234', + 'client_id' => '1234', + 'secret' => '1234', + 'username' => '1234', + ] + ]); + } + + /** @dataProvider configProvider */ + public function testWithConfigurationAndProcessor(array $expected, string $expectedClass, array $actual): void + { + $service = new Akeneo\Service(new ExpressionLanguage()); + + $this->assertEquals( + $expected, + $service->normalize($actual) + ); + + $this->assertTrue($service->validate($actual)); + } +} From bf90758a63ca362b923d0bf0492ce528223d1519 Mon Sep 17 00:00:00 2001 From: clemzarch Date: Tue, 31 May 2022 17:02:25 +0200 Subject: [PATCH 08/19] remove last traces of "withEnterpriseSupport" because the new client works for both Enterprise and Community --- src/Builder/ConditionalLookup.php | 6 +----- src/Builder/Extractor.php | 13 +------------ src/Builder/Loader.php | 13 +------------ src/Builder/Lookup.php | 13 +------------ src/Factory/Extractor.php | 4 ---- src/Factory/Loader.php | 4 ---- src/Service.php | 3 --- 7 files changed, 4 insertions(+), 52 deletions(-) diff --git a/src/Builder/ConditionalLookup.php b/src/Builder/ConditionalLookup.php index 8a7a38a..b63121d 100644 --- a/src/Builder/ConditionalLookup.php +++ b/src/Builder/ConditionalLookup.php @@ -12,14 +12,12 @@ final class ConditionalLookup implements StepBuilderInterface private ?Node\Expr $logger; /** @var iterable */ private iterable $alternatives; - private bool $withEnterpriseSupport; private ?Node\Expr $client; public function __construct() { $this->logger = null; $this->alternatives = []; - $this->withEnterpriseSupport = false; $this->client = null; } @@ -143,9 +141,7 @@ class: new Node\Stmt\Class_( 'params' => [ new Node\Param( var: new Node\Expr\Variable('client'), - type: !$this->withEnterpriseSupport ? - new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface') : - new Node\Name\FullyQualified(name: 'Akeneo\\PimEnterprise\\ApiClient\\AkeneoPimEnterpriseClientInterface'), + type: new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface'), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), new Node\Param( diff --git a/src/Builder/Extractor.php b/src/Builder/Extractor.php index 49de31d..f2cfa6a 100644 --- a/src/Builder/Extractor.php +++ b/src/Builder/Extractor.php @@ -9,24 +9,15 @@ final class Extractor implements StepBuilderInterface { private ?Node\Expr $logger; - private bool $withEnterpriseSupport; private ?Node\Expr $client; public function __construct( private Builder $capacity, ) { $this->logger = null; - $this->withEnterpriseSupport = false; $this->client = null; } - public function withEnterpriseSupport(bool $withEnterpriseSupport): self - { - $this->withEnterpriseSupport = $withEnterpriseSupport; - - return $this; - } - public function withClient(Node\Expr $client): self { $this->client = $client; @@ -68,9 +59,7 @@ class: new Node\Stmt\Class_( 'params' => [ new Node\Param( var: new Node\Expr\Variable('client'), - type: !$this->withEnterpriseSupport ? - new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface') : - new Node\Name\FullyQualified(name: 'Akeneo\\PimEnterprise\\ApiClient\\AkeneoPimEnterpriseClientInterface'), + type: new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface'), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), new Node\Param( diff --git a/src/Builder/Loader.php b/src/Builder/Loader.php index 37311dc..74f2598 100644 --- a/src/Builder/Loader.php +++ b/src/Builder/Loader.php @@ -9,24 +9,15 @@ final class Loader implements StepBuilderInterface { private ?Node\Expr $logger; - private bool $withEnterpriseSupport; private ?Node\Expr $client; public function __construct( private Builder $capacity, ) { $this->logger = null; - $this->withEnterpriseSupport = false; $this->client = null; } - public function withEnterpriseSupport(bool $withEnterpriseSupport): self - { - $this->withEnterpriseSupport = $withEnterpriseSupport; - - return $this; - } - public function withClient(Node\Expr $client): self { $this->client = $client; @@ -68,9 +59,7 @@ class: new Node\Stmt\Class_( 'params' => [ new Node\Param( var: new Node\Expr\Variable('client'), - type: !$this->withEnterpriseSupport ? - new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface') : - new Node\Name\FullyQualified(name: 'Akeneo\\PimEnterprise\\ApiClient\\AkeneoPimEnterpriseClientInterface'), + type: new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface'), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), new Node\Param( diff --git a/src/Builder/Lookup.php b/src/Builder/Lookup.php index 456f7fc..6b9a797 100644 --- a/src/Builder/Lookup.php +++ b/src/Builder/Lookup.php @@ -10,24 +10,15 @@ final class Lookup implements StepBuilderInterface { private ?Node\Expr $logger; - private bool $withEnterpriseSupport; private ?Node\Expr $client; public function __construct( private AlternativeLookup $alternative, ) { $this->logger = null; - $this->withEnterpriseSupport = false; $this->client = null; } - public function withEnterpriseSupport(bool $withEnterpriseSupport): self - { - $this->withEnterpriseSupport = $withEnterpriseSupport; - - return $this; - } - public function withClient(Node\Expr $client): self { $this->client = $client; @@ -90,9 +81,7 @@ class: new Node\Stmt\Class_( 'params' => [ new Node\Param( var: new Node\Expr\Variable('client'), - type: !$this->withEnterpriseSupport ? - new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface') : - new Node\Name\FullyQualified(name: 'Akeneo\\PimEnterprise\\ApiClient\\AkeneoPimEnterpriseClientInterface'), + type: new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface'), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), new Node\Param( diff --git a/src/Factory/Extractor.php b/src/Factory/Extractor.php index fee658a..18ea1e6 100644 --- a/src/Factory/Extractor.php +++ b/src/Factory/Extractor.php @@ -86,10 +86,6 @@ public function compile(array $config): Repository\Extractor ); } - if (array_key_exists('enterprise', $config)) { - $builder->withEnterpriseSupport($config['enterprise']); - } - try { return new Repository\Extractor($builder); } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { diff --git a/src/Factory/Loader.php b/src/Factory/Loader.php index 24dad2e..b54b31f 100644 --- a/src/Factory/Loader.php +++ b/src/Factory/Loader.php @@ -85,10 +85,6 @@ public function compile(array $config): Repository\Loader ); } - if (array_key_exists('enterprise', $config)) { - $builder->withEnterpriseSupport($config['enterprise']); - } - try { return new Repository\Loader($builder); } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { diff --git a/src/Service.php b/src/Service.php index f30a291..3d0a333 100644 --- a/src/Service.php +++ b/src/Service.php @@ -93,7 +93,6 @@ public function compile(array $config): Factory\Repository\Extractor|Factory\Rep $extractorBuilder = $extractor->getBuilder(); $client = $clientFactory->compile($config['client']); - $client->getBuilder()->withEnterpriseSupport($config['enterprise']); $extractorBuilder ->withClient($client->getBuilder()->getNode()); @@ -109,7 +108,6 @@ public function compile(array $config): Factory\Repository\Extractor|Factory\Rep $loaderBuilder = $loader->getBuilder(); $client = $clientFactory->compile($config['client']); - $client->getBuilder()->withEnterpriseSupport($config['enterprise']); $loaderBuilder ->withClient($client->getBuilder()->getNode()); @@ -125,7 +123,6 @@ public function compile(array $config): Factory\Repository\Extractor|Factory\Rep $lookupBuilder = $lookup->getBuilder(); $client = $clientFactory->compile($config['client']); - $client->getBuilder()->withEnterpriseSupport($config['enterprise']); $lookupBuilder ->withClient($client->getBuilder()->getNode()); From 92397f92f70916d453c2aa06792b8fb4a9858d3e Mon Sep 17 00:00:00 2001 From: clemzarch Date: Tue, 31 May 2022 17:19:04 +0200 Subject: [PATCH 09/19] run cs-fixer and force it to avoid re-indenting PhpParser Nodes ("method_chaining_indentation" => true), remove any mentions of the now defunct "enterprise" option --- .php-cs-fixer.dist.php | 1 + README.md | 2 - src/Builder/Capacity/Extractor/All.php | 21 +++--- src/Builder/Capacity/Extractor/Get.php | 8 +-- .../Capacity/Extractor/ListPerPage.php | 21 +++--- src/Builder/Capacity/Loader/Upsert.php | 20 ++---- src/Builder/Capacity/Loader/UpsertList.php | 16 ++--- src/Builder/Capacity/Lookup/All.php | 22 +++--- src/Builder/Capacity/Lookup/Download.php | 22 +++--- src/Builder/Capacity/Lookup/Get.php | 16 ++--- src/Builder/Capacity/Lookup/ListPerPage.php | 22 +++--- src/Builder/Client.php | 20 +++--- src/Builder/ConditionalLookup.php | 32 +++++---- src/Builder/Extractor.php | 6 +- src/Builder/Inline.php | 14 ++-- src/Builder/Loader.php | 6 +- src/Builder/Lookup.php | 8 +-- src/Builder/Search.php | 10 +-- src/Capacity/CapacityInterface.php | 5 +- src/Capacity/Extractor/All.php | 38 +++++------ src/Capacity/Extractor/Get.php | 11 ++- src/Capacity/Extractor/ListPerPage.php | 37 +++++----- src/Capacity/Loader/Upsert.php | 9 +-- src/Capacity/Loader/UpsertList.php | 13 ++-- src/Capacity/Lookup/All.php | 40 +++++------ src/Capacity/Lookup/Download.php | 21 +++--- src/Capacity/Lookup/Get.php | 14 ++-- src/Capacity/Lookup/ListPerPage.php | 37 +++++----- src/Configuration.php | 11 ++- src/Configuration/Client.php | 29 ++++---- src/Configuration/Extractor.php | 43 ++++++------ src/Configuration/Loader.php | 21 +++--- src/Configuration/Lookup.php | 67 +++++++++---------- src/Configuration/Search.php | 11 +-- src/Factory/Client.php | 24 +++---- src/Factory/Extractor.php | 22 +++--- src/Factory/Loader.php | 22 +++--- src/Factory/Lookup.php | 36 ++++------ src/Factory/NoApplicableCapacityException.php | 4 +- src/Factory/Repository/Client.php | 4 +- src/Factory/Repository/Extractor.php | 4 +- src/Factory/Repository/Loader.php | 4 +- src/Factory/Repository/RepositoryTrait.php | 4 +- src/Factory/Repository/Search.php | 4 +- src/Factory/Search.php | 12 ++-- src/MissingAuthenticationMethodException.php | 4 +- src/MissingEndpointException.php | 4 +- src/MissingParameterException.php | 4 +- src/Service.php | 51 +++++++------- tests/functional/Builder/ClientTest.php | 19 ------ tests/functional/ServiceTest.php | 5 -- 51 files changed, 429 insertions(+), 472 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index fe5d2d6..a1aaac7 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -33,6 +33,7 @@ 'error_suppression' => true, 'ereg_to_preg' => true, 'dir_constant' => true, + 'method_chaining_indentation' => false, ]) ->setFinder($finder) ->setCacheFile('.php-cs-fixer.cache') // forward compatibility with 3.x line diff --git a/README.md b/README.md index 6e74a8c..63fc4c3 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ Configuration format ```yaml akeneo: - enterprise: false extractor: type: productModel method: all @@ -47,7 +46,6 @@ akeneo: ```yaml akeneo: - enterprise: true loader: type: productModel method: upsert diff --git a/src/Builder/Capacity/Extractor/All.php b/src/Builder/Capacity/Extractor/All.php index c879f42..8698aaa 100644 --- a/src/Builder/Capacity/Extractor/All.php +++ b/src/Builder/Capacity/Extractor/All.php @@ -7,9 +7,6 @@ use Kiboko\Plugin\Akeneo\MissingEndpointException; use PhpParser\Builder; use PhpParser\Node; -use PhpParser\ParserFactory; -use Symfony\Component\ExpressionLanguage\Expression; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; final class All implements Builder { @@ -55,10 +52,8 @@ public function withType(string $type): self public function getNode(): Node { - if ($this->endpoint === null) { - throw new MissingEndpointException( - message: 'Please check your capacity builder, you should have selected an endpoint.' - ); + if (null === $this->endpoint) { + throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } return @@ -83,10 +78,10 @@ public function getNode(): Node ), name: new Node\Identifier('queryParameters'), ), - $this->code !== null ? new Node\Arg( + null !== $this->code ? new Node\Arg( value: $this->code, name: $this->compileCodeNamedArgument($this->type), - ) : null + ) : null, ], ), ), @@ -100,19 +95,19 @@ class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\Acceptance args: [ new Node\Arg( new Node\Expr\Variable('item') - ) + ), ], ), ), - ) - ] + ), + ], ] ); } private function compileSearch(): array { - if ($this->search === null) { + if (null === $this->search) { return []; } diff --git a/src/Builder/Capacity/Extractor/Get.php b/src/Builder/Capacity/Extractor/Get.php index 1611c64..1ce24be 100644 --- a/src/Builder/Capacity/Extractor/Get.php +++ b/src/Builder/Capacity/Extractor/Get.php @@ -35,10 +35,8 @@ public function withIdentifier(?Node\Expr $identifier): self public function getNode(): Node { - if ($this->endpoint === null) { - throw new MissingEndpointException( - message: 'Please check your capacity builder, you should have selected an endpoint.' - ); + if (null === $this->endpoint) { + throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } return new Node\Stmt\Expression( @@ -61,7 +59,7 @@ class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\Acceptance new Node\Arg( value: $this->identifier, name: new Node\Identifier('code'), - ) + ), ], ), ), diff --git a/src/Builder/Capacity/Extractor/ListPerPage.php b/src/Builder/Capacity/Extractor/ListPerPage.php index a4a73fc..9912c38 100644 --- a/src/Builder/Capacity/Extractor/ListPerPage.php +++ b/src/Builder/Capacity/Extractor/ListPerPage.php @@ -7,9 +7,6 @@ use Kiboko\Plugin\Akeneo\MissingEndpointException; use PhpParser\Builder; use PhpParser\Node; -use PhpParser\ParserFactory; -use Symfony\Component\ExpressionLanguage\Expression; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; final class ListPerPage implements Builder { @@ -47,10 +44,8 @@ public function withCode(Node\Expr $code): self public function getNode(): Node { - if ($this->endpoint === null) { - throw new MissingEndpointException( - message: 'Please check your capacity builder, you should have selected an endpoint.' - ); + if (null === $this->endpoint) { + throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } return @@ -75,10 +70,10 @@ public function getNode(): Node ), name: new Node\Identifier('queryParameters'), ), - $this->code !== null ? new Node\Arg( + null !== $this->code ? new Node\Arg( value: $this->code, name: new Node\Identifier('attributeCode'), - ) : null + ) : null, ], ), ), @@ -92,19 +87,19 @@ class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\Acceptance args: [ new Node\Arg( new Node\Expr\Variable('item') - ) + ), ], ), ), - ) - ] + ), + ], ] ); } private function compileSearch(): array { - if ($this->search === null) { + if (null === $this->search) { return []; } diff --git a/src/Builder/Capacity/Loader/Upsert.php b/src/Builder/Capacity/Loader/Upsert.php index 17dd6cc..2147a35 100644 --- a/src/Builder/Capacity/Loader/Upsert.php +++ b/src/Builder/Capacity/Loader/Upsert.php @@ -45,20 +45,14 @@ public function withData(Node\Expr $line): self public function getNode(): Node { - if ($this->endpoint === null) { - throw new MissingEndpointException( - message: 'Please check your capacity builder, you should have selected an endpoint.' - ); + if (null === $this->endpoint) { + throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } - if ($this->code === null) { - throw new MissingParameterException( - message: 'Please check your capacity builder, you should have provided a code.' - ); + if (null === $this->code) { + throw new MissingParameterException(message: 'Please check your capacity builder, you should have provided a code.'); } - if ($this->data === null) { - throw new MissingParameterException( - message: 'Please check your capacity builder, you should have provided some data.' - ); + if (null === $this->data) { + throw new MissingParameterException(message: 'Please check your capacity builder, you should have provided some data.'); } return new Node\Stmt\While_( @@ -111,7 +105,7 @@ public function getNode(): Node ), new Node\Arg( value: $this->code - ) + ), ] ), ), diff --git a/src/Builder/Capacity/Loader/UpsertList.php b/src/Builder/Capacity/Loader/UpsertList.php index 9151115..96fa119 100644 --- a/src/Builder/Capacity/Loader/UpsertList.php +++ b/src/Builder/Capacity/Loader/UpsertList.php @@ -1,4 +1,6 @@ -endpoint === null) { - throw new MissingEndpointException( - message: 'Please check your capacity builder, you should have selected an endpoint.' - ); + if (null === $this->endpoint) { + throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } - if ($this->data === null) { - throw new MissingParameterException( - message: 'Please check your capacity builder, you should have provided some data.' - ); + if (null === $this->data) { + throw new MissingParameterException(message: 'Please check your capacity builder, you should have provided some data.'); } return new Node\Stmt\While_( diff --git a/src/Builder/Capacity/Lookup/All.php b/src/Builder/Capacity/Lookup/All.php index 92e5e56..6e90b8b 100644 --- a/src/Builder/Capacity/Lookup/All.php +++ b/src/Builder/Capacity/Lookup/All.php @@ -1,4 +1,6 @@ -endpoint === null) { - throw new MissingEndpointException( - message: 'Please check your capacity builder, you should have selected an endpoint.' - ); + if (null === $this->endpoint) { + throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } return @@ -70,10 +70,10 @@ public function getNode(): Node ), name: new Node\Identifier('queryParameters'), ), - $this->code !== null ? new Node\Arg( + null !== $this->code ? new Node\Arg( value: $this->code, name: new Node\Identifier('attributeCode'), - ) : null + ) : null, ], ), ), @@ -87,19 +87,19 @@ class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\Acceptance args: [ new Node\Arg( new Node\Expr\Variable('item') - ) + ), ], ), ), - ) - ] + ), + ], ] ); } private function compileSearch(): array { - if ($this->search === null) { + if (null === $this->search) { return []; } diff --git a/src/Builder/Capacity/Lookup/Download.php b/src/Builder/Capacity/Lookup/Download.php index 0da08ce..4387b87 100644 --- a/src/Builder/Capacity/Lookup/Download.php +++ b/src/Builder/Capacity/Lookup/Download.php @@ -36,10 +36,8 @@ public function withFile(Node\Expr $file): self public function getNode(): Node { - if ($this->endpoint === null) { - throw new MissingEndpointException( - message: 'Please check your capacity builder, you should have selected an endpoint.' - ); + if (null === $this->endpoint) { + throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } return (new IsolatedValueAppendingBuilder( @@ -51,9 +49,9 @@ public function getNode(): Node name: new Node\Name('is_null'), args: array_filter( [ - $this->file !== null ? new Node\Arg( + null !== $this->file ? new Node\Arg( value: $this->file, - ) : null + ) : null, ], ), ), @@ -63,7 +61,7 @@ public function getNode(): Node expr: new Node\Expr\ConstFetch( name: new Node\Name(name: 'null'), ), - ) + ), ], ], ), @@ -85,10 +83,10 @@ public function getNode(): Node name: new Node\Identifier('download'), args: array_filter( [ - $this->file !== null ? new Node\Arg( + null !== $this->file ? new Node\Arg( value: $this->file, name: new Node\Identifier('code'), - ) : null + ) : null, ], ), ), @@ -97,7 +95,7 @@ public function getNode(): Node name: new Node\Identifier('getContents'), ), ), - ) + ), ], catches: [ new Node\Stmt\Catch_( @@ -143,10 +141,10 @@ public function getNode(): Node args: [ new Node\Arg( new Node\Expr\Variable('input'), - ) + ), ], ) - ) + ), ], ), ], diff --git a/src/Builder/Capacity/Lookup/Get.php b/src/Builder/Capacity/Lookup/Get.php index f3adaef..b097734 100644 --- a/src/Builder/Capacity/Lookup/Get.php +++ b/src/Builder/Capacity/Lookup/Get.php @@ -1,4 +1,6 @@ -endpoint === null) { - throw new MissingEndpointException( - message: 'Please check your capacity builder, you should have selected an endpoint.' - ); + if (null === $this->endpoint) { + throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } return new Node\Stmt\Expression( expr: new Node\Expr\Assign( var: new Node\Expr\Variable('lookup'), - expr: new Node\Expr\MethodCall( + expr: new Node\Expr\MethodCall( var: new Node\Expr\MethodCall( var: new Node\Expr\PropertyFetch( var: new Node\Expr\Variable('this'), @@ -75,10 +75,10 @@ public function getNode(): Node value: $this->identifier, name: $this->compileIdentifierNamedArgument($this->type), ), - $this->code !== null ? new Node\Arg( + null !== $this->code ? new Node\Arg( value: $this->code, name: $this->compileCodeNamedArgument($this->type), - ) : null + ) : null, ], ), ) diff --git a/src/Builder/Capacity/Lookup/ListPerPage.php b/src/Builder/Capacity/Lookup/ListPerPage.php index aa1f0b8..6c0172b 100644 --- a/src/Builder/Capacity/Lookup/ListPerPage.php +++ b/src/Builder/Capacity/Lookup/ListPerPage.php @@ -1,4 +1,6 @@ -endpoint === null) { - throw new MissingEndpointException( - message: 'Please check your capacity builder, you should have selected an endpoint.' - ); + if (null === $this->endpoint) { + throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } return @@ -70,10 +70,10 @@ public function getNode(): Node ), name: new Node\Identifier('queryParameters'), ), - $this->code !== null ? new Node\Arg( + null !== $this->code ? new Node\Arg( value: $this->code, name: new Node\Identifier('attributeCode'), - ) : null + ) : null, ], ), ), @@ -87,19 +87,19 @@ class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\Acceptance args: [ new Node\Arg( new Node\Expr\Variable('item') - ) + ), ], ), ), - ) - ] + ), + ], ] ); } private function compileSearch(): array { - if ($this->search === null) { + if (null === $this->search) { return []; } diff --git a/src/Builder/Client.php b/src/Builder/Client.php index 5d56762..2782869 100644 --- a/src/Builder/Client.php +++ b/src/Builder/Client.php @@ -1,4 +1,6 @@ -httpClient !== null) { + if (null !== $this->httpClient) { $instance = new Node\Expr\MethodCall( $instance, 'setHttpClient', @@ -95,7 +97,7 @@ public function getNode(): Node\Expr\MethodCall ); } - if ($this->httpRequestFactory !== null) { + if (null !== $this->httpRequestFactory) { $instance = new Node\Expr\MethodCall( $instance, 'setRequestFactory', @@ -105,7 +107,7 @@ public function getNode(): Node\Expr\MethodCall ); } - if ($this->httpStreamFactory !== null) { + if (null !== $this->httpStreamFactory) { $instance = new Node\Expr\MethodCall( $instance, 'setStreamFactory', @@ -115,7 +117,7 @@ public function getNode(): Node\Expr\MethodCall ); } - if ($this->fileSystem !== null) { + if (null !== $this->fileSystem) { $instance = new Node\Expr\MethodCall( $instance, 'setFileSystem', @@ -134,11 +136,11 @@ public function getNode(): Node\Expr\MethodCall private function getFactoryMethod(): string { - if ($this->password !== null) { + if (null !== $this->password) { return 'buildAuthenticatedByPassword'; } - if ($this->refreshToken !== null) { + if (null !== $this->refreshToken) { return 'buildAuthenticatedByToken'; } @@ -147,7 +149,7 @@ private function getFactoryMethod(): string private function getFactoryArguments(): array { - if ($this->password !== null) { + if (null !== $this->password) { return [ $this->clientId, $this->secret, @@ -156,7 +158,7 @@ private function getFactoryArguments(): array ]; } - if ($this->refreshToken !== null) { + if (null !== $this->refreshToken) { return [ $this->clientId, $this->secret, diff --git a/src/Builder/ConditionalLookup.php b/src/Builder/ConditionalLookup.php index b63121d..6c41e3a 100644 --- a/src/Builder/ConditionalLookup.php +++ b/src/Builder/ConditionalLookup.php @@ -74,8 +74,8 @@ private function compileAllAlternatives(): Node ), stmts: array_filter([ new Node\Stmt\Expression( - expr: new Node\Expr\Assign( - var: new Node\Expr\Variable('bucket'), + expr: new Node\Expr\Assign( + var: new Node\Expr\Variable('bucket'), expr: new Node\Expr\New_( new Node\Name\FullyQualified('Kiboko\Component\Bucket\ComplexResultBucket') ) @@ -84,7 +84,7 @@ private function compileAllAlternatives(): Node new Node\Stmt\Expression( new Node\Expr\Assign( var: new Node\Expr\Variable('output'), - expr:new Node\Expr\Variable('input'), + expr: new Node\Expr\Variable('input'), ), ), new Node\Stmt\If_( @@ -94,23 +94,22 @@ private function compileAllAlternatives(): Node ...$this->compileAlternative($alternative), ], 'elseifs' => array_map( - fn (Node\Expr $condition, AlternativeLookup $lookup) - => new Node\Stmt\ElseIf_( + fn (Node\Expr $condition, AlternativeLookup $lookup) => new Node\Stmt\ElseIf_( cond: $condition, stmts: $this->compileAlternative($lookup) ), array_column($alternatives, 0), array_column($alternatives, 1) ), -// 'else' => new Node\Stmt\Else_( -// stmts: [ -// new Node\Stmt\Expression( -// new Node\Expr\Yield_( -// new Node\Expr\Variable('line') -// ), -// ), -// ], -// ), + // 'else' => new Node\Stmt\Else_( + // stmts: [ + // new Node\Stmt\Expression( + // new Node\Expr\Yield_( + // new Node\Expr\Variable('line') + // ), + // ), + // ], + // ), ], ), new Node\Stmt\Expression( @@ -119,7 +118,7 @@ private function compileAllAlternatives(): Node name: new Node\Identifier('accept'), args: [new Node\Arg(new Node\Expr\Variable('output'))] ) - ) + ), ]) ); } @@ -141,7 +140,7 @@ class: new Node\Stmt\Class_( 'params' => [ new Node\Param( var: new Node\Expr\Variable('client'), - type: new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface'), + type: new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface'), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), new Node\Param( @@ -157,7 +156,6 @@ class: new Node\Stmt\Class_( subNodes: [ 'flags' => Node\Stmt\Class_::MODIFIER_PUBLIC, 'params' => [ - ], 'returnType' => new Node\Name\FullyQualified(\Generator::class), 'stmts' => [ diff --git a/src/Builder/Extractor.php b/src/Builder/Extractor.php index f2cfa6a..2a4f2ec 100644 --- a/src/Builder/Extractor.php +++ b/src/Builder/Extractor.php @@ -1,4 +1,6 @@ -mapper->getMapper(); if (!$mapper instanceof CompilableMapperInterface) { - throw new \RuntimeException(strtr( - 'The specified argument is invalid, expected %expected%, got %actual%.', - [ - '%expected%' => CompilableMapperInterface::class, - '%actual%' => get_debug_type($mapper), - ] - )); + throw new \RuntimeException(strtr('The specified argument is invalid, expected %expected%, got %actual%.', ['%expected%' => CompilableMapperInterface::class, '%actual%' => get_debug_type($mapper)])); } $mapper->addContextVariable(new Node\Expr\Variable('lookup')); @@ -40,7 +36,7 @@ public function getNode(): Node [ new Node\Stmt\Return_( new Node\Expr\Variable('output') - ) + ), ] ), new Node\Expr\Variable('lookup'), diff --git a/src/Builder/Loader.php b/src/Builder/Loader.php index 74f2598..a0cc6db 100644 --- a/src/Builder/Loader.php +++ b/src/Builder/Loader.php @@ -1,4 +1,6 @@ -compileAlternative($this->alternative) + ...$this->compileAlternative($this->alternative), ] ), ]), diff --git a/src/Builder/Search.php b/src/Builder/Search.php index 44a6167..a2c8f92 100644 --- a/src/Builder/Search.php +++ b/src/Builder/Search.php @@ -1,4 +1,6 @@ - 0) { + if (\count($options) > 0) { $arguments[] = new Node\Expr\Array_( items: $options, attributes: [ - 'kind' => Node\Expr\Array_::KIND_SHORT + 'kind' => Node\Expr\Array_::KIND_SHORT, ] ); } diff --git a/src/Capacity/CapacityInterface.php b/src/Capacity/CapacityInterface.php index b6ec0ba..613457a 100644 --- a/src/Capacity/CapacityInterface.php +++ b/src/Capacity/CapacityInterface.php @@ -1,4 +1,6 @@ -addFilter( - field: compileValue($this->interpreter, $filter["field"]), - operator: compileValue($this->interpreter, $filter["operator"]), - value: array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter["value"]) : null, - scope: array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter["scope"]) : null, - locale: array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter["locale"]) : null + field: compileValue($this->interpreter, $filter['field']), + operator: compileValue($this->interpreter, $filter['operator']), + value: \array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter['value']) : null, + scope: \array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter['scope']) : null, + locale: \array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter['locale']) : null ); } @@ -84,13 +83,14 @@ public function getBuilder(array $config): Builder { $builder = (new Akeneo\Builder\Capacity\Extractor\All()) ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) - ->withType($config['type']); + ->withType($config['type']) + ; - if (isset($config['search']) && is_array($config['search'])) { + if (isset($config['search']) && \is_array($config['search'])) { $builder->withSearch($this->compileFilters(...$config['search'])); } - if (in_array($config['type'], ['attributeOption', 'assetManager']) && array_key_exists('code', $config)) { + if (\in_array($config['type'], ['attributeOption', 'assetManager']) && \array_key_exists('code', $config)) { $builder->withCode(compileValueWhenExpression($this->interpreter, $config['code'])); } diff --git a/src/Capacity/Extractor/Get.php b/src/Capacity/Extractor/Get.php index 4eb5ce1..516fdc9 100644 --- a/src/Capacity/Extractor/Get.php +++ b/src/Capacity/Extractor/Get.php @@ -4,14 +4,12 @@ namespace Kiboko\Plugin\Akeneo\Capacity\Extractor; +use function Kiboko\Component\SatelliteToolbox\Configuration\compileValueWhenExpression; use Kiboko\Plugin\Akeneo; use PhpParser\Builder; use PhpParser\Node; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use function Kiboko\Component\SatelliteToolbox\Configuration\compileValue; -use function Kiboko\Component\SatelliteToolbox\Configuration\compileValueWhenExpression; - final class Get implements Akeneo\Capacity\CapacityInterface { private static $endpoints = [ @@ -51,15 +49,16 @@ public function __construct(private ExpressionLanguage $interpreter) public function applies(array $config): bool { return isset($config['type']) - && in_array($config['type'], self::$endpoints) + && \in_array($config['type'], self::$endpoints) && isset($config['method']) - && $config['method'] === 'get'; + && 'get' === $config['method']; } public function getBuilder(array $config): Builder { $builder = (new Akeneo\Builder\Capacity\Extractor\Get()) - ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))); + ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) + ; $builder->withIdentifier(compileValueWhenExpression($this->interpreter, $config['identifier'])); diff --git a/src/Capacity/Extractor/ListPerPage.php b/src/Capacity/Extractor/ListPerPage.php index f2c07a8..66ca291 100644 --- a/src/Capacity/Extractor/ListPerPage.php +++ b/src/Capacity/Extractor/ListPerPage.php @@ -1,13 +1,15 @@ -addFilter( - field: compileValue($this->interpreter, $filter["field"]), - operator: compileValue($this->interpreter, $filter["operator"]), - value: array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter["value"]) : null, - scope: array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter["scope"]) : null, - locale: array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter["locale"]) : null + field: compileValue($this->interpreter, $filter['field']), + operator: compileValue($this->interpreter, $filter['operator']), + value: \array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter['value']) : null, + scope: \array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter['scope']) : null, + locale: \array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter['locale']) : null ); } @@ -80,14 +80,15 @@ private function compileFilters(array ...$filters): Node\Expr public function getBuilder(array $config): Builder { $builder = (new Akeneo\Builder\Capacity\Extractor\ListPerPage()) - ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))); + ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) + ; - if (isset($config['search']) && is_array($config['search'])) { + if (isset($config['search']) && \is_array($config['search'])) { $builder->withSearch($this->compileFilters(...$config['search'])); } - if (in_array($config['type'], ['attributeOption']) - && array_key_exists('code', $config) + if (\in_array($config['type'], ['attributeOption']) + && \array_key_exists('code', $config) ) { $builder->withCode(compileValue($this->interpreter, $config['code'])); } diff --git a/src/Capacity/Loader/Upsert.php b/src/Capacity/Loader/Upsert.php index 27c9665..2368d68 100644 --- a/src/Capacity/Loader/Upsert.php +++ b/src/Capacity/Loader/Upsert.php @@ -4,11 +4,11 @@ namespace Kiboko\Plugin\Akeneo\Capacity\Loader; +use function Kiboko\Component\SatelliteToolbox\Configuration\compileValueWhenExpression; use Kiboko\Plugin\Akeneo; use PhpParser\Builder; use PhpParser\Node; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use function Kiboko\Component\SatelliteToolbox\Configuration\compileValueWhenExpression; final class Upsert implements Akeneo\Capacity\CapacityInterface { @@ -51,9 +51,9 @@ public function __construct(private ExpressionLanguage $interpreter) public function applies(array $config): bool { return isset($config['type']) - && in_array($config['type'], self::$endpoints) + && \in_array($config['type'], self::$endpoints) && isset($config['method']) - && $config['method'] === 'upsert'; + && 'upsert' === $config['method']; } public function getBuilder(array $config): Builder @@ -61,6 +61,7 @@ public function getBuilder(array $config): Builder return (new Akeneo\Builder\Capacity\Loader\Upsert()) ->withEndpoint(endpoint: new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) ->withCode(code: compileValueWhenExpression($this->interpreter, $config['code'], 'line')) - ->withData(line: new Node\Expr\Variable('line')); + ->withData(line: new Node\Expr\Variable('line')) + ; } } diff --git a/src/Capacity/Loader/UpsertList.php b/src/Capacity/Loader/UpsertList.php index 5e064c6..c9bc535 100644 --- a/src/Capacity/Loader/UpsertList.php +++ b/src/Capacity/Loader/UpsertList.php @@ -1,12 +1,12 @@ -withEndpoint(endpoint: new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) - ->withData(data: new Node\Expr\Variable('line')); + ->withData(data: new Node\Expr\Variable('line')) + ; } } diff --git a/src/Capacity/Lookup/All.php b/src/Capacity/Lookup/All.php index 393c5a6..4f1d4a5 100644 --- a/src/Capacity/Lookup/All.php +++ b/src/Capacity/Lookup/All.php @@ -1,14 +1,16 @@ -addFilter( - field: compileValue($this->interpreter, $filter["field"]), - operator: compileValue($this->interpreter, $filter["operator"]), - value: array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter["value"]) : null, - scope: array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter["scope"]) : null, - locale: array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter["locale"]) : null + field: compileValue($this->interpreter, $filter['field']), + operator: compileValue($this->interpreter, $filter['operator']), + value: \array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter['value']) : null, + scope: \array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter['scope']) : null, + locale: \array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter['locale']) : null ); } @@ -81,13 +82,14 @@ private function compileFilters(array ...$filters): Node\Expr public function getBuilder(array $config): Builder { $builder = (new Akeneo\Builder\Capacity\Lookup\All()) - ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))); + ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) + ; - if (isset($config['search']) && is_array($config['search'])) { + if (isset($config['search']) && \is_array($config['search'])) { $builder->withSearch($this->compileFilters(...$config['search'])); } - if (in_array($config['type'], ['attributeOption', 'assetManager']) && array_key_exists('code', $config)) { + if (\in_array($config['type'], ['attributeOption', 'assetManager']) && \array_key_exists('code', $config)) { $builder->withCode(compileValueWhenExpression($this->interpreter, $config['code'])); } diff --git a/src/Capacity/Lookup/Download.php b/src/Capacity/Lookup/Download.php index 167ef08..2b6ead5 100644 --- a/src/Capacity/Lookup/Download.php +++ b/src/Capacity/Lookup/Download.php @@ -1,13 +1,15 @@ -withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))); + ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) + ; - if (!array_key_exists('file', $config)) { - throw new Configurator\InvalidConfigurationException( - 'The configuration option "file" should be defined.' - ); + if (!\array_key_exists('file', $config)) { + throw new Configurator\InvalidConfigurationException('The configuration option "file" should be defined.'); } $builder->withFile(compileValue($this->interpreter, $config['file'])); diff --git a/src/Capacity/Lookup/Get.php b/src/Capacity/Lookup/Get.php index 4fceeef..a06fa71 100644 --- a/src/Capacity/Lookup/Get.php +++ b/src/Capacity/Lookup/Get.php @@ -1,14 +1,15 @@ -withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) - ->withType($config['type']); + ->withType($config['type']) + ; $builder->withIdentifier(compileValueWhenExpression($this->interpreter, $config['identifier'])); - if (array_key_exists('code', $config)) { + if (\array_key_exists('code', $config)) { $builder->withCode(compileValueWhenExpression($this->interpreter, $config['code'])); } diff --git a/src/Capacity/Lookup/ListPerPage.php b/src/Capacity/Lookup/ListPerPage.php index c8481d1..924a1e3 100644 --- a/src/Capacity/Lookup/ListPerPage.php +++ b/src/Capacity/Lookup/ListPerPage.php @@ -1,13 +1,15 @@ -addFilter( - field: compileValue($this->interpreter, $filter["field"]), - operator: compileValue($this->interpreter, $filter["operator"]), - value: array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter["value"]) : null, - scope: array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter["scope"]) : null, - locale: array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter["locale"]) : null + field: compileValue($this->interpreter, $filter['field']), + operator: compileValue($this->interpreter, $filter['operator']), + value: \array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter['value']) : null, + scope: \array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter['scope']) : null, + locale: \array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter['locale']) : null ); } @@ -80,14 +80,15 @@ private function compileFilters(array ...$filters): Node\Expr public function getBuilder(array $config): Builder { $builder = (new Akeneo\Builder\Capacity\Lookup\ListPerPage()) - ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))); + ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) + ; - if (isset($config['search']) && is_array($config['search'])) { + if (isset($config['search']) && \is_array($config['search'])) { $builder->withSearch($this->compileFilters(...$config['search'])); } - if (in_array($config['type'], ['attributeOption']) - && array_key_exists('code', $config) + if (\in_array($config['type'], ['attributeOption']) + && \array_key_exists('code', $config) ) { $builder->withCode(compileValue($this->interpreter, $config['code'])); } diff --git a/src/Configuration.php b/src/Configuration.php index e31416b..0680878 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -1,4 +1,6 @@ -getRootNode() ->validate() - ->ifTrue(function (array $value) { - return array_key_exists('extractor', $value) && array_key_exists('loader', $value); - }) + ->ifTrue(fn (array $value) => \array_key_exists('extractor', $value) && \array_key_exists('loader', $value)) ->thenInvalid('Your configuration should either contain the "extractor" or the "loader" key, not both.') ->end() ->children() - ->booleanNode('enterprise')->defaultFalse()->end() ->arrayNode('expression_language') ->scalarPrototype()->end() ->end() diff --git a/src/Configuration/Client.php b/src/Configuration/Client.php index dad5c77..9364448 100644 --- a/src/Configuration/Client.php +++ b/src/Configuration/Client.php @@ -1,11 +1,12 @@ -getRootNode() ->validate() ->ifArray() ->then(function (array $value) { if (isset($value['username']) && !isset($value['password'])) { - throw new Config\Definition\Exception\InvalidConfigurationException( - 'The configuration option "password" should be defined if you use the username authentication method for Akeneo API.' - ); + throw new Config\Definition\Exception\InvalidConfigurationException('The configuration option "password" should be defined if you use the username authentication method for Akeneo API.'); } if (isset($value['token']) && !isset($value['refresh_token'])) { - throw new Config\Definition\Exception\InvalidConfigurationException( - 'The configuration option "refreshToken" should be defined if you use the token authentication method for Akeneo API.' - ); + throw new Config\Definition\Exception\InvalidConfigurationException('The configuration option "refreshToken" should be defined if you use the token authentication method for Akeneo API.'); } - if (isset($value['username']) && isset($value['token']) || - !isset($value['username']) && !isset($value['token']) + if (isset($value['username'], $value['token']) + || !isset($value['username']) && !isset($value['token']) ) { - throw new Config\Definition\Exception\InvalidConfigurationException( - 'You must choose between "username" and "token" as authentication method for Akeneo API, both are mutually exclusive.' - ); + throw new Config\Definition\Exception\InvalidConfigurationException('You must choose between "username" and "token" as authentication method for Akeneo API, both are mutually exclusive.'); } + return $value; }) ->end() @@ -123,7 +119,8 @@ public function getConfigTreeBuilder() ->then(asExpression()) ->end() ->end() - ->end(); + ->end() + ; return $builder; } diff --git a/src/Configuration/Extractor.php b/src/Configuration/Extractor.php index a613fbe..e0d48e4 100644 --- a/src/Configuration/Extractor.php +++ b/src/Configuration/Extractor.php @@ -1,11 +1,13 @@ - [], // no support -// 'assetVariationFile' => [], // no support + // 'assetReferenceFile' => [], // no support + // 'assetVariationFile' => [], // no support 'referenceEntityRecord' => [ 'all', 'get', ], -// 'referenceEntityMediaFile' => [], // no support + // 'referenceEntityMediaFile' => [], // no support 'referenceEntityAttribute' => [ 'all', 'get', @@ -135,7 +137,7 @@ final class Extractor implements PluginConfigurationInterface ], 'assetMediaFiles' => [ 'download', - ] + ], ]; public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder @@ -144,36 +146,32 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder $builder = new Config\Definition\Builder\TreeBuilder('extractor'); - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ $builder->getRootNode() ->validate() ->ifArray() ->then(function (array $item) { - if (!in_array($item['method'], self::$endpoints[$item['type']])) { - throw new \InvalidArgumentException( - sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), \json_encode($item['method'])) - ); + if (!\in_array($item['method'], self::$endpoints[$item['type']])) { + throw new \InvalidArgumentException(sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method']))); } return $item; }) ->end() ->validate() - ->ifTrue(fn ($data) => - array_key_exists('code', $data) - && array_key_exists('type', $data) - && !in_array($data['type'], ['attributeOption', 'referenceEntityRecord', 'assetManager'], true)) + ->ifTrue(fn ($data) => \array_key_exists('code', $data) + && \array_key_exists('type', $data) + && !\in_array($data['type'], ['attributeOption', 'referenceEntityRecord', 'assetManager'], true)) ->thenInvalid('The code option should only be used with the "attributeOption" and "assetManager" endpoints.') ->end() ->validate() - ->ifTrue(fn ($data) => - array_key_exists('file', $data) - && array_key_exists('type', $data) - && !in_array($data['type'], ['productMediaFile', 'assetMediaFiles'], true)) + ->ifTrue(fn ($data) => \array_key_exists('file', $data) + && \array_key_exists('type', $data) + && !\in_array($data['type'], ['productMediaFile', 'assetMediaFiles'], true)) ->thenInvalid('The file option should only be used with the "productMediaFile" endpoint.') ->end() ->validate() - ->ifTrue(fn ($data) => array_key_exists('identifier', $data) && array_key_exists('method', $data) && $data['method'] !== 'get') + ->ifTrue(fn ($data) => \array_key_exists('identifier', $data) && \array_key_exists('method', $data) && 'get' !== $data['method']) ->thenInvalid('The identifier option should only be used with the "get" method.') ->end() ->children() @@ -206,7 +204,8 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder ->end() ->end() ->append($filters->getConfigTreeBuilder()) - ->end(); + ->end() + ; return $builder; } diff --git a/src/Configuration/Loader.php b/src/Configuration/Loader.php index dca8a54..2c80144 100644 --- a/src/Configuration/Loader.php +++ b/src/Configuration/Loader.php @@ -1,11 +1,13 @@ -getRootNode() ->validate() ->ifArray() ->then(function (array $item) { - if (!in_array($item['method'], self::$endpoints[$item['type']])) { - throw new \InvalidArgumentException( - sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), \json_encode($item['method'])) - ); + if (!\in_array($item['method'], self::$endpoints[$item['type']])) { + throw new \InvalidArgumentException(sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method']))); } return $item; @@ -192,7 +192,7 @@ public function getConfigTreeBuilder() ->end() ->validate() ->always(function (array $item) { - if ($item["method"] === 'upsert' && empty($item["code"])) { + if ('upsert' === $item['method'] && empty($item['code'])) { throw new \InvalidArgumentException('Your configuration should contain the "code" field if the "upsert" method is present.'); } @@ -216,7 +216,8 @@ public function getConfigTreeBuilder() ->then(asExpression()) ->end() ->end() - ->end(); + ->end() + ; return $builder; } diff --git a/src/Configuration/Lookup.php b/src/Configuration/Lookup.php index 84e9871..51b2934 100644 --- a/src/Configuration/Lookup.php +++ b/src/Configuration/Lookup.php @@ -1,12 +1,14 @@ - [], // no support -// 'assetVariationFile' => [], // no support + // 'assetReferenceFile' => [], // no support + // 'assetVariationFile' => [], // no support 'referenceEntityRecord' => [ 'all', 'get', ], -// 'referenceEntityMediaFile' => [], // no support + // 'referenceEntityMediaFile' => [], // no support 'referenceEntityAttribute' => [ 'all', 'get', @@ -136,7 +138,7 @@ final class Lookup implements PluginConfigurationInterface ], 'assetMediaFiles' => [ 'download', - ] + ], ]; public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder @@ -145,36 +147,35 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder $builder = new Config\Definition\Builder\TreeBuilder('lookup'); - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ $builder->getRootNode() ->validate() - ->ifTrue(fn ($data) => !array_key_exists('conditional', $data) && is_array($data)) + ->ifTrue(fn ($data) => !\array_key_exists('conditional', $data) && \is_array($data)) ->then(function (array $item) { - if (!in_array($item['method'], self::$endpoints[$item['type']])) { - throw new \InvalidArgumentException( - sprintf('The value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), \json_encode($item['method'])) - ); + if (!\in_array($item['method'], self::$endpoints[$item['type']])) { + throw new \InvalidArgumentException(sprintf('The value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method']))); } return $item; }) ->end() ->validate() - ->ifTrue(fn ($data) => array_key_exists('code', $data) && array_key_exists('type', $data) && !in_array($data['type'], ['attributeOption', 'referenceEntityRecord', 'assetManager'])) + ->ifTrue(fn ($data) => \array_key_exists('code', $data) && \array_key_exists('type', $data) && !\in_array($data['type'], ['attributeOption', 'referenceEntityRecord', 'assetManager'])) ->thenInvalid('The code option should only be used with the "attributeOption", "referenceEntityRecord" and "assetManager" endpoints.') ->end() ->validate() - ->ifTrue(fn ($data) => array_key_exists('file', $data) && array_key_exists('type', $data) && !in_array($data['type'], ['productMediaFile', 'assetMediaFiles'])) + ->ifTrue(fn ($data) => \array_key_exists('file', $data) && \array_key_exists('type', $data) && !\in_array($data['type'], ['productMediaFile', 'assetMediaFiles'])) ->thenInvalid('The file option should only be used with the "productMediaFile" and "assetMediaFiles" endpoints.') ->end() ->validate() - ->ifTrue(fn ($data) => !array_key_exists('conditional', $data) && array_key_exists('identifier', $data) && array_key_exists('method', $data) && !in_array($data['method'], ['get'])) + ->ifTrue(fn ($data) => !\array_key_exists('conditional', $data) && \array_key_exists('identifier', $data) && \array_key_exists('method', $data) && !\in_array($data['method'], ['get'])) ->thenInvalid('The identifier option should only be used with the "get" method.') ->end() ->validate() - ->ifTrue(fn ($data) => array_key_exists('conditional', $data) && is_array($data['conditional']) && count($data['conditional']) <= 0) + ->ifTrue(fn ($data) => \array_key_exists('conditional', $data) && \is_array($data['conditional']) && \count($data['conditional']) <= 0) ->then(function ($data) { unset($data['conditional']); + return $data; }) ->end() @@ -209,7 +210,8 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder ->append((new FastMap\Configuration('merge'))->getConfigTreeBuilder()->getRootNode()) ->append($filters->getConfigTreeBuilder()) ->append($this->getConditionalTreeBuilder()->getRootNode()) - ->end(); + ->end() + ; return $builder; } @@ -220,43 +222,39 @@ private function getConditionalTreeBuilder(): Config\Definition\Builder\TreeBuil $filters = new Search(); - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ $builder->getRootNode() ->cannotBeEmpty() ->requiresAtLeastOneElement() ->validate() - ->ifTrue(fn ($data) => count($data) <= 0) + ->ifTrue(fn ($data) => \count($data) <= 0) ->thenUnset() ->end() ->arrayPrototype() ->validate() ->ifArray() ->then(function (array $item) { - if (!in_array($item['method'], self::$endpoints[$item['type']])) { - throw new \InvalidArgumentException( - sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), \json_encode($item['method'])) - ); + if (!\in_array($item['method'], self::$endpoints[$item['type']])) { + throw new \InvalidArgumentException(sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method']))); } return $item; }) ->end() ->validate() - ->ifTrue(fn ($data) => - array_key_exists('code', $data) - && array_key_exists('type', $data) - && !in_array($data['type'], ['attributeOption', 'referenceEntityRecord', 'assetManager'], true)) + ->ifTrue(fn ($data) => \array_key_exists('code', $data) + && \array_key_exists('type', $data) + && !\in_array($data['type'], ['attributeOption', 'referenceEntityRecord', 'assetManager'], true)) ->thenInvalid('The code option should only be used with the "attributeOption", "referenceEntityRecord" and "assetManager" endpoints.') ->end() ->validate() - ->ifTrue(fn ($data) => - array_key_exists('file', $data) - && array_key_exists('type', $data) - && !in_array($data['type'], ['productMediaFile', 'assetMediaFiles'], true)) + ->ifTrue(fn ($data) => \array_key_exists('file', $data) + && \array_key_exists('type', $data) + && !\in_array($data['type'], ['productMediaFile', 'assetMediaFiles'], true)) ->thenInvalid('The file option should only be used with the "productMediaFile" and "assetMediaFiles" endpoints.') ->end() ->validate() - ->ifTrue(fn ($data) => array_key_exists('identifier', $data) && array_key_exists('method', $data) && $data['method'] !== 'get') + ->ifTrue(fn ($data) => \array_key_exists('identifier', $data) && \array_key_exists('method', $data) && 'get' !== $data['method']) ->thenInvalid('The identifier option should only be used with the "get" method.') ->end() ->children() @@ -297,7 +295,8 @@ private function getConditionalTreeBuilder(): Config\Definition\Builder\TreeBuil ->append((new FastMap\Configuration('merge'))->getConfigTreeBuilder()->getRootNode()) ->append($filters->getConfigTreeBuilder()) ->end() - ->end(); + ->end() + ; return $builder; } diff --git a/src/Configuration/Search.php b/src/Configuration/Search.php index c7b0e95..9e9556f 100644 --- a/src/Configuration/Search.php +++ b/src/Configuration/Search.php @@ -1,10 +1,12 @@ -getRootNode() ->arrayPrototype() ->children() @@ -40,6 +42,7 @@ public function getConfigTreeBuilder() ->end() ->end() ->end() - ->end(); + ->end() + ; } } diff --git a/src/Factory/Client.php b/src/Factory/Client.php index 44ff0d2..8d3b132 100644 --- a/src/Factory/Client.php +++ b/src/Factory/Client.php @@ -1,15 +1,17 @@ -getMessage(), - previous: $exception - ); + throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } } diff --git a/src/Factory/Extractor.php b/src/Factory/Extractor.php index 18ea1e6..b51b40b 100644 --- a/src/Factory/Extractor.php +++ b/src/Factory/Extractor.php @@ -1,9 +1,11 @@ - */ + /** @var iterable */ private iterable $capacities; private ExpressionLanguage $interpreter; @@ -68,9 +70,7 @@ private function findCapacity(array $config): Akeneo\Capacity\CapacityInterface } } - throw new NoApplicableCapacityException( - message: 'No capacity was able to handle the configuration.' - ); + throw new NoApplicableCapacityException(message: 'No capacity was able to handle the configuration.'); } public function compile(array $config): Repository\Extractor @@ -80,19 +80,13 @@ public function compile(array $config): Repository\Extractor $this->findCapacity($config)->getBuilder($config) ); } catch (NoApplicableCapacityException $exception) { - throw new Configurator\InvalidConfigurationException( - message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', - previous: $exception, - ); + throw new Configurator\InvalidConfigurationException(message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', previous: $exception); } try { return new Repository\Extractor($builder); } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { - throw new Configurator\InvalidConfigurationException( - message: $exception->getMessage(), - previous: $exception - ); + throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } } diff --git a/src/Factory/Loader.php b/src/Factory/Loader.php index b54b31f..75852e4 100644 --- a/src/Factory/Loader.php +++ b/src/Factory/Loader.php @@ -1,9 +1,11 @@ - */ + /** @var iterable */ private iterable $capacities; private ExpressionLanguage $interpreter; @@ -67,9 +69,7 @@ private function findCapacity(array $config): Akeneo\Capacity\CapacityInterface } } - throw new NoApplicableCapacityException( - message: 'No capacity was able to handle the configuration.' - ); + throw new NoApplicableCapacityException(message: 'No capacity was able to handle the configuration.'); } public function compile(array $config): Repository\Loader @@ -79,19 +79,13 @@ public function compile(array $config): Repository\Loader $this->findCapacity($config)->getBuilder($config) ); } catch (NoApplicableCapacityException $exception) { - throw new Configurator\InvalidConfigurationException( - message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', - previous: $exception, - ); + throw new Configurator\InvalidConfigurationException(message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', previous: $exception); } try { return new Repository\Loader($builder); } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { - throw new Configurator\InvalidConfigurationException( - message: $exception->getMessage(), - previous: $exception - ); + throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } } diff --git a/src/Factory/Lookup.php b/src/Factory/Lookup.php index e6a5116..fa62d1a 100644 --- a/src/Factory/Lookup.php +++ b/src/Factory/Lookup.php @@ -1,16 +1,18 @@ -interpreter, ); @@ -97,16 +97,13 @@ private function merge(Akeneo\Builder\AlternativeLookup $alternativeBuilder, arr public function compile(array $config): Repository\Lookup { try { - if (!array_key_exists('conditional', $config)) { + if (!\array_key_exists('conditional', $config)) { try { $alternativeBuilder = new Akeneo\Builder\AlternativeLookup($this->findCapacity($config)->getBuilder($config)); $builder = new Akeneo\Builder\Lookup($alternativeBuilder); $repository = new Repository\Lookup($builder); } catch (NoApplicableCapacityException $exception) { - throw new Configurator\InvalidConfigurationException( - message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', - previous: $exception, - ); + throw new Configurator\InvalidConfigurationException(message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', previous: $exception); } $this->merge($alternativeBuilder, $config); @@ -115,16 +112,12 @@ public function compile(array $config): Repository\Lookup $repository = new Repository\Lookup($builder); foreach ($config['conditional'] as $alternative) { - try { $alternativeBuilder = new Akeneo\Builder\AlternativeLookup( $this->findCapacity($alternative)->getBuilder($alternative) ); } catch (NoApplicableCapacityException $exception) { - throw new Configurator\InvalidConfigurationException( - message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', - previous: $exception, - ); + throw new Configurator\InvalidConfigurationException(message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', previous: $exception); } $builder->addAlternative( @@ -138,10 +131,7 @@ public function compile(array $config): Repository\Lookup return $repository; } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { - throw new Configurator\InvalidConfigurationException( - message: $exception->getMessage(), - previous: $exception - ); + throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } } diff --git a/src/Factory/NoApplicableCapacityException.php b/src/Factory/NoApplicableCapacityException.php index 28eb988..779c4c4 100644 --- a/src/Factory/NoApplicableCapacityException.php +++ b/src/Factory/NoApplicableCapacityException.php @@ -1,4 +1,6 @@ -getMessage(), - previous: $exception - ); + throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } } diff --git a/src/MissingAuthenticationMethodException.php b/src/MissingAuthenticationMethodException.php index b0124eb..58d3fd6 100644 --- a/src/MissingAuthenticationMethodException.php +++ b/src/MissingAuthenticationMethodException.php @@ -1,4 +1,6 @@ -interpreter; - if (array_key_exists('expression_language', $config) - && is_array($config['expression_language']) - && count($config['expression_language']) + if (\array_key_exists('expression_language', $config) + && \is_array($config['expression_language']) + && \count($config['expression_language']) ) { foreach ($config['expression_language'] as $provider) { - $interpreter->registerProvider(new $provider); + $interpreter->registerProvider(new $provider()); } } $clientFactory = new Factory\Client($interpreter); try { - if (array_key_exists('extractor', $config)) { + if (\array_key_exists('extractor', $config)) { $extractorFactory = new Factory\Extractor($interpreter); $extractor = $extractorFactory->compile($config['extractor']); @@ -95,13 +96,16 @@ public function compile(array $config): Factory\Repository\Extractor|Factory\Rep $client = $clientFactory->compile($config['client']); $extractorBuilder - ->withClient($client->getBuilder()->getNode()); + ->withClient($client->getBuilder()->getNode()) + ; $extractor - ->merge($client); + ->merge($client) + ; return $extractor; - } elseif (array_key_exists('loader', $config)) { + } + if (\array_key_exists('loader', $config)) { $loaderFactory = new Factory\Loader($interpreter); $loader = $loaderFactory->compile($config['loader']); @@ -110,13 +114,16 @@ public function compile(array $config): Factory\Repository\Extractor|Factory\Rep $client = $clientFactory->compile($config['client']); $loaderBuilder - ->withClient($client->getBuilder()->getNode()); + ->withClient($client->getBuilder()->getNode()) + ; $loader - ->merge($client); + ->merge($client) + ; return $loader; - } elseif (array_key_exists('lookup', $config)) { + } + if (\array_key_exists('lookup', $config)) { $lookupFactory = new Factory\Lookup($interpreter); $lookup = $lookupFactory->compile($config['lookup']); @@ -125,22 +132,18 @@ public function compile(array $config): Factory\Repository\Extractor|Factory\Rep $client = $clientFactory->compile($config['client']); $lookupBuilder - ->withClient($client->getBuilder()->getNode()); + ->withClient($client->getBuilder()->getNode()) + ; $lookup - ->merge($client); + ->merge($client) + ; return $lookup; - } else { - throw new Configurator\InvalidConfigurationException( - 'Could not determine if the factory should build an extractor or a loader.' - ); } + throw new Configurator\InvalidConfigurationException('Could not determine if the factory should build an extractor or a loader.'); } catch (MissingAuthenticationMethodException $exception) { - throw new Configurator\InvalidConfigurationException( - 'Your Akeneo API configuration is missing an authentication method, you should either define "username" or "token" options.', - previous: $exception, - ); + throw new Configurator\InvalidConfigurationException('Your Akeneo API configuration is missing an authentication method, you should either define "username" or "token" options.', previous: $exception); } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), previous: $exception); } diff --git a/tests/functional/Builder/ClientTest.php b/tests/functional/Builder/ClientTest.php index 665f816..d71680e 100644 --- a/tests/functional/Builder/ClientTest.php +++ b/tests/functional/Builder/ClientTest.php @@ -3,7 +3,6 @@ namespace functional\Kiboko\Plugin\Akeneo\Builder; use Akeneo\Pim\ApiClient\AkeneoPimClientInterface; -use Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientInterface; use functional\Kiboko\Plugin\Akeneo\Mock\ResponseFactory; use Http\Mock\Client; use Kiboko\Plugin\Akeneo\Builder; @@ -57,22 +56,4 @@ public function testWithToken(): void $this->assertNodeIsInstanceOf(AkeneoPimClientInterface::class, $client); } - - public function testWithTokenForEnterprise(): void - { - $client = new Builder\Client( - new Node\Scalar\String_('http://demo.akeneo.com'), - new Node\Scalar\String_(''), - new Node\Scalar\String_(''), - ); - - $client->withToken( - new Node\Scalar\String_(''), - new Node\Scalar\String_(''), - ); - - $client->withHttpClient($this->getClientNode()); - - $this->assertNodeIsInstanceOf(AkeneoPimClientInterface::class, $client); - } } diff --git a/tests/functional/ServiceTest.php b/tests/functional/ServiceTest.php index dfd396c..449845b 100644 --- a/tests/functional/ServiceTest.php +++ b/tests/functional/ServiceTest.php @@ -14,7 +14,6 @@ public function configProvider(): \Generator /** Get */ yield [ 'expected' => [ - 'enterprise' => true, 'expression_language' => [], 'extractor' => [ 'type' => 'product', @@ -33,7 +32,6 @@ public function configProvider(): \Generator 'expected_class' => 'Kiboko\\Plugin\\Akeneo\\Factory\\Repository\\Extractor', 'actual' => [ [ - 'enterprise' => true, 'extractor' => [ 'type' => 'product', 'method' => 'get', @@ -53,7 +51,6 @@ public function configProvider(): \Generator /** Upsert */ yield [ 'expected' => [ - 'enterprise' => false, 'expression_language' => [], 'loader' => [ 'type' => 'product', @@ -71,7 +68,6 @@ public function configProvider(): \Generator 'expected_class' => 'Kiboko\\Plugin\\Akeneo\\Factory\\Repository\\Loader', 'actual' => [ [ - 'enterprise' => false, 'expression_language' => [], 'loader' => [ 'type' => 'product', @@ -121,7 +117,6 @@ public function testMissingAuthentication(): void $service = new Akeneo\Service(); $service->compile([ - 'enterprise' => false, 'loader' => [ 'type' => 'product', 'method' => 'upsert', From 11490efa0ce74e6bcc9b9d85325b7103a5ffaf51 Mon Sep 17 00:00:00 2001 From: clemzarch Date: Wed, 1 Jun 2022 17:43:52 +0200 Subject: [PATCH 10/19] remove a catch that could never be triggered, add more tests to catch exceptions when building the capacities --- src/Factory/Client.php | 2 - src/Factory/Extractor.php | 2 - src/Factory/Loader.php | 2 - src/Factory/Lookup.php | 2 - src/Factory/Search.php | 2 +- .../Builder/Capacity/Extractor/AllTest.php | 9 -- .../functional/Capacity/Extractor/AllTest.php | 13 ++- tests/functional/Capacity/Lookup/AllTest.php | 86 +++++++++++++++++++ .../Capacity/Lookup/ListPerPageTest.php | 73 ++++++++++++++++ .../Configuration/ExtractorTest.php | 34 ++++++++ tests/functional/Configuration/LoaderTest.php | 55 ++++++++++++ tests/functional/Factory/ClientTest.php | 19 ++-- tests/functional/Factory/ExtractorTest.php | 76 ++++++++-------- tests/functional/Factory/LoaderTest.php | 76 ++++++++-------- tests/functional/Factory/LookupTest.php | 85 +++++++++--------- tests/functional/ServiceTest.php | 1 + 16 files changed, 394 insertions(+), 143 deletions(-) create mode 100644 tests/functional/Capacity/Lookup/AllTest.php create mode 100644 tests/functional/Capacity/Lookup/ListPerPageTest.php create mode 100644 tests/functional/Configuration/LoaderTest.php diff --git a/src/Factory/Client.php b/src/Factory/Client.php index 8d3b132..fa80cde 100644 --- a/src/Factory/Client.php +++ b/src/Factory/Client.php @@ -49,8 +49,6 @@ public function validate(array $config): bool return true; } catch (Configurator\InvalidConfigurationException) { return false; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { - return false; } } diff --git a/src/Factory/Extractor.php b/src/Factory/Extractor.php index b51b40b..64f4d51 100644 --- a/src/Factory/Extractor.php +++ b/src/Factory/Extractor.php @@ -57,8 +57,6 @@ public function validate(array $config): bool return true; } catch (Configurator\InvalidConfigurationException) { return false; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { - return false; } } diff --git a/src/Factory/Loader.php b/src/Factory/Loader.php index 75852e4..7e19bff 100644 --- a/src/Factory/Loader.php +++ b/src/Factory/Loader.php @@ -56,8 +56,6 @@ public function validate(array $config): bool return true; } catch (Configurator\InvalidConfigurationException) { return false; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { - return false; } } diff --git a/src/Factory/Lookup.php b/src/Factory/Lookup.php index fa62d1a..7f2394b 100644 --- a/src/Factory/Lookup.php +++ b/src/Factory/Lookup.php @@ -61,8 +61,6 @@ public function validate(array $config): bool return true; } catch (Configurator\InvalidConfigurationException) { return false; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { - return false; } } diff --git a/src/Factory/Search.php b/src/Factory/Search.php index 08f732f..35594ae 100644 --- a/src/Factory/Search.php +++ b/src/Factory/Search.php @@ -44,7 +44,7 @@ public function validate(array $config): bool $this->normalize($config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Configurator\InvalidConfigurationException) { return false; } } diff --git a/tests/functional/Builder/Capacity/Extractor/AllTest.php b/tests/functional/Builder/Capacity/Extractor/AllTest.php index 4728cea..9e9946d 100644 --- a/tests/functional/Builder/Capacity/Extractor/AllTest.php +++ b/tests/functional/Builder/Capacity/Extractor/AllTest.php @@ -20,13 +20,4 @@ public function testWithoutEndpoint() $capacity->getNode(); } - - public function testWithEndpoint() - { - $capacity = new All(); - - $capacity->withEndpoint(new Node\Identifier('foo')); - - $this->assertInstanceOf(Node\Stmt\Foreach_::class, $capacity->getNode()); - } } diff --git a/tests/functional/Capacity/Extractor/AllTest.php b/tests/functional/Capacity/Extractor/AllTest.php index 83a457f..d3e22e5 100644 --- a/tests/functional/Capacity/Extractor/AllTest.php +++ b/tests/functional/Capacity/Extractor/AllTest.php @@ -40,6 +40,18 @@ public function wrongConfigs(): \Generator public function goodConfigs(): \Generator { + yield [ + 'config' => [ + 'type' => 'attributeOption', + 'code' => 'something', + ], + ]; + yield [ + 'config' => [ + 'type' => 'attributeOption', + ], + ]; + yield [ 'config' => [ 'type' => 'product', @@ -83,5 +95,4 @@ public function testGoodConfigs(array $config): void (new Capacity\Extractor\All(new ExpressionLanguage()))->getBuilder($config) ); } - } diff --git a/tests/functional/Capacity/Lookup/AllTest.php b/tests/functional/Capacity/Lookup/AllTest.php new file mode 100644 index 0000000..79e23ea --- /dev/null +++ b/tests/functional/Capacity/Lookup/AllTest.php @@ -0,0 +1,86 @@ + [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => 'EMPTY', + 'value' => 'bar' + ] + ] + ], + 'expected_message' => 'You should not provide a value for the EMPTY operator' + ]; + + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => '=', + 'field' => 'foo' + ] + ] + ], + 'expected_message' => 'You should provide a value for the = operator' + ]; + } + + public function goodConfigs(): \Generator + { + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => 'EMPTY', + 'field' => 'foo', + ] + ] + ] + ]; + + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => '=', + 'value' => 'bar', + 'field' => 'foo', + ] + ] + ] + ]; + } + + /** @dataProvider wrongConfigs */ + public function testWrongConfigs(array $config, string $expected_message): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionMessage($expected_message); + + (new Capacity\Lookup\All(new ExpressionLanguage()))->getBuilder($config); + } + + /** @dataProvider goodConfigs */ + public function testGoodConfigs(array $config): void + { + $this->assertInstanceOf( + 'PhpParser\Builder', + (new Capacity\Lookup\All(new ExpressionLanguage()))->getBuilder($config) + ); + } +} diff --git a/tests/functional/Capacity/Lookup/ListPerPageTest.php b/tests/functional/Capacity/Lookup/ListPerPageTest.php new file mode 100644 index 0000000..0207f88 --- /dev/null +++ b/tests/functional/Capacity/Lookup/ListPerPageTest.php @@ -0,0 +1,73 @@ + [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => 'EMPTY', + 'value' => 'bar' + ] + ] + ], + 'expected_message' => 'You should not provide a value for the EMPTY operator' + ]; + + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => '=', + 'field' => 'foo' + ] + ] + ], + 'expected_message' => 'You should provide a value for the = operator' + ]; + } + + public function goodConfigs(): \Generator + { + yield [ + 'config' => [ + 'type' => 'product', + 'search' => [ + [ + 'operator' => 'EMPTY', + 'field' => 'foo', + ] + ] + ] + ]; + } + + /** @dataProvider wrongConfigs */ + public function testWrongConfigs(array $config, string $expected_message): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionMessage($expected_message); + + (new Capacity\Lookup\ListPerPage(new ExpressionLanguage()))->getBuilder($config); + } + + /** @dataProvider goodConfigs */ + public function testGoodConfigs(array $config): void + { + $this->assertInstanceOf( + 'PhpParser\Builder', + (new Capacity\Lookup\ListPerPage(new ExpressionLanguage()))->getBuilder($config) + ); + } +} diff --git a/tests/functional/Configuration/ExtractorTest.php b/tests/functional/Configuration/ExtractorTest.php index a114da1..24afd19 100644 --- a/tests/functional/Configuration/ExtractorTest.php +++ b/tests/functional/Configuration/ExtractorTest.php @@ -68,6 +68,20 @@ public function validDataProvider(): iterable 'search' => [], ], ]; + yield [ + 'config' => [ + 'method' => 'get', + 'type' => 'attributeOption', + 'code' => '123', + 'search' => [], + ], + 'expected' => [ + 'method' => 'get', + 'type' => 'attributeOption', + 'code' => '123', + 'search' => [], + ], + ]; } /** @dataProvider validDataProvider */ @@ -97,6 +111,26 @@ public function testInvalidMethodTypeConfig() ]); } + public function testUnexpectedCodeOptionConfig() + { + $client = new Configuration\Extractor(); + + $this->expectException( + Config\Definition\Exception\InvalidConfigurationException::class, + ); + $this->expectExceptionMessage( + 'The code option should only be used with the "attributeOption" and "assetManager" endpoints.', + ); + + $this->processor->processConfiguration($client, [ + [ + 'method' => 'get', + 'type' => 'product', + 'code' => '123', + ] + ]); + } + public function testUnexpectedProductMediaFileFieldConfig() { $client = new Configuration\Extractor(); diff --git a/tests/functional/Configuration/LoaderTest.php b/tests/functional/Configuration/LoaderTest.php new file mode 100644 index 0000000..18ada18 --- /dev/null +++ b/tests/functional/Configuration/LoaderTest.php @@ -0,0 +1,55 @@ +processor = new Config\Definition\Processor(); + } + + public function testInvalidMethodTypeConfig() + { + $client = new Configuration\Loader(); + + $this->expectException( + Config\Definition\Exception\InvalidConfigurationException::class, + ); + $this->expectExceptionMessage( + 'Invalid configuration for path "loader": the value should be one of [create, upsert, upsertList, delete], got "invalidValue"', + ); + + $this->processor->processConfiguration($client, [ + [ + 'type' => 'product', + 'method' => 'invalidValue' + ] + ]); + } + + public function testUpsertMissingCode() + { + $client = new Configuration\Loader(); + + $this->expectException( + Config\Definition\Exception\InvalidConfigurationException::class, + ); + $this->expectExceptionMessage( + 'Your configuration should contain the "code" field if the "upsert" method is present.', + ); + + $this->processor->processConfiguration($client, [ + [ + 'type' => 'product', + 'method' => 'upsert' + ] + ]); + } +} diff --git a/tests/functional/Factory/ClientTest.php b/tests/functional/Factory/ClientTest.php index d77b26d..e330a0c 100644 --- a/tests/functional/Factory/ClientTest.php +++ b/tests/functional/Factory/ClientTest.php @@ -9,19 +9,26 @@ final class ClientTest extends TestCase { - public function testNormalizeEmptyConfiguration() + public function testMissingCapacity() { - $this->expectException( - InvalidConfigurationException::class, - ); + $this->expectException(InvalidConfigurationException::class); $client = new Client(new ExpressionLanguage()); + $this->assertFalse($client->validate([])); $client->normalize([]); } - public function testValidateEmptyConfiguration() + public function testValidateConfiguration() { $client = new Client(new ExpressionLanguage()); - $this->assertFalse($client->validate([])); + $this->assertTrue($client->validate([ + 'client' => [ + 'api_url' => '123', + 'client_id' => '123', + 'secret' => '123', + 'username' => '123', + 'password' => '123', + ] + ])); } } diff --git a/tests/functional/Factory/ExtractorTest.php b/tests/functional/Factory/ExtractorTest.php index 6cf6231..a9e2045 100644 --- a/tests/functional/Factory/ExtractorTest.php +++ b/tests/functional/Factory/ExtractorTest.php @@ -9,56 +9,56 @@ final class ExtractorTest extends TestCase { - public function testNormalizeEmptyConfiguration() + public function testValidateConfiguration() { - $this->expectException( - InvalidConfigurationException::class, - ); - - $client = new Extractor(new ExpressionLanguage()); - $client->normalize([]); - } - - public function testValidateEmptyConfiguration() - { - $client = new Extractor(new ExpressionLanguage()); - $this->assertFalse($client->validate([])); - } - - public function testMissingType(): void - { - $this->expectException(InvalidConfigurationException::class); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); - $client = new Extractor(new ExpressionLanguage()); - $this->assertFalse($client->validate(['wrong'])); - $client->compile(['wrong']); + $this->assertTrue($client->validate([ + [ + 'type' => 'product', + 'method' => 'all', + ] + ])); } - public function testTypeNotFound(): void + public function wrongConfigs(): \Generator { - $this->expectException(InvalidConfigurationException::class); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); - - $client = new Extractor(new ExpressionLanguage()); - $client->compile([ - 'type' => 'wrong', - 'method' => 'all', - ]); + yield [ + 'config' => [ + ] + ]; + yield [ + 'config' => [ + 'wrong', + ] + ]; + yield [ + 'config' => [ + 'type' => 'wrong', + 'method' => 'all', + ] + ]; + yield [ + 'config' => [ + 'type' => 'product', + 'method' => 'wrong', + ] + ]; + yield [ + 'config' => [ + 'type' => 'product', + ] + ]; } - public function testCapacityNotFound(): void + /** @dataProvider wrongConfigs */ + public function testMissingCapacity(array $config): void { $this->expectException(InvalidConfigurationException::class); $this->expectExceptionCode(0); $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); $client = new Extractor(new ExpressionLanguage()); - $client->compile([ - 'type' => 'product', - 'method' => 'wrong', - ]); + $this->assertFalse($client->validate($config)); + $client->compile($config); } } diff --git a/tests/functional/Factory/LoaderTest.php b/tests/functional/Factory/LoaderTest.php index 2e63987..e132d9a 100644 --- a/tests/functional/Factory/LoaderTest.php +++ b/tests/functional/Factory/LoaderTest.php @@ -9,56 +9,56 @@ final class LoaderTest extends TestCase { - public function testNormalizeEmptyConfiguration() + public function testValidateConfiguration() { - $this->expectException( - InvalidConfigurationException::class, - ); - - $client = new Loader(new ExpressionLanguage()); - $client->normalize([]); - } - - public function testValidateEmptyConfiguration() - { - $client = new Loader(new ExpressionLanguage()); - $this->assertFalse($client->validate([])); - } - - public function testMissingType(): void - { - $this->expectException(InvalidConfigurationException::class); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); - $client = new Loader(new ExpressionLanguage()); - $this->assertFalse($client->validate(['wrong'])); - $client->compile(['wrong']); + $this->assertTrue($client->validate([ + [ + 'type' => 'product', + 'method' => 'create', + ] + ])); } - public function testTypeNotFound(): void + public function wrongConfigs(): \Generator { - $this->expectException(InvalidConfigurationException::class); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); - - $client = new Loader(new ExpressionLanguage()); - $client->compile([ - 'type' => 'wrong', - 'method' => 'upsert', - ]); + yield [ + 'config' => [ + ] + ]; + yield [ + 'config' => [ + 'wrong', + ] + ]; + yield [ + 'config' => [ + 'type' => 'wrong', + 'method' => 'upsert', + ] + ]; + yield [ + 'config' => [ + 'type' => 'product', + 'method' => 'wrong', + ] + ]; + yield [ + 'config' => [ + 'type' => 'product', + ] + ]; } - public function testCapacityNotFound(): void + /** @dataProvider wrongConfigs */ + public function testMissingCapacity(array $config): void { $this->expectException(InvalidConfigurationException::class); $this->expectExceptionCode(0); $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); $client = new Loader(new ExpressionLanguage()); - $client->compile([ - 'type' => 'product', - 'method' => 'wrong', - ]); + $this->assertFalse($client->validate($config)); + $client->compile($config); } } diff --git a/tests/functional/Factory/LookupTest.php b/tests/functional/Factory/LookupTest.php index 813829f..da99211 100644 --- a/tests/functional/Factory/LookupTest.php +++ b/tests/functional/Factory/LookupTest.php @@ -9,62 +9,63 @@ final class LookupTest extends TestCase { - public function testNormalizeEmptyConfiguration() - { - $this->expectException( - InvalidConfigurationException::class, - ); - - $client = new Lookup(new ExpressionLanguage()); - $client->normalize([ - 'condition' => [], - 'type' => 'product', - ]); - } - - public function testValidateEmptyConfiguration() + public function testValidateConfiguration() { $client = new Lookup(new ExpressionLanguage()); - $this->assertFalse($client->validate([ - 'condition' => [], - 'type' => 'product', + $this->assertTrue($client->validate([ + [ + 'type' => 'product', + 'method' => 'all', + ] ])); - } - - public function testMissingType(): void - { - $this->expectException(InvalidConfigurationException::class); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); - - $client = new Lookup(new ExpressionLanguage()); - $this->assertFalse($client->validate(['wrong'])); - $client->compile(['wrong']); - } - - public function testTypeNotFound(): void - { - $this->expectException(InvalidConfigurationException::class); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); - $client = new Lookup(new ExpressionLanguage()); $client->compile([ - 'type' => 'wrong', + 'type' => 'product', 'method' => 'all', ]); } - public function testCapacityNotFound(): void + public function wrongConfigs(): \Generator + { + yield [ + 'config' => [ + 'type' => 'product', + 'condition' => [], + ] + ]; + yield [ + 'config' => [ + 'wrong', + ] + ]; + yield [ + 'config' => [ + 'type' => 'wrong', + 'method' => 'all', + ] + ]; + yield [ + 'config' => [ + 'type' => 'product', + 'method' => 'wrong', + ] + ]; + yield [ + 'config' => [ + 'type' => 'product', + ] + ]; + } + + /** @dataProvider wrongConfigs */ + public function testMissingCapacity(array $config): void { $this->expectException(InvalidConfigurationException::class); $this->expectExceptionCode(0); $this->expectExceptionMessage('Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.'); $client = new Lookup(new ExpressionLanguage()); - $client->compile([ - 'type' => 'product', - 'method' => 'wrong', - ]); + $this->assertFalse($client->validate($config)); + $client->compile($config); } } diff --git a/tests/functional/ServiceTest.php b/tests/functional/ServiceTest.php index 449845b..6585c66 100644 --- a/tests/functional/ServiceTest.php +++ b/tests/functional/ServiceTest.php @@ -106,6 +106,7 @@ public function testWrongConfiguration(): void $this->expectExceptionMessage('Invalid type for path "akeneo". Expected "array", but got "string"'); $service = new Akeneo\Service(); + $this->assertFalse($service->validate(['akeneo' => 'wrong'])); $service->normalize(['akeneo' => 'wrong']); } From e76e0b28c4200f1719f7306001900193fe8c9ec8 Mon Sep 17 00:00:00 2001 From: clemzarch Date: Thu, 2 Jun 2022 11:51:46 +0200 Subject: [PATCH 11/19] add a test for the Download capacity --- src/Builder/AlternativeLookup.php | 13 +- src/Builder/Capacity/Lookup/Get.php | 4 +- .../ConditionalLookupTest.php | 2 +- .../functional/Builder/Lookup/LookupTest.php | 4 +- .../functional/Capacity/Extractor/AllTest.php | 6 +- .../Capacity/Extractor/ListPerPageTest.php | 6 +- tests/functional/Capacity/Lookup/AllTest.php | 6 +- .../Capacity/Lookup/DownloadTest.php | 31 ++++ .../Capacity/Lookup/ListPerPageTest.php | 6 +- tests/functional/Configuration/LookupTest.php | 161 ++++++++++++++++-- tests/functional/Factory/LookupTest.php | 13 ++ tests/functional/ServiceTest.php | 4 +- 12 files changed, 221 insertions(+), 35 deletions(-) create mode 100644 tests/functional/Capacity/Lookup/DownloadTest.php diff --git a/src/Builder/AlternativeLookup.php b/src/Builder/AlternativeLookup.php index 4c0ee61..6529835 100644 --- a/src/Builder/AlternativeLookup.php +++ b/src/Builder/AlternativeLookup.php @@ -10,14 +10,21 @@ final class AlternativeLookup implements Builder { + private ?Builder $capacity; private ?Builder $merge; - public function __construct( - private Builder $capacity, - ) { + public function __construct() { + $this->capacity = null; $this->merge = null; } + public function withCapacity(Builder $capacity): self + { + $this->capacity = $capacity; + + return $this; + } + public function withMerge(Builder $merge): self { $this->merge = $merge; diff --git a/src/Builder/Capacity/Lookup/Get.php b/src/Builder/Capacity/Lookup/Get.php index 8b42df6..6afc731 100644 --- a/src/Builder/Capacity/Lookup/Get.php +++ b/src/Builder/Capacity/Lookup/Get.php @@ -148,7 +148,7 @@ public function getNode(): Node ); } - private function compileCodeNamedArgument(string $type): Node\Identifier + private function compileCodeNamedArgument(?string $type): Node\Identifier { return match ($type) { 'referenceEntityRecord' => new Node\Identifier('referenceEntityCode'), @@ -157,7 +157,7 @@ private function compileCodeNamedArgument(string $type): Node\Identifier }; } - private function compileIdentifierNamedArgument(string $type): Node\Identifier + private function compileIdentifierNamedArgument(?string $type): Node\Identifier { return match ($type) { 'referenceEntityRecord' => new Node\Identifier('recordCode'), diff --git a/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php b/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php index cdab8ac..dfbf56a 100644 --- a/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php +++ b/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php @@ -46,7 +46,7 @@ public function testLookupProduct() $builder->withClient($client->getNode()); $builder->addAlternative( condition: new Node\Expr\Isset_([new Node\Expr\Variable('output')]), - lookup: new AlternativeLookup($capacity) + lookup: (new AlternativeLookup())->withCapacity($capacity) ); $this->assertBuildsTransformerTransformsLike( diff --git a/tests/functional/Builder/Lookup/LookupTest.php b/tests/functional/Builder/Lookup/LookupTest.php index 01f74b8..7681678 100644 --- a/tests/functional/Builder/Lookup/LookupTest.php +++ b/tests/functional/Builder/Lookup/LookupTest.php @@ -42,7 +42,7 @@ public function testLookupProduct() ->withEndpoint(new Node\Identifier('getProductApi')) ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); - $builder = new Lookup(new AlternativeLookup($capacity)); + $builder = new Lookup((new AlternativeLookup())->withCapacity($capacity)); $builder->withClient($client->getNode()); $this->assertBuildsTransformerTransformsLike( @@ -88,7 +88,7 @@ public function testConditionalLookupProduct() ->withEndpoint(new Node\Identifier('getProductApi')) ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); - $builder = new Lookup(new AlternativeLookup($capacity)); + $builder = new Lookup((new AlternativeLookup())->withCapacity($capacity)); $builder->withClient($client->getNode()); $this->assertBuildsTransformerTransformsLike( diff --git a/tests/functional/Capacity/Extractor/AllTest.php b/tests/functional/Capacity/Extractor/AllTest.php index d3e22e5..c55f0f1 100644 --- a/tests/functional/Capacity/Extractor/AllTest.php +++ b/tests/functional/Capacity/Extractor/AllTest.php @@ -38,7 +38,7 @@ public function wrongConfigs(): \Generator ]; } - public function goodConfigs(): \Generator + public function validConfigs(): \Generator { yield [ 'config' => [ @@ -87,8 +87,8 @@ public function testWrongConfigs(array $config, string $expected_message): void (new Capacity\Extractor\All(new ExpressionLanguage()))->getBuilder($config); } - /** @dataProvider goodConfigs */ - public function testGoodConfigs(array $config): void + /** @dataProvider validConfigs */ + public function testValidConfigs(array $config): void { $this->assertInstanceOf( 'PhpParser\Builder', diff --git a/tests/functional/Capacity/Extractor/ListPerPageTest.php b/tests/functional/Capacity/Extractor/ListPerPageTest.php index a88ccec..8270715 100644 --- a/tests/functional/Capacity/Extractor/ListPerPageTest.php +++ b/tests/functional/Capacity/Extractor/ListPerPageTest.php @@ -38,7 +38,7 @@ public function wrongConfigs(): \Generator ]; } - public function goodConfigs(): \Generator + public function validConfigs(): \Generator { yield [ 'config' => [ @@ -75,8 +75,8 @@ public function testWrongConfigs(array $config, string $expected_message): void (new Capacity\Extractor\ListPerPage(new ExpressionLanguage()))->getBuilder($config); } - /** @dataProvider goodConfigs */ - public function testGoodConfigs(array $config): void + /** @dataProvider validConfigs */ + public function testValidConfigs(array $config): void { $this->assertInstanceOf( 'PhpParser\Builder', diff --git a/tests/functional/Capacity/Lookup/AllTest.php b/tests/functional/Capacity/Lookup/AllTest.php index 79e23ea..21e29d2 100644 --- a/tests/functional/Capacity/Lookup/AllTest.php +++ b/tests/functional/Capacity/Lookup/AllTest.php @@ -38,7 +38,7 @@ public function wrongConfigs(): \Generator ]; } - public function goodConfigs(): \Generator + public function validConfigs(): \Generator { yield [ 'config' => [ @@ -75,8 +75,8 @@ public function testWrongConfigs(array $config, string $expected_message): void (new Capacity\Lookup\All(new ExpressionLanguage()))->getBuilder($config); } - /** @dataProvider goodConfigs */ - public function testGoodConfigs(array $config): void + /** @dataProvider validConfigs */ + public function testValidConfigs(array $config): void { $this->assertInstanceOf( 'PhpParser\Builder', diff --git a/tests/functional/Capacity/Lookup/DownloadTest.php b/tests/functional/Capacity/Lookup/DownloadTest.php new file mode 100644 index 0000000..7527344 --- /dev/null +++ b/tests/functional/Capacity/Lookup/DownloadTest.php @@ -0,0 +1,31 @@ + [ + 'type' => 'asset', + 'method' => 'download', + ], + 'expected_message' => 'The configuration option "file" should be defined.' + ]; + } + + /** @dataProvider wrongConfigs */ + public function testWrongConfigs(array $config, string $expected_message): void + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionMessage($expected_message); + + (new Capacity\Lookup\Download(new ExpressionLanguage()))->getBuilder($config); + } +} diff --git a/tests/functional/Capacity/Lookup/ListPerPageTest.php b/tests/functional/Capacity/Lookup/ListPerPageTest.php index 0207f88..2944d17 100644 --- a/tests/functional/Capacity/Lookup/ListPerPageTest.php +++ b/tests/functional/Capacity/Lookup/ListPerPageTest.php @@ -38,7 +38,7 @@ public function wrongConfigs(): \Generator ]; } - public function goodConfigs(): \Generator + public function validConfigs(): \Generator { yield [ 'config' => [ @@ -62,8 +62,8 @@ public function testWrongConfigs(array $config, string $expected_message): void (new Capacity\Lookup\ListPerPage(new ExpressionLanguage()))->getBuilder($config); } - /** @dataProvider goodConfigs */ - public function testGoodConfigs(array $config): void + /** @dataProvider validConfigs */ + public function testValidConfigs(array $config): void { $this->assertInstanceOf( 'PhpParser\Builder', diff --git a/tests/functional/Configuration/LookupTest.php b/tests/functional/Configuration/LookupTest.php index c8e3896..db30b3d 100644 --- a/tests/functional/Configuration/LookupTest.php +++ b/tests/functional/Configuration/LookupTest.php @@ -16,7 +16,7 @@ protected function setUp(): void $this->processor = new Config\Definition\Processor(); } - public function validDataProvider(): iterable + public function validConfigs(): iterable { yield [ 'config' => [ @@ -26,7 +26,6 @@ public function validDataProvider(): iterable 'type' => 'attributeOption', 'code' => '@=input["code"]', 'method' => 'all', - 'search' => [], 'merge' => [ 'map' => [ 0 => [ @@ -41,7 +40,6 @@ public function validDataProvider(): iterable ], ], ], - 'search' => [], ], 'expected' => [ 'conditional' => [ @@ -74,7 +72,6 @@ public function validDataProvider(): iterable 'type' => 'attributeOption', 'code' => '@=input["code"]', 'method' => 'all', - 'search' => [], 'merge' => [ 'map' => [ 0 => [ @@ -107,33 +104,171 @@ public function validDataProvider(): iterable ], ], ]; + + yield [ + 'config' => [ + 'type' => 'productMediaFile', + 'file' => '123', + 'method' => 'all', + ], + 'expected' => [ + 'type' => 'productMediaFile', + 'file' => '123', + 'method' => 'all', + 'search' => [], + ], + ]; + + yield [ + 'config' => [ + 'type' => 'product', + 'method' => 'listPerPage', + ], + 'expected' => [ + 'type' => 'product', + 'method' => 'listPerPage', + 'search' => [], + ], + ]; + + yield [ + 'config' => [ + 'type' => 'product', + 'method' => 'all', + 'merge' => [ + 'map' => [ + [ + 'field' => 'foo', + 'constant' => 'bar' + ] + ] + ], + ], + 'expected' => [ + 'type' => 'product', + 'method' => 'all', + 'merge' => [ + 'map' => [ + [ + 'field' => 'foo', + 'constant' => 'bar' + ] + ] + ], + 'search' => [], + ] + ]; + + yield [ + 'config' => [ + 'conditional' => [ + [ + 'file' => '123', + 'type' => 'productMediaFile', + 'method' => 'download', + ], + ], + ], + 'expected' => [ + 'conditional' => [ + [ + 'file' => '123', + 'type' => 'productMediaFile', + 'method' => 'download', + 'search' => [], + ], + ], + 'search' => [], + ] + ]; + } + + public function wrongConfigs(): \Generator + { + yield [ + 'config' => [ + 'type' => 'invalidType', + 'method' => 'all' + ], + 'excepted_message' => 'Invalid configuration for path "lookup.type": The value should be one of [product, category, attribute, attributeOption, attributeGroup, family, productMediaFile, locale, channel, currency, measureFamily, associationType, familyVariant, productModel, publishedProduct, productModelDraft, productDraft, asset, assetCategory, assetTag, referenceEntityRecord, referenceEntityAttribute, referenceEntityAttributeOption, referenceEntity, assetManager, assetMediaFile], got "invalidType"', + 'excepted_class' => 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException', + ]; + + yield [ + 'config' => [ + 'file' => '123', + 'type' => 'product', + 'method' => 'get', + ], + 'excepted_message' => 'Invalid configuration for path "lookup": The file option should only be used with the "productMediaFile" and "assetMediaFiles" endpoints.', + 'excepted_class' => 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException', + ]; + + yield [ + 'config' => [ + 'conditional' => [ + [ + 'type' => 'product', + 'method' => 'wrong', + ], + ], + ], + 'excepted_message' => 'Invalid configuration for path "lookup.conditional.0": the value should be one of [listPerPage, all, get], got "wrong"', + 'excepted_class' => 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException', + ]; + + yield [ + 'config' => [ + 'conditional' => [ + [ + 'file' => '123', + 'type' => 'product', + 'method' => 'get', + ], + ], + ], + 'excepted_message' => 'Invalid configuration for path "lookup.conditional.0": The file option should only be used with the "productMediaFile', + 'excepted_class' => 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException', + ]; + + yield [ + 'config' => [ + 'conditional' => [ + [ + 'identifier' => '123', + 'type' => 'product', + 'method' => 'all', + ], + ], + ], + 'excepted_message' => 'Invalid configuration for path "lookup.conditional.0": The identifier option should only be used with the "get" method.', + 'excepted_class' => 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException', + ]; } - /** @dataProvider validDataProvider */ - public function testValidConfig(array $config, array $expected) + /** @dataProvider validConfigs */ + public function testValidConfigs(array $config, array $expected) { $client = new Configuration\Lookup(); $this->assertEquals($expected, $this->processor->processConfiguration($client, [$config])); } - public function testInvalidConfig() + /** @dataProvider wrongConfigs */ + public function testWrongConfigs(array $config, string $expectedMessage, string $exceptedClass) { $client = new Configuration\Lookup(); $this->expectException( - Config\Definition\Exception\InvalidConfigurationException::class, + $exceptedClass ); $this->expectExceptionMessage( - 'Invalid configuration for path "lookup.type": The value should be one of [product, category, attribute, attributeOption, attributeGroup, family, productMediaFile, locale, channel, currency, measureFamily, associationType, familyVariant, productModel, publishedProduct, productModelDraft, productDraft, asset, assetCategory, assetTag, referenceEntityRecord, referenceEntityAttribute, referenceEntityAttributeOption, referenceEntity, assetManager, assetMediaFile], got "invalidType"', + $expectedMessage ); $this->processor->processConfiguration($client, [ - [ - 'type' => 'invalidType', - 'method' => 'all' - ] + $config ]); } } diff --git a/tests/functional/Factory/LookupTest.php b/tests/functional/Factory/LookupTest.php index da99211..3906220 100644 --- a/tests/functional/Factory/LookupTest.php +++ b/tests/functional/Factory/LookupTest.php @@ -55,6 +55,19 @@ public function wrongConfigs(): \Generator 'type' => 'product', ] ]; + yield [ + 'config' => [ + 'type' => 'assetMediaFiles', + 'file' => '123' + ] + ]; + yield [ + 'config' => [ + 'type' => 'assetMediaFiles', + 'method' => 'wrong', + 'file' => '123' + ] + ]; } /** @dataProvider wrongConfigs */ diff --git a/tests/functional/ServiceTest.php b/tests/functional/ServiceTest.php index 6585c66..787b1e9 100644 --- a/tests/functional/ServiceTest.php +++ b/tests/functional/ServiceTest.php @@ -9,7 +9,7 @@ final class ServiceTest extends TestCase { - public function configProvider(): \Generator + public function validConfigs(): \Generator { /** Get */ yield [ @@ -132,7 +132,7 @@ public function testMissingAuthentication(): void ]); } - /** @dataProvider configProvider */ + /** @dataProvider validConfigs */ public function testWithConfigurationAndProcessor(array $expected, string $expectedClass, array $actual): void { $service = new Akeneo\Service(new ExpressionLanguage()); From 9dce5218f3847dce4ef91c652179dee96c214153 Mon Sep 17 00:00:00 2001 From: clemzarch Date: Thu, 2 Jun 2022 14:04:02 +0200 Subject: [PATCH 12/19] rename "assetMediaFiles" to the correct endpoint "assetMediaFile", provide the builder's capacity in the constructor instead of using a method called "withCapacity()" --- src/Builder/AlternativeLookup.php | 13 +++---------- src/Configuration/Extractor.php | 2 +- src/Configuration/Lookup.php | 8 ++++---- src/Factory/Lookup.php | 12 ++++-------- .../ConditionalLookup/ConditionalLookupTest.php | 2 +- tests/functional/Builder/Lookup/LookupTest.php | 4 ++-- tests/functional/Configuration/LookupTest.php | 2 +- tests/functional/Factory/LookupTest.php | 4 ++-- 8 files changed, 18 insertions(+), 29 deletions(-) diff --git a/src/Builder/AlternativeLookup.php b/src/Builder/AlternativeLookup.php index 6529835..4c0ee61 100644 --- a/src/Builder/AlternativeLookup.php +++ b/src/Builder/AlternativeLookup.php @@ -10,21 +10,14 @@ final class AlternativeLookup implements Builder { - private ?Builder $capacity; private ?Builder $merge; - public function __construct() { - $this->capacity = null; + public function __construct( + private Builder $capacity, + ) { $this->merge = null; } - public function withCapacity(Builder $capacity): self - { - $this->capacity = $capacity; - - return $this; - } - public function withMerge(Builder $merge): self { $this->merge = $merge; diff --git a/src/Configuration/Extractor.php b/src/Configuration/Extractor.php index 1056000..c81e33f 100644 --- a/src/Configuration/Extractor.php +++ b/src/Configuration/Extractor.php @@ -167,7 +167,7 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder ->validate() ->ifTrue(fn ($data) => \array_key_exists('file', $data) && \array_key_exists('type', $data) - && !\in_array($data['type'], ['productMediaFile', 'assetMediaFiles'], true)) + && !\in_array($data['type'], ['productMediaFile', 'assetMediaFile'], true)) ->thenInvalid('The file option should only be used with the "productMediaFile" endpoint.') ->end() ->validate() diff --git a/src/Configuration/Lookup.php b/src/Configuration/Lookup.php index bef02cc..b32a8ad 100644 --- a/src/Configuration/Lookup.php +++ b/src/Configuration/Lookup.php @@ -164,8 +164,8 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder ->thenInvalid('The code option should only be used with the "attributeOption", "referenceEntityRecord" and "assetManager" endpoints.') ->end() ->validate() - ->ifTrue(fn ($data) => \array_key_exists('file', $data) && \array_key_exists('type', $data) && !\in_array($data['type'], ['productMediaFile', 'assetMediaFiles'])) - ->thenInvalid('The file option should only be used with the "productMediaFile" and "assetMediaFiles" endpoints.') + ->ifTrue(fn ($data) => \array_key_exists('file', $data) && \array_key_exists('type', $data) && !\in_array($data['type'], ['productMediaFile', 'assetMediaFile'])) + ->thenInvalid('The file option should only be used with the "productMediaFile" and "assetMediaFile" endpoints.') ->end() ->validate() ->ifTrue(fn ($data) => !\array_key_exists('conditional', $data) && \array_key_exists('identifier', $data) && \array_key_exists('method', $data) && !\in_array($data['method'], ['get'])) @@ -250,8 +250,8 @@ private function getConditionalTreeBuilder(): Config\Definition\Builder\TreeBuil ->validate() ->ifTrue(fn ($data) => \array_key_exists('file', $data) && \array_key_exists('type', $data) - && !\in_array($data['type'], ['productMediaFile', 'assetMediaFiles'], true)) - ->thenInvalid('The file option should only be used with the "productMediaFile" and "assetMediaFiles" endpoints.') + && !\in_array($data['type'], ['productMediaFile', 'assetMediaFile'], true)) + ->thenInvalid('The file option should only be used with the "productMediaFile" and "assetMediaFile" endpoints.') ->end() ->validate() ->ifTrue(fn ($data) => \array_key_exists('identifier', $data) && \array_key_exists('method', $data) && 'get' !== $data['method']) diff --git a/src/Factory/Lookup.php b/src/Factory/Lookup.php index 5c8a01b..749bec9 100644 --- a/src/Factory/Lookup.php +++ b/src/Factory/Lookup.php @@ -96,14 +96,12 @@ public function compile(array $config): Repository\Lookup { try { if (!\array_key_exists('conditional', $config)) { - $alternativeBuilder = new Akeneo\Builder\AlternativeLookup(); - $builder = new Akeneo\Builder\Lookup($alternativeBuilder); - $repository = new Repository\Lookup($builder); - try { - $alternativeBuilder->withCapacity( + $alternativeBuilder = new Akeneo\Builder\AlternativeLookup( $this->findCapacity($config)->getBuilder($config) ); + $builder = new Akeneo\Builder\Lookup($alternativeBuilder); + $repository = new Repository\Lookup($builder); } catch (NoApplicableCapacityException $exception) { throw new Configurator\InvalidConfigurationException(message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', previous: $exception); } @@ -114,10 +112,8 @@ public function compile(array $config): Repository\Lookup $repository = new Repository\Lookup($builder); foreach ($config['conditional'] as $alternative) { - $alternativeBuilder = new Akeneo\Builder\AlternativeLookup(); - try { - $alternativeBuilder->withCapacity( + $alternativeBuilder = new Akeneo\Builder\AlternativeLookup( $this->findCapacity($alternative)->getBuilder($alternative) ); } catch (NoApplicableCapacityException $exception) { diff --git a/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php b/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php index dfbf56a..cdab8ac 100644 --- a/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php +++ b/tests/functional/Builder/ConditionalLookup/ConditionalLookupTest.php @@ -46,7 +46,7 @@ public function testLookupProduct() $builder->withClient($client->getNode()); $builder->addAlternative( condition: new Node\Expr\Isset_([new Node\Expr\Variable('output')]), - lookup: (new AlternativeLookup())->withCapacity($capacity) + lookup: new AlternativeLookup($capacity) ); $this->assertBuildsTransformerTransformsLike( diff --git a/tests/functional/Builder/Lookup/LookupTest.php b/tests/functional/Builder/Lookup/LookupTest.php index 7681678..01f74b8 100644 --- a/tests/functional/Builder/Lookup/LookupTest.php +++ b/tests/functional/Builder/Lookup/LookupTest.php @@ -42,7 +42,7 @@ public function testLookupProduct() ->withEndpoint(new Node\Identifier('getProductApi')) ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); - $builder = new Lookup((new AlternativeLookup())->withCapacity($capacity)); + $builder = new Lookup(new AlternativeLookup($capacity)); $builder->withClient($client->getNode()); $this->assertBuildsTransformerTransformsLike( @@ -88,7 +88,7 @@ public function testConditionalLookupProduct() ->withEndpoint(new Node\Identifier('getProductApi')) ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); - $builder = new Lookup((new AlternativeLookup())->withCapacity($capacity)); + $builder = new Lookup(new AlternativeLookup($capacity)); $builder->withClient($client->getNode()); $this->assertBuildsTransformerTransformsLike( diff --git a/tests/functional/Configuration/LookupTest.php b/tests/functional/Configuration/LookupTest.php index db30b3d..29b5a99 100644 --- a/tests/functional/Configuration/LookupTest.php +++ b/tests/functional/Configuration/LookupTest.php @@ -200,7 +200,7 @@ public function wrongConfigs(): \Generator 'type' => 'product', 'method' => 'get', ], - 'excepted_message' => 'Invalid configuration for path "lookup": The file option should only be used with the "productMediaFile" and "assetMediaFiles" endpoints.', + 'excepted_message' => 'Invalid configuration for path "lookup": The file option should only be used with the "productMediaFile" and "assetMediaFile" endpoints.', 'excepted_class' => 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException', ]; diff --git a/tests/functional/Factory/LookupTest.php b/tests/functional/Factory/LookupTest.php index 3906220..fc77973 100644 --- a/tests/functional/Factory/LookupTest.php +++ b/tests/functional/Factory/LookupTest.php @@ -57,13 +57,13 @@ public function wrongConfigs(): \Generator ]; yield [ 'config' => [ - 'type' => 'assetMediaFiles', + 'type' => 'assetMediaFile', 'file' => '123' ] ]; yield [ 'config' => [ - 'type' => 'assetMediaFiles', + 'type' => 'assetMediaFile', 'method' => 'wrong', 'file' => '123' ] From ec8d02b1d4f04fc187bc72fe4320040cd79a1c09 Mon Sep 17 00:00:00 2001 From: clemzarch Date: Thu, 2 Jun 2022 14:15:29 +0200 Subject: [PATCH 13/19] add phpunit-extension to the composer.lock so it can be used in CI --- composer.lock | 1213 ++++++++++++++++++++++++++++--------------------- 1 file changed, 696 insertions(+), 517 deletions(-) diff --git a/composer.lock b/composer.lock index 95a941a..c981b14 100644 --- a/composer.lock +++ b/composer.lock @@ -4,38 +4,34 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "078bcc6a66208f6c4672891ab5defe86", + "content-hash": "bf287b84d15a3b9bbe8a06fce83752f4", "packages": [ { "name": "doctrine/inflector", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "9cf661f4eb38f7c881cac67c75ea9b00bf97b210" + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/9cf661f4eb38f7c881cac67c75ea9b00bf97b210", - "reference": "9cf661f4eb38f7c881cac67c75ea9b00bf97b210", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^7.0", - "phpstan/phpstan": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "doctrine/coding-standard": "^8.2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "vimeo/psalm": "^4.10" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" @@ -83,7 +79,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.x" + "source": "https://github.com/doctrine/inflector/tree/2.0.4" }, "funding": [ { @@ -99,20 +95,20 @@ "type": "tidelift" } ], - "time": "2020-05-29T15:13:26+00:00" + "time": "2021-10-22T20:16:43+00:00" }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.14.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", "shasum": "" }, "require": { @@ -153,9 +149,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2022-05-31T20:59:12+00:00" }, { "name": "php-etl/configurator-contracts", @@ -693,16 +689,16 @@ }, { "name": "phpactor/docblock", - "version": "0.3.4", + "version": "0.3.6", "source": { "type": "git", "url": "https://github.com/phpactor/docblock.git", - "reference": "a82cde09f49e388bb7a505465135aeff68c51647" + "reference": "a5567feab7b36938d6a1018a60efc5a7c4fd696c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpactor/docblock/zipball/a82cde09f49e388bb7a505465135aeff68c51647", - "reference": "a82cde09f49e388bb7a505465135aeff68c51647", + "url": "https://api.github.com/repos/phpactor/docblock/zipball/a5567feab7b36938d6a1018a60efc5a7c4fd696c", + "reference": "a5567feab7b36938d6a1018a60efc5a7c4fd696c", "shasum": "" }, "require": { @@ -739,9 +735,10 @@ "description": "Simple Docblock Parser", "support": { "issues": "https://github.com/phpactor/docblock/issues", - "source": "https://github.com/phpactor/docblock/tree/0.3.4" + "source": "https://github.com/phpactor/docblock/tree/0.3.6" }, - "time": "2021-02-06T14:38:53+00:00" + "abandoned": true, + "time": "2022-03-08T11:46:42+00:00" }, { "name": "psr/cache", @@ -794,22 +791,27 @@ }, { "name": "psr/container", - "version": "1.1.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -836,9 +838,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/log", @@ -892,16 +894,16 @@ }, { "name": "symfony/cache", - "version": "v5.3.7", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "864867b13bd67347497ce956f4b253f8fe18b80c" + "reference": "a50b7249bea81ddd6d3b799ce40c5521c2f72f0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/864867b13bd67347497ce956f4b253f8fe18b80c", - "reference": "864867b13bd67347497ce956f4b253f8fe18b80c", + "url": "https://api.github.com/repos/symfony/cache/zipball/a50b7249bea81ddd6d3b799ce40c5521c2f72f0b", + "reference": "a50b7249bea81ddd6d3b799ce40c5521c2f72f0b", "shasum": "" }, "require": { @@ -909,35 +911,35 @@ "psr/cache": "^1.0|^2.0", "psr/log": "^1.1|^2|^3", "symfony/cache-contracts": "^1.1.7|^2", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "conflict": { - "doctrine/dbal": "<2.10", + "doctrine/dbal": "<2.13.1", "symfony/dependency-injection": "<4.4", "symfony/http-kernel": "<4.4", "symfony/var-dumper": "<4.4" }, "provide": { "psr/cache-implementation": "1.0|2.0", - "psr/simple-cache-implementation": "1.0", + "psr/simple-cache-implementation": "1.0|2.0", "symfony/cache-implementation": "1.0|2.0" }, "require-dev": { "cache/integration-tests": "dev-master", "doctrine/cache": "^1.6|^2.0", - "doctrine/dbal": "^2.10|^3.0", + "doctrine/dbal": "^2.13.1|^3.0", "predis/predis": "^1.1", - "psr/simple-cache": "^1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/filesystem": "^4.4|^5.0", - "symfony/http-kernel": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/simple-cache": "^1.0|^2.0", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/filesystem": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/messenger": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { @@ -969,7 +971,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.3.7" + "source": "https://github.com/symfony/cache/tree/v5.4.9" }, "funding": [ { @@ -985,20 +987,20 @@ "type": "tidelift" } ], - "time": "2021-08-29T15:08:21+00:00" + "time": "2022-05-21T10:24:18+00:00" }, { "name": "symfony/cache-contracts", - "version": "v2.4.0", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/symfony/cache-contracts.git", - "reference": "c0446463729b89dd4fa62e9aeecc80287323615d" + "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/c0446463729b89dd4fa62e9aeecc80287323615d", - "reference": "c0446463729b89dd4fa62e9aeecc80287323615d", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", + "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", "shasum": "" }, "require": { @@ -1011,7 +1013,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -1048,7 +1050,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/cache-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/cache-contracts/tree/v2.5.1" }, "funding": [ { @@ -1064,26 +1066,26 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/config", - "version": "v5.3.4", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "4268f3059c904c61636275182707f81645517a37" + "reference": "8f551fe22672ac7ab2c95fe46d899f960ed4d979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/4268f3059c904c61636275182707f81645517a37", - "reference": "4268f3059c904c61636275182707f81645517a37", + "url": "https://api.github.com/repos/symfony/config/zipball/8f551fe22672ac7ab2c95fe46d899f960ed4d979", + "reference": "8f551fe22672ac7ab2c95fe46d899f960ed4d979", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/filesystem": "^4.4|^5.0", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/filesystem": "^4.4|^5.0|^6.0", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-php80": "^1.16", "symfony/polyfill-php81": "^1.22" @@ -1092,11 +1094,11 @@ "symfony/finder": "<4.4" }, "require-dev": { - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/yaml": "^4.4|^5.0" + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/messenger": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/yaml": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -1127,7 +1129,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v5.3.4" + "source": "https://github.com/symfony/config/tree/v5.4.9" }, "funding": [ { @@ -1143,29 +1145,29 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2022-05-17T10:39:36+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", + "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -1194,7 +1196,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.0" }, "funding": [ { @@ -1210,26 +1212,26 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2022-02-25T11:15:52+00:00" }, { "name": "symfony/expression-language", - "version": "v5.3.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "fe696e2669cb47507e5635223ac4b64500339658" + "reference": "9d186e1eecf9e3461c6adbdf1acf614b8da9def9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/fe696e2669cb47507e5635223ac4b64500339658", - "reference": "fe696e2669cb47507e5635223ac4b64500339658", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/9d186e1eecf9e3461c6adbdf1acf614b8da9def9", + "reference": "9d186e1eecf9e3461c6adbdf1acf614b8da9def9", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/cache": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2" + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3" }, "type": "library", "autoload": { @@ -1257,7 +1259,7 @@ "description": "Provides an engine that can compile and evaluate expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/expression-language/tree/v5.3.7" + "source": "https://github.com/symfony/expression-language/tree/v5.4.8" }, "funding": [ { @@ -1273,26 +1275,26 @@ "type": "tidelift" } ], - "time": "2021-08-23T12:57:24+00:00" + "time": "2022-04-08T05:07:18+00:00" }, { "name": "symfony/filesystem", - "version": "v5.3.4", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32" + "reference": "3132d2f43ca799c2aa099f9738d98228c56baa5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/343f4fe324383ca46792cae728a3b6e2f708fb32", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3132d2f43ca799c2aa099f9738d98228c56baa5d", + "reference": "3132d2f43ca799c2aa099f9738d98228c56baa5d", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", "autoload": { @@ -1320,7 +1322,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.3.4" + "source": "https://github.com/symfony/filesystem/tree/v6.1.0" }, "funding": [ { @@ -1336,32 +1338,35 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2022-05-21T13:34:40+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1369,12 +1374,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1399,7 +1404,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" }, "funding": [ { @@ -1415,20 +1420,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" + "reference": "433d05519ce6990bf3530fba6957499d327395c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", + "reference": "433d05519ce6990bf3530fba6957499d327395c2", "shasum": "" }, "require": { @@ -1440,7 +1445,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1448,12 +1453,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1480,7 +1485,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" }, "funding": [ { @@ -1496,20 +1501,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "reference": "219aa369ceff116e673852dce47c3a41794c14bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", + "reference": "219aa369ceff116e673852dce47c3a41794c14bd", "shasum": "" }, "require": { @@ -1521,7 +1526,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1529,12 +1534,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1564,7 +1569,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" }, "funding": [ { @@ -1580,32 +1585,35 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1613,12 +1621,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1644,7 +1652,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" }, "funding": [ { @@ -1660,20 +1668,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", + "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", "shasum": "" }, "require": { @@ -1682,7 +1690,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1690,12 +1698,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1723,7 +1731,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" }, "funding": [ { @@ -1739,20 +1747,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", "shasum": "" }, "require": { @@ -1761,7 +1769,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1769,12 +1777,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1806,7 +1814,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" }, "funding": [ { @@ -1822,20 +1830,20 @@ "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2022-05-10T07:21:04+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.23.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "e66119f3de95efc359483f810c4c3e6436279436" + "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/e66119f3de95efc359483f810c4c3e6436279436", - "reference": "e66119f3de95efc359483f810c4c3e6436279436", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1", + "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1", "shasum": "" }, "require": { @@ -1844,7 +1852,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1852,12 +1860,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1885,7 +1893,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.26.0" }, "funding": [ { @@ -1901,30 +1909,30 @@ "type": "tidelift" } ], - "time": "2021-05-21T13:25:03+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/property-access", - "version": "v5.3.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "a4bbf09b8f3e2d2c89cc2c8b3d6682bf4c3d5589" + "reference": "fe501d498d6ec7e9efe928c90fabedf629116495" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/a4bbf09b8f3e2d2c89cc2c8b3d6682bf4c3d5589", - "reference": "a4bbf09b8f3e2d2c89cc2c8b3d6682bf4c3d5589", + "url": "https://api.github.com/repos/symfony/property-access/zipball/fe501d498d6ec7e9efe928c90fabedf629116495", + "reference": "fe501d498d6ec7e9efe928c90fabedf629116495", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php80": "^1.16", - "symfony/property-info": "^5.2" + "symfony/property-info": "^5.2|^6.0" }, "require-dev": { - "symfony/cache": "^4.4|^5.0" + "symfony/cache": "^4.4|^5.0|^6.0" }, "suggest": { "psr/cache-implementation": "To cache access methods." @@ -1966,7 +1974,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v5.3.7" + "source": "https://github.com/symfony/property-access/tree/v5.4.8" }, "funding": [ { @@ -1982,39 +1990,38 @@ "type": "tidelift" } ], - "time": "2021-08-09T12:23:10+00:00" + "time": "2022-04-12T15:48:08+00:00" }, { "name": "symfony/property-info", - "version": "v5.3.7", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "7202b6c93a07df5df83eb58e3757dffb77fc5d90" + "reference": "3034b470009cd673c6409c3c1952869c197bc8cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/7202b6c93a07df5df83eb58e3757dffb77fc5d90", - "reference": "7202b6c93a07df5df83eb58e3757dffb77fc5d90", + "url": "https://api.github.com/repos/symfony/property-info/zipball/3034b470009cd673c6409c3c1952869c197bc8cd", + "reference": "3034b470009cd673c6409c3c1952869c197bc8cd", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php80": "^1.16", - "symfony/string": "^5.1" + "php": ">=8.1", + "symfony/string": "^5.4|^6.0" }, "conflict": { - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", - "symfony/dependency-injection": "<4.4" + "phpdocumentor/reflection-docblock": "<5.2", + "phpdocumentor/type-resolver": "<1.5.1", + "symfony/dependency-injection": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.10.4", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/cache": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/serializer": "^4.4|^5.0" + "phpdocumentor/reflection-docblock": "^5.2", + "phpstan/phpdoc-parser": "^1.0", + "symfony/cache": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/serializer": "^5.4|^6.0" }, "suggest": { "phpdocumentor/reflection-docblock": "To use the PHPDoc", @@ -2056,7 +2063,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v5.3.7" + "source": "https://github.com/symfony/property-info/tree/v6.1.0" }, "funding": [ { @@ -2072,25 +2079,28 @@ "type": "tidelift" } ], - "time": "2021-08-23T12:57:24+00:00" + "time": "2022-05-24T19:09:44+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.4.0", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "reference": "d66cd8ab656780f62c4215b903a420eb86358957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d66cd8ab656780f62c4215b903a420eb86358957", + "reference": "d66cd8ab656780f62c4215b903a420eb86358957", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1" + "php": ">=8.1", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -2098,7 +2108,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -2108,7 +2118,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2135,7 +2148,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.1.0" }, "funding": [ { @@ -2151,44 +2164,46 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2022-05-07T08:07:09+00:00" }, { "name": "symfony/string", - "version": "v5.3.7", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" + "reference": "d3edc75baf9f1d4f94879764dda2e1ac33499529" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", + "url": "https://api.github.com/repos/symfony/string/zipball/d3edc75baf9f1d4f94879764dda2e1ac33499529", + "reference": "d3edc75baf9f1d4f94879764dda2e1ac33499529", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -2218,7 +2233,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.7" + "source": "https://github.com/symfony/string/tree/v6.1.0" }, "funding": [ { @@ -2234,28 +2249,27 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:00:08+00:00" + "time": "2022-04-22T08:18:23+00:00" }, { "name": "symfony/var-exporter", - "version": "v5.3.7", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "2ded877ab0574d8b646f4eb3f716f8ed7ee7f392" + "reference": "33c301d3177150a52350ac893490a9289eb143dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/2ded877ab0574d8b646f4eb3f716f8ed7ee7f392", - "reference": "2ded877ab0574d8b646f4eb3f716f8ed7ee7f392", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/33c301d3177150a52350ac893490a9289eb143dd", + "reference": "33c301d3177150a52350ac893490a9289eb143dd", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "require-dev": { - "symfony/var-dumper": "^4.4.9|^5.0.9" + "symfony/var-dumper": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -2291,7 +2305,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v5.3.7" + "source": "https://github.com/symfony/var-exporter/tree/v6.1.0" }, "funding": [ { @@ -2307,97 +2321,110 @@ "type": "tidelift" } ], - "time": "2021-08-04T22:42:42+00:00" + "time": "2022-05-21T13:34:40+00:00" } ], "packages-dev": [ { - "name": "akeneo/api-php-client", - "version": "v4.0.2", + "name": "adlawson/vfs", + "version": "0.12.1", "source": { "type": "git", - "url": "https://github.com/akeneo/api-php-client.git", - "reference": "b8121b4d78392a35a48aa2aef5752aa65c07c259" + "url": "https://github.com/adlawson/php-vfs.git", + "reference": "e955034419d6a8f92c9a8ea2e626eeed96b41095" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/akeneo/api-php-client/zipball/b8121b4d78392a35a48aa2aef5752aa65c07c259", - "reference": "b8121b4d78392a35a48aa2aef5752aa65c07c259", + "url": "https://api.github.com/repos/adlawson/php-vfs/zipball/e955034419d6a8f92c9a8ea2e626eeed96b41095", + "reference": "e955034419d6a8f92c9a8ea2e626eeed96b41095", "shasum": "" }, "require": { - "php": ">=7.1", - "php-http/client-implementation": "^1.0", - "php-http/discovery": "^1.6", - "php-http/httplug": "^2.0", - "php-http/message": "^1.7", - "php-http/message-factory": "^v1.0", - "php-http/multipart-stream-builder": "^1.0", - "psr/http-message": "^1.0" + "php": ">=5.5", + "psr/log": "^1.0" }, "require-dev": { - "donatj/mock-webserver": "^2.0", - "friendsofphp/php-cs-fixer": "^2.14", - "php-http/guzzle6-adapter": "^2.0", - "phpspec/phpspec": "^5.0", - "phpunit/phpunit": "^5.7", - "symfony/yaml": "^4.2" - }, - "suggest": { - "php-http/guzzle6-adapter": "In order to use Guzzle v6 as the HTTP client" + "adlawson/timezone": "^1.0", + "fabpot/php-cs-fixer": "^1.9", + "mockery/mockery": "^0.9", + "phpunit/phpunit": "^4.7" }, "type": "library", "autoload": { "psr-4": { - "Akeneo\\Pim\\ApiClient\\": "src/" + "Vfs\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "OSL-3.0" + "MIT" ], "authors": [ { - "name": "Akeneo", - "homepage": "http://www.akeneo.com" + "name": "Andrew Lawson", + "homepage": "http://adlawson.com" } ], - "description": "Akeneo PIM client for the API", + "description": "Virtual file system", + "homepage": "https://github.com/adlawson/php-vfs", + "keywords": [ + "dir", + "directory", + "file", + "fs", + "read", + "stream", + "system", + "virtual", + "wrapper", + "write" + ], "support": { - "issues": "https://github.com/akeneo/api-php-client/issues", - "source": "https://github.com/akeneo/api-php-client/tree/4.0" + "issues": "https://github.com/adlawson/php-vfs/issues", + "source": "https://github.com/adlawson/php-vfs/tree/develop" }, - "time": "2019-06-13T15:31:24+00:00" + "time": "2016-02-20T12:46:01+00:00" }, { - "name": "akeneo/api-php-client-ee", - "version": "v4.0.2", + "name": "akeneo/api-php-client", + "version": "v9.0.1", "source": { "type": "git", - "url": "https://github.com/akeneo/api-php-client-ee.git", - "reference": "df3946f27ff0080e7339fd8bc268b0932cbfbd99" + "url": "https://github.com/akeneo/api-php-client.git", + "reference": "f7e510c69ba0f3e3db2387118e0248b5d800b2c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/akeneo/api-php-client-ee/zipball/df3946f27ff0080e7339fd8bc268b0932cbfbd99", - "reference": "df3946f27ff0080e7339fd8bc268b0932cbfbd99", + "url": "https://api.github.com/repos/akeneo/api-php-client/zipball/f7e510c69ba0f3e3db2387118e0248b5d800b2c8", + "reference": "f7e510c69ba0f3e3db2387118e0248b5d800b2c8", "shasum": "" }, "require": { - "akeneo/api-php-client": "^4.0" + "php": ">=7.4", + "php-http/discovery": "^1.6", + "php-http/httplug": "^2.0", + "php-http/multipart-stream-builder": "^1.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "psr/http-message-implementation": "^1.0" }, "require-dev": { "donatj/mock-webserver": "^2.0", - "friendsofphp/php-cs-fixer": "^2.14", + "friendsofphp/php-cs-fixer": "^3.5", + "http-interop/http-factory-guzzle": "^1.0", "php-http/guzzle6-adapter": "^2.0", - "phpspec/phpspec": "^5.0", - "phpunit/phpunit": "^5.7", + "phpspec/phpspec": "^7.1", + "phpunit/phpunit": "^7.0", "symfony/yaml": "^4.2" }, + "suggest": { + "php-http/guzzle6-adapter": "In order to use Guzzle v6 as the HTTP client" + }, "type": "library", "autoload": { "psr-4": { - "Akeneo\\PimEnterprise\\ApiClient\\": "src/" + "Akeneo\\Pim\\ApiClient\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2410,25 +2437,25 @@ "homepage": "http://www.akeneo.com" } ], - "description": "Akeneo PIM ENTERPRISE client for the API", + "description": "Akeneo PIM client for the API", "support": { - "issues": "https://github.com/akeneo/api-php-client-ee/issues", - "source": "https://github.com/akeneo/api-php-client-ee/tree/4.0" + "issues": "https://github.com/akeneo/api-php-client/issues", + "source": "https://github.com/akeneo/api-php-client/tree/v9.0.1" }, - "time": "2019-06-13T15:35:14+00:00" + "time": "2022-05-30T07:36:48+00:00" }, { "name": "clue/stream-filter", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/clue/stream-filter.git", - "reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320" + "reference": "d6169430c7731d8509da7aecd0af756a5747b78e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/clue/stream-filter/zipball/aeb7d8ea49c7963d3b581378955dbf5bc49aa320", - "reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320", + "url": "https://api.github.com/repos/clue/stream-filter/zipball/d6169430c7731d8509da7aecd0af756a5747b78e", + "reference": "d6169430c7731d8509da7aecd0af756a5747b78e", "shasum": "" }, "require": { @@ -2439,12 +2466,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "Clue\\StreamFilter\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "Clue\\StreamFilter\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2469,7 +2496,7 @@ ], "support": { "issues": "https://github.com/clue/stream-filter/issues", - "source": "https://github.com/clue/stream-filter/tree/v1.5.0" + "source": "https://github.com/clue/stream-filter/tree/v1.6.0" }, "funding": [ { @@ -2481,7 +2508,7 @@ "type": "github" } ], - "time": "2020-10-02T12:38:20+00:00" + "time": "2022-02-21T13:15:14+00:00" }, { "name": "composer/pcre", @@ -2622,29 +2649,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -2671,7 +2699,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -2687,20 +2715,87 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" + }, + { + "name": "fakerphp/faker", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "ext-intl": "*", + "symfony/phpunit-bridge": "^4.4 || ^5.2" + }, + "suggest": { + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "v1.19-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" + }, + "time": "2022-02-02T17:38:57+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.0.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "1dc8d9cba3897165e16d12bb13d813afb1eb3fe7" + "reference": "c94a94f120803a18554c1805ef2e539f8285f9a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/1dc8d9cba3897165e16d12bb13d813afb1eb3fe7", - "reference": "1dc8d9cba3897165e16d12bb13d813afb1eb3fe7", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c94a94f120803a18554c1805ef2e539f8285f9a2", + "reference": "c94a94f120803a18554c1805ef2e539f8285f9a2", "shasum": "" }, "require": { @@ -2724,7 +2819,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.2-dev" } }, "autoload": { @@ -2737,13 +2832,34 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, { "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" }, { @@ -2765,9 +2881,23 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.0.0" + "source": "https://github.com/guzzle/psr7/tree/2.2.1" }, - "time": "2021-06-30T20:03:07+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2022-03-20T21:55:58+00:00" }, { "name": "infection/abstract-testframework-adapter", @@ -3196,16 +3326,16 @@ }, { "name": "laminas/laminas-diactoros", - "version": "2.8.0", + "version": "2.11.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-diactoros.git", - "reference": "0c26ef1d95b6d7e6e3943a243ba3dc0797227199" + "reference": "d1bc565b23c2040fafde398a8a5db083c47928c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/0c26ef1d95b6d7e6e3943a243ba3dc0797227199", - "reference": "0c26ef1d95b6d7e6e3943a243ba3dc0797227199", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/d1bc565b23c2040fafde398a8a5db083c47928c0", + "reference": "d1bc565b23c2040fafde398a8a5db083c47928c0", "shasum": "" }, "require": { @@ -3291,7 +3421,7 @@ "type": "community_bridge" } ], - "time": "2021-09-22T03:54:36+00:00" + "time": "2022-05-17T10:57:52+00:00" }, { "name": "mikey179/vfsstream", @@ -3395,37 +3525,38 @@ }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3441,7 +3572,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -3449,7 +3580,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "ondram/ci-detector", @@ -3591,16 +3722,16 @@ }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -3636,9 +3767,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "php-etl/bucket", @@ -3750,6 +3881,56 @@ }, "time": "2021-09-25T16:53:47+00:00" }, + { + "name": "php-etl/phpunit-extension", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/php-etl/phpunit-extension.git", + "reference": "88da32b280743278877794c9b6865b6b2ee252d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-etl/phpunit-extension/zipball/88da32b280743278877794c9b6865b6b2ee252d9", + "reference": "88da32b280743278877794c9b6865b6b2ee252d9", + "shasum": "" + }, + "require": { + "adlawson/vfs": "*", + "nikic/php-parser": "^4.10", + "php": "^8.0", + "php-etl/pipeline-contracts": "^0.3.0", + "phpunit/phpunit": "^9" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Kiboko\\Component\\PHPUnitExtension\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Grégory Planchat", + "email": "gregory@kiboko.fr" + } + ], + "description": "Extension for testing FastMap and ETL components with PHPUnit testing framework", + "support": { + "issues": "https://github.com/php-etl/phpunit-extension/issues", + "source": "https://github.com/php-etl/phpunit-extension/tree/main" + }, + "time": "2022-05-18T10:01:06+00:00" + }, { "name": "php-etl/pipeline-contracts", "version": "v0.3.3", @@ -3802,16 +3983,16 @@ }, { "name": "php-http/client-common", - "version": "2.4.0", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/php-http/client-common.git", - "reference": "29e0c60d982f04017069483e832b92074d0a90b2" + "reference": "d135751167d57e27c74de674d6a30cef2dc8e054" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/29e0c60d982f04017069483e832b92074d0a90b2", - "reference": "29e0c60d982f04017069483e832b92074d0a90b2", + "url": "https://api.github.com/repos/php-http/client-common/zipball/d135751167d57e27c74de674d6a30cef2dc8e054", + "reference": "d135751167d57e27c74de674d6a30cef2dc8e054", "shasum": "" }, "require": { @@ -3822,14 +4003,14 @@ "psr/http-client": "^1.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0", - "symfony/options-resolver": "^2.6 || ^3.4.20 || ~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0", + "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0", "symfony/polyfill-php80": "^1.17" }, "require-dev": { "doctrine/instantiator": "^1.1", "guzzlehttp/psr7": "^1.4", "nyholm/psr7": "^1.2", - "phpspec/phpspec": "^5.1 || ^6.0", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", "phpspec/prophecy": "^1.10.2", "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3" }, @@ -3871,22 +4052,22 @@ ], "support": { "issues": "https://github.com/php-http/client-common/issues", - "source": "https://github.com/php-http/client-common/tree/2.4.0" + "source": "https://github.com/php-http/client-common/tree/2.5.0" }, - "time": "2021-07-05T08:19:25+00:00" + "time": "2021-11-26T15:01:24+00:00" }, { "name": "php-http/curl-client", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/php-http/curl-client.git", - "reference": "15b11b7c2f39fe61ef6a70e0c247b4a84e845cdb" + "reference": "2ed4245a817d859dd0c1d51c7078cdb343cf5233" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/curl-client/zipball/15b11b7c2f39fe61ef6a70e0c247b4a84e845cdb", - "reference": "15b11b7c2f39fe61ef6a70e0c247b4a84e845cdb", + "url": "https://api.github.com/repos/php-http/curl-client/zipball/2ed4245a817d859dd0c1d51c7078cdb343cf5233", + "reference": "2ed4245a817d859dd0c1d51c7078cdb343cf5233", "shasum": "" }, "require": { @@ -3897,7 +4078,7 @@ "php-http/message": "^1.2", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "symfony/options-resolver": "^3.4 || ^4.0 || ^5.0" + "symfony/options-resolver": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, "provide": { "php-http/async-client-implementation": "1.0", @@ -3940,22 +4121,22 @@ ], "support": { "issues": "https://github.com/php-http/curl-client/issues", - "source": "https://github.com/php-http/curl-client/tree/2.2.0" + "source": "https://github.com/php-http/curl-client/tree/2.2.1" }, - "time": "2020-12-14T08:36:51+00:00" + "time": "2021-12-10T18:02:07+00:00" }, { "name": "php-http/discovery", - "version": "1.14.1", + "version": "1.14.2", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "de90ab2b41d7d61609f504e031339776bc8c7223" + "reference": "c8d48852fbc052454af42f6de27635ddd916b959" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/de90ab2b41d7d61609f504e031339776bc8c7223", - "reference": "de90ab2b41d7d61609f504e031339776bc8c7223", + "url": "https://api.github.com/repos/php-http/discovery/zipball/c8d48852fbc052454af42f6de27635ddd916b959", + "reference": "c8d48852fbc052454af42f6de27635ddd916b959", "shasum": "" }, "require": { @@ -3968,8 +4149,7 @@ "graham-campbell/phpspec-skip-example-extension": "^5.0", "php-http/httplug": "^1.0 || ^2.0", "php-http/message-factory": "^1.0", - "phpspec/phpspec": "^5.1 || ^6.1", - "puli/composer-plugin": "1.0.0-beta10" + "phpspec/phpspec": "^5.1 || ^6.1" }, "suggest": { "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories" @@ -4008,22 +4188,22 @@ ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.14.1" + "source": "https://github.com/php-http/discovery/tree/1.14.2" }, - "time": "2021-09-18T07:57:46+00:00" + "time": "2022-05-25T07:26:05+00:00" }, { "name": "php-http/httplug", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/php-http/httplug.git", - "reference": "191a0a1b41ed026b717421931f8d3bd2514ffbf9" + "reference": "f640739f80dfa1152533976e3c112477f69274eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/191a0a1b41ed026b717421931f8d3bd2514ffbf9", - "reference": "191a0a1b41ed026b717421931f8d3bd2514ffbf9", + "url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb", + "reference": "f640739f80dfa1152533976e3c112477f69274eb", "shasum": "" }, "require": { @@ -4070,22 +4250,22 @@ ], "support": { "issues": "https://github.com/php-http/httplug/issues", - "source": "https://github.com/php-http/httplug/tree/master" + "source": "https://github.com/php-http/httplug/tree/2.3.0" }, - "time": "2020-07-13T15:43:23+00:00" + "time": "2022-02-21T09:52:22+00:00" }, { "name": "php-http/message", - "version": "1.12.0", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/php-http/message.git", - "reference": "39eb7548be982a81085fe5a6e2a44268cd586291" + "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/39eb7548be982a81085fe5a6e2a44268cd586291", - "reference": "39eb7548be982a81085fe5a6e2a44268cd586291", + "url": "https://api.github.com/repos/php-http/message/zipball/7886e647a30a966a1a8d1dad1845b71ca8678361", + "reference": "7886e647a30a966a1a8d1dad1845b71ca8678361", "shasum": "" }, "require": { @@ -4102,7 +4282,7 @@ "ext-zlib": "*", "guzzlehttp/psr7": "^1.0", "laminas/laminas-diactoros": "^2.0", - "phpspec/phpspec": "^5.1 || ^6.3", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", "slim/slim": "^3.0" }, "suggest": { @@ -4118,12 +4298,12 @@ } }, "autoload": { - "psr-4": { - "Http\\Message\\": "src/" - }, "files": [ "src/filters.php" - ] + ], + "psr-4": { + "Http\\Message\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4144,9 +4324,9 @@ ], "support": { "issues": "https://github.com/php-http/message/issues", - "source": "https://github.com/php-http/message/tree/1.12.0" + "source": "https://github.com/php-http/message/tree/1.13.0" }, - "time": "2021-08-29T09:13:12+00:00" + "time": "2022-02-11T13:41:14+00:00" }, { "name": "php-http/message-factory", @@ -4444,16 +4624,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -4464,7 +4644,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -4494,22 +4675,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f" + "reference": "77a32518733312af16a44300404e945338981de3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f", - "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", "shasum": "" }, "require": { @@ -4544,22 +4725,22 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" }, - "time": "2021-09-17T15:28:14+00:00" + "time": "2022-03-15T21:29:03+00:00" }, { "name": "phpspec/prophecy", - "version": "1.14.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { @@ -4611,29 +4792,29 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.14.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2021-09-10T09:02:12+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.7", + "version": "9.2.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.12.0", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -4682,7 +4863,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" }, "funding": [ { @@ -4690,20 +4871,20 @@ "type": "github" } ], - "time": "2021-09-17T05:39:03+00:00" + "time": "2022-03-07T09:28:20+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -4742,7 +4923,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -4750,7 +4931,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -4935,16 +5116,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.9", + "version": "9.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b" + "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", - "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba", + "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba", "shasum": "" }, "require": { @@ -4960,7 +5141,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -4974,7 +5155,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.0", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -4995,11 +5176,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -5022,11 +5203,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.9" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -5034,7 +5215,7 @@ "type": "github" } ], - "time": "2021-08-31T06:47:40+00:00" + "time": "2022-04-01T12:37:26+00:00" }, { "name": "psr/http-client", @@ -5729,16 +5910,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { @@ -5780,7 +5961,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -5788,20 +5969,20 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -5850,14 +6031,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -5865,20 +6046,20 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -5921,7 +6102,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -5929,7 +6110,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -6220,28 +6401,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -6264,7 +6445,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" }, "funding": [ { @@ -6272,7 +6453,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-03-15T09:54:48+00:00" }, { "name": "sebastian/version", @@ -6393,46 +6574,43 @@ }, { "name": "symfony/console", - "version": "v5.4.8", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b" + "reference": "c9646197ef43b0e2ff44af61e7f0571526fd4170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b", - "reference": "ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b", + "url": "https://api.github.com/repos/symfony/console/zipball/c9646197ef43b0e2ff44af61e7f0571526fd4170", + "reference": "c9646197ef43b0e2ff44af61e7f0571526fd4170", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" + "symfony/string": "^5.4|^6.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/lock": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -6472,7 +6650,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.8" + "source": "https://github.com/symfony/console/tree/v6.1.0" }, "funding": [ { @@ -6488,24 +6666,27 @@ "type": "tidelift" } ], - "time": "2022-04-12T16:02:29+00:00" + "time": "2022-05-27T06:34:22+00:00" }, { "name": "symfony/finder", - "version": "v6.0.8", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "af7edab28d17caecd1f40a9219fc646ae751c21f" + "reference": "45b8beb69d6eb3b05a65689ebfd4222326773f8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/af7edab28d17caecd1f40a9219fc646ae751c21f", - "reference": "af7edab28d17caecd1f40a9219fc646ae751c21f", + "url": "https://api.github.com/repos/symfony/finder/zipball/45b8beb69d6eb3b05a65689ebfd4222326773f8f", + "reference": "45b8beb69d6eb3b05a65689ebfd4222326773f8f", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" + }, + "require-dev": { + "symfony/filesystem": "^6.0" }, "type": "library", "autoload": { @@ -6533,7 +6714,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.0.8" + "source": "https://github.com/symfony/finder/tree/v6.1.0" }, "funding": [ { @@ -6549,27 +6730,25 @@ "type": "tidelift" } ], - "time": "2022-04-15T08:07:58+00:00" + "time": "2022-04-15T08:08:08+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.3.7", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "4b78e55b179003a42523a362cc0e8327f7a69b5e" + "reference": "a3016f5442e28386ded73c43a32a5b68586dd1c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4b78e55b179003a42523a362cc0e8327f7a69b5e", - "reference": "4b78e55b179003a42523a362cc0e8327f7a69b5e", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/a3016f5442e28386ded73c43a32a5b68586dd1c4", + "reference": "a3016f5442e28386ded73c43a32a5b68586dd1c4", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.1|^3" }, "type": "library", "autoload": { @@ -6602,7 +6781,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.3.7" + "source": "https://github.com/symfony/options-resolver/tree/v6.1.0" }, "funding": [ { @@ -6618,24 +6797,24 @@ "type": "tidelift" } ], - "time": "2021-08-04T21:20:46+00:00" + "time": "2022-02-25T11:15:52+00:00" }, { "name": "symfony/process", - "version": "v6.0.8", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d074154ea8b1443a96391f6e39f9e547b2dd01b9" + "reference": "318718453c2be58266f1a9e74063d13cb8dd4165" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d074154ea8b1443a96391f6e39f9e547b2dd01b9", - "reference": "d074154ea8b1443a96391f6e39f9e547b2dd01b9", + "url": "https://api.github.com/repos/symfony/process/zipball/318718453c2be58266f1a9e74063d13cb8dd4165", + "reference": "318718453c2be58266f1a9e74063d13cb8dd4165", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -6663,7 +6842,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.0.8" + "source": "https://github.com/symfony/process/tree/v6.1.0" }, "funding": [ { @@ -6679,32 +6858,32 @@ "type": "tidelift" } ], - "time": "2022-04-12T16:11:42+00:00" + "time": "2022-05-11T12:12:29+00:00" }, { "name": "symfony/yaml", - "version": "v5.3.6", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7" + "reference": "e80f87d2c9495966768310fc531b487ce64237a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7", - "reference": "4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e80f87d2c9495966768310fc531b487ce64237a2", + "reference": "e80f87d2c9495966768310fc531b487ce64237a2", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-ctype": "~1.8" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<4.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "^4.4|^5.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -6738,7 +6917,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.3.6" + "source": "https://github.com/symfony/yaml/tree/v5.4.3" }, "funding": [ { @@ -6754,20 +6933,20 @@ "type": "tidelift" } ], - "time": "2021-07-29T06:20:01+00:00" + "time": "2022-01-26T16:32:32+00:00" }, { "name": "thecodingmachine/safe", - "version": "v2.1.4", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/thecodingmachine/safe.git", - "reference": "b206c2671d3601d40389013cf550b14fb4db2814" + "reference": "5570fbf82d3d27dfaff59db2bd1c9000838d66d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/b206c2671d3601d40389013cf550b14fb4db2814", - "reference": "b206c2671d3601d40389013cf550b14fb4db2814", + "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/5570fbf82d3d27dfaff59db2bd1c9000838d66d9", + "reference": "5570fbf82d3d27dfaff59db2bd1c9000838d66d9", "shasum": "" }, "require": { @@ -6782,7 +6961,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.1-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -6875,13 +7054,13 @@ "generated/zip.php", "generated/zlib.php" ], - "psr-4": { - "Safe\\": [ - "lib/", - "deprecated/", - "generated/" - ] - } + "classmap": [ + "lib/DateTime.php", + "lib/DateTimeImmutable.php", + "lib/Exceptions/", + "deprecated/Exceptions/", + "generated/Exceptions/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -6890,9 +7069,9 @@ "description": "PHP core functions that throw exceptions instead of returning FALSE on error", "support": { "issues": "https://github.com/thecodingmachine/safe/issues", - "source": "https://github.com/thecodingmachine/safe/tree/v2.1.4" + "source": "https://github.com/thecodingmachine/safe/tree/v2.2.0" }, - "time": "2022-05-02T13:55:17+00:00" + "time": "2022-05-25T13:37:55+00:00" }, { "name": "theseer/tokenizer", @@ -7066,5 +7245,5 @@ "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } From 499cb4b7b84e7d379a02572dedd9eb7d8516c940 Mon Sep 17 00:00:00 2001 From: clemzarch Date: Tue, 7 Jun 2022 12:28:16 +0200 Subject: [PATCH 14/19] force phpstan to use php 8.1 instead of 8.0 --- .github/workflows/phpstan-5.yaml | 1 + .github/workflows/phpstan-7.yaml | 1 + .github/workflows/phpstan-8.yaml | 1 + .github/workflows/quality.yaml | 1 + 4 files changed, 4 insertions(+) diff --git a/.github/workflows/phpstan-5.yaml b/.github/workflows/phpstan-5.yaml index 3169751..6e7d456 100644 --- a/.github/workflows/phpstan-5.yaml +++ b/.github/workflows/phpstan-5.yaml @@ -21,3 +21,4 @@ jobs: with: path: src/ args: --level=5 + php_version: 8.1 diff --git a/.github/workflows/phpstan-7.yaml b/.github/workflows/phpstan-7.yaml index fb719e9..8262773 100644 --- a/.github/workflows/phpstan-7.yaml +++ b/.github/workflows/phpstan-7.yaml @@ -21,3 +21,4 @@ jobs: with: path: src/ args: --level=5 + php_version: 8.1 diff --git a/.github/workflows/phpstan-8.yaml b/.github/workflows/phpstan-8.yaml index 27ac792..ee53c5e 100644 --- a/.github/workflows/phpstan-8.yaml +++ b/.github/workflows/phpstan-8.yaml @@ -21,3 +21,4 @@ jobs: with: path: src/ args: --level=5 + php_version: 8.1 diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml index 093c747..10dc85e 100644 --- a/.github/workflows/quality.yaml +++ b/.github/workflows/quality.yaml @@ -59,3 +59,4 @@ jobs: with: path: src/ args: --level=4 + php_version: 8.1 From 1ace4ef73a7ccacbff4f138064d281b1b8ab4b42 Mon Sep 17 00:00:00 2001 From: clemzarch Date: Tue, 7 Jun 2022 16:26:39 +0200 Subject: [PATCH 15/19] remove a check in the Lookup that could never be triggered --- src/Configuration/Lookup.php | 20 +++---- .../Configuration/ExtractorTest.php | 60 ------------------- tests/functional/Configuration/LookupTest.php | 18 +++--- 3 files changed, 15 insertions(+), 83 deletions(-) diff --git a/src/Configuration/Lookup.php b/src/Configuration/Lookup.php index b32a8ad..9f56d53 100644 --- a/src/Configuration/Lookup.php +++ b/src/Configuration/Lookup.php @@ -149,6 +149,14 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder /* @phpstan-ignore-next-line */ $builder->getRootNode() + ->validate() + ->ifTrue(fn ($data) => \count($data['conditional']) <= 0) + ->then(function ($data) { + unset($data['conditional']); + + return $data; + }) + ->end() ->validate() ->ifTrue(fn ($data) => !\array_key_exists('conditional', $data) && \is_array($data)) ->then(function (array $item) { @@ -171,14 +179,6 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder ->ifTrue(fn ($data) => !\array_key_exists('conditional', $data) && \array_key_exists('identifier', $data) && \array_key_exists('method', $data) && !\in_array($data['method'], ['get'])) ->thenInvalid('The identifier option should only be used with the "get" method.') ->end() - ->validate() - ->ifTrue(fn ($data) => \array_key_exists('conditional', $data) && \is_array($data['conditional']) && \count($data['conditional']) <= 0) - ->then(function ($data) { - unset($data['conditional']); - - return $data; - }) - ->end() ->children() ->scalarNode('type') ->validate() @@ -226,10 +226,6 @@ private function getConditionalTreeBuilder(): Config\Definition\Builder\TreeBuil $builder->getRootNode() ->cannotBeEmpty() ->requiresAtLeastOneElement() - ->validate() - ->ifTrue(fn ($data) => \count($data) <= 0) - ->thenUnset() - ->end() ->arrayPrototype() ->validate() ->ifArray() diff --git a/tests/functional/Configuration/ExtractorTest.php b/tests/functional/Configuration/ExtractorTest.php index 24afd19..4014b64 100644 --- a/tests/functional/Configuration/ExtractorTest.php +++ b/tests/functional/Configuration/ExtractorTest.php @@ -110,64 +110,4 @@ public function testInvalidMethodTypeConfig() ] ]); } - - public function testUnexpectedCodeOptionConfig() - { - $client = new Configuration\Extractor(); - - $this->expectException( - Config\Definition\Exception\InvalidConfigurationException::class, - ); - $this->expectExceptionMessage( - 'The code option should only be used with the "attributeOption" and "assetManager" endpoints.', - ); - - $this->processor->processConfiguration($client, [ - [ - 'method' => 'get', - 'type' => 'product', - 'code' => '123', - ] - ]); - } - - public function testUnexpectedProductMediaFileFieldConfig() - { - $client = new Configuration\Extractor(); - - $this->expectException( - Config\Definition\Exception\InvalidConfigurationException::class, - ); - $this->expectExceptionMessage( - 'Invalid configuration for path "extractor": The file option should only be used with the "productMediaFile" endpoint.', - ); - - $this->processor->processConfiguration($client, [ - [ - 'type' => 'product', - 'method' => 'all', - 'file' => 'foo' - ] - ]); - } - - public function testUnexpectedIdentifierFieldConfig() - { - $client = new Configuration\Extractor(); - - $this->expectException( - Config\Definition\Exception\InvalidConfigurationException::class, - ); - $this->expectExceptionMessage( - 'Invalid configuration for path "extractor": The identifier option should only be used with the "get" method.', - ); - - $this->processor->processConfiguration($client, [ - [ - 'type' => 'product', - 'method' => 'all', - 'identifier' => 'foo' - ] - ]); - } } diff --git a/tests/functional/Configuration/LookupTest.php b/tests/functional/Configuration/LookupTest.php index 29b5a99..042736a 100644 --- a/tests/functional/Configuration/LookupTest.php +++ b/tests/functional/Configuration/LookupTest.php @@ -187,10 +187,10 @@ public function wrongConfigs(): \Generator { yield [ 'config' => [ - 'type' => 'invalidType', - 'method' => 'all' + 'type' => 'product', + 'method' => 'download' ], - 'excepted_message' => 'Invalid configuration for path "lookup.type": The value should be one of [product, category, attribute, attributeOption, attributeGroup, family, productMediaFile, locale, channel, currency, measureFamily, associationType, familyVariant, productModel, publishedProduct, productModelDraft, productDraft, asset, assetCategory, assetTag, referenceEntityRecord, referenceEntityAttribute, referenceEntityAttributeOption, referenceEntity, assetManager, assetMediaFile], got "invalidType"', + 'excepted_message' => 'Invalid configuration for path "lookup": The value should be one of [listPerPage, all, get], got "download"', 'excepted_class' => 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException', ]; @@ -219,15 +219,11 @@ public function wrongConfigs(): \Generator yield [ 'config' => [ - 'conditional' => [ - [ - 'file' => '123', - 'type' => 'product', - 'method' => 'get', - ], - ], + 'file' => '123', + 'type' => 'product', + 'method' => 'get', ], - 'excepted_message' => 'Invalid configuration for path "lookup.conditional.0": The file option should only be used with the "productMediaFile', + 'excepted_message' => 'Invalid configuration for path "lookup": The file option should only be used with the "productMediaFile', 'excepted_class' => 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException', ]; From 1dad2dc53837a8569ae58a4b29dba8188369e498 Mon Sep 17 00:00:00 2001 From: clemzarch Date: Wed, 8 Jun 2022 11:47:14 +0200 Subject: [PATCH 16/19] test the Lookup capacity by providing the configuration as an array, attempt to test Factory/Client.php with a HttpClient, remove a try-catch that could never be triggered, raise min MSI to 60% --- infection.json.dist | 2 +- src/Factory/Extractor.php | 6 +--- src/Factory/Loader.php | 6 +--- .../functional/Builder/Lookup/LookupTest.php | 30 ++++++++-------- tests/functional/Factory/ClientTest.php | 36 +++++++++++++++++++ tests/functional/Factory/LoaderTest.php | 3 +- 6 files changed, 57 insertions(+), 26 deletions(-) diff --git a/infection.json.dist b/infection.json.dist index d6ee50b..774ee2e 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -23,6 +23,6 @@ }, "testFramework":"phpunit", "initialTestsPhpOptions": "-d zend_extension=xdebug -d xdebug.mode=coverage", - "minMsi": 50, + "minMsi": 60, "minCoveredMsi": 70 } diff --git a/src/Factory/Extractor.php b/src/Factory/Extractor.php index 64f4d51..2761804 100644 --- a/src/Factory/Extractor.php +++ b/src/Factory/Extractor.php @@ -81,10 +81,6 @@ public function compile(array $config): Repository\Extractor throw new Configurator\InvalidConfigurationException(message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', previous: $exception); } - try { - return new Repository\Extractor($builder); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { - throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); - } + return new Repository\Extractor($builder); } } diff --git a/src/Factory/Loader.php b/src/Factory/Loader.php index 7e19bff..ff33f8a 100644 --- a/src/Factory/Loader.php +++ b/src/Factory/Loader.php @@ -80,10 +80,6 @@ public function compile(array $config): Repository\Loader throw new Configurator\InvalidConfigurationException(message: 'Your Akeneo API configuration is using some unsupported capacity, check your "type" and "method" properties to a suitable set.', previous: $exception); } - try { - return new Repository\Loader($builder); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { - throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); - } + return new Repository\Loader($builder); } } diff --git a/tests/functional/Builder/Lookup/LookupTest.php b/tests/functional/Builder/Lookup/LookupTest.php index 01f74b8..8eb0d9f 100644 --- a/tests/functional/Builder/Lookup/LookupTest.php +++ b/tests/functional/Builder/Lookup/LookupTest.php @@ -6,9 +6,9 @@ use functional\Kiboko\Plugin\Akeneo\Mock; use Kiboko\Component\PHPUnitExtension\Assert\TransformerBuilderAssertTrait; use Kiboko\Plugin\Akeneo\Builder\AlternativeLookup; -use Kiboko\Plugin\Akeneo\Builder\Capacity; use Kiboko\Plugin\Akeneo\Builder\Lookup; -use PhpParser\Node; +use Kiboko\Plugin\Akeneo\Capacity; +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; final class LookupTest extends BuilderTestCase { @@ -37,10 +37,11 @@ public function testLookupProduct() ->withFileSystem(new Mock\FileSystemBuilder()) ->withAuthenticatedByPassword(); - $capacity = new Capacity\Lookup\Get(); - $capacity - ->withEndpoint(new Node\Identifier('getProductApi')) - ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); + $capacity = (new Capacity\Lookup\Get(new ExpressionLanguage()))->getBuilder([ + 'type' => 'product', + 'method' => 'get', + 'identifier' => '0987uiop', + ]); $builder = new Lookup(new AlternativeLookup($capacity)); $builder->withClient($client->getNode()); @@ -48,12 +49,12 @@ public function testLookupProduct() $this->assertBuildsTransformerTransformsLike( [ [ - "code" => "0987uiop" + "identifier" => "0987uiop" ] ], [ [ - "code" => "0987uiop" + "identifier" => "0987uiop" ] ], $builder, @@ -83,10 +84,11 @@ public function testConditionalLookupProduct() ->withFileSystem(new Mock\FileSystemBuilder()) ->withAuthenticatedByPassword(); - $capacity = new Capacity\Lookup\Get(); - $capacity - ->withEndpoint(new Node\Identifier('getProductApi')) - ->withIdentifier(new Node\Expr\ArrayDimFetch(new Node\Expr\Variable('output'), new Node\Scalar\String_('code'))); + $capacity = (new Capacity\Lookup\Get(new ExpressionLanguage()))->getBuilder([ + 'type' => 'product', + 'method' => 'get', + 'identifier' => '0987uiop' + ]); $builder = new Lookup(new AlternativeLookup($capacity)); $builder->withClient($client->getNode()); @@ -94,12 +96,12 @@ public function testConditionalLookupProduct() $this->assertBuildsTransformerTransformsLike( [ [ - "code" => "0987uiop" + "identifier" => "0987uiop" ] ], [ [ - "code" => "0987uiop" + "identifier" => "0987uiop" ] ], $builder, diff --git a/tests/functional/Factory/ClientTest.php b/tests/functional/Factory/ClientTest.php index e330a0c..16efe57 100644 --- a/tests/functional/Factory/ClientTest.php +++ b/tests/functional/Factory/ClientTest.php @@ -30,5 +30,41 @@ public function testValidateConfiguration() 'password' => '123', ] ])); + + $client->compile([ + 'api_url' => '123', + 'client_id' => '123', + 'secret' => '123', + 'username' => '123', + 'password' => '123', + ]); + } + + public function testWithHttpClient() + { + $client = new Client(new ExpressionLanguage()); + $this->assertTrue($client->validate([ + 'client' => [ + 'api_url' => '123', + 'client_id' => '123', + 'secret' => '123', + 'username' => '123', + 'password' => '123', + 'context' => [ + 'http_client' => 'truc' + ] + ] + ])); + + $client->compile([ + 'api_url' => '123', + 'client_id' => '123', + 'secret' => '123', + 'username' => '123', + 'password' => '123', + 'context' => [ + 'http_client' => 'foo' + ] + ]); } } diff --git a/tests/functional/Factory/LoaderTest.php b/tests/functional/Factory/LoaderTest.php index e132d9a..c171267 100644 --- a/tests/functional/Factory/LoaderTest.php +++ b/tests/functional/Factory/LoaderTest.php @@ -15,7 +15,8 @@ public function testValidateConfiguration() $this->assertTrue($client->validate([ [ 'type' => 'product', - 'method' => 'create', + 'method' => 'upsert', + 'code' => '123', ] ])); } From 3101b4da519c7e0474b20922f02dfd6dd21eec74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Mon, 26 Jun 2023 16:54:16 +0200 Subject: [PATCH 17/19] Fixed the lookup code building --- composer.json | 2 +- rector.php | 23 +++ src/Builder/Capacity/Extractor/All.php | 47 ++--- .../Capacity/Extractor/ListPerPage.php | 25 ++- src/Builder/Capacity/Lookup/All.php | 161 ++++++++++++++---- src/Builder/Capacity/Lookup/ListPerPage.php | 161 ++++++++++++++---- src/Capacity/Extractor/All.php | 16 +- src/Capacity/Extractor/ListPerPage.php | 19 ++- src/Capacity/Lookup/All.php | 17 +- src/Capacity/Lookup/Download.php | 4 +- src/Capacity/Lookup/ListPerPage.php | 18 +- src/Configuration.php | 4 + tests/functional/Builder/BuilderTestCase.php | 1 - 13 files changed, 366 insertions(+), 132 deletions(-) create mode 100644 rector.php diff --git a/composer.json b/composer.json index 1887e1f..8812504 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "nikic/php-parser": "^4.13.2", "symfony/config": "^5.2", "symfony/expression-language": "^5.2", - "php-etl/configurator-contracts": "^0.5.0", + "php-etl/configurator-contracts": "^0.5 || ^0.6 || ^0.7 || ^0.8", "php-etl/fast-map-plugin": "^0.7.0", "php-etl/packaging-contracts": "^0.1.0", "php-etl/satellite-toolbox": "^0.3.0" diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..672403a --- /dev/null +++ b/rector.php @@ -0,0 +1,23 @@ +paths([ + __DIR__ . '/src', + ]); + + $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); + + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_82, + PHPUnitLevelSetList::UP_TO_PHPUNIT_100, + SymfonyLevelSetList::UP_TO_SYMFONY_60, + ]); +}; diff --git a/src/Builder/Capacity/Extractor/All.php b/src/Builder/Capacity/Extractor/All.php index 8698aaa..b48fe5b 100644 --- a/src/Builder/Capacity/Extractor/All.php +++ b/src/Builder/Capacity/Extractor/All.php @@ -20,6 +20,7 @@ public function __construct() $this->endpoint = null; $this->search = null; $this->code = null; + $this->type = null; } public function withEndpoint(Node\Expr|Node\Identifier $endpoint): self @@ -57,17 +58,17 @@ public function getNode(): Node } return - new Node\Stmt\Foreach_( - expr: new Node\Expr\MethodCall( - var: new Node\Expr\MethodCall( + new Node\Stmt\Foreach_( + expr: new Node\Expr\MethodCall( + var: new Node\Expr\MethodCall( var: new Node\Expr\PropertyFetch( var: new Node\Expr\Variable('this'), name: new Node\Identifier('client') ), name: $this->endpoint ), - name: new Node\Identifier('all'), - args: array_filter( + name: new Node\Identifier('all'), + args: array_filter( [ new Node\Arg( value: new Node\Expr\Array_( @@ -84,24 +85,24 @@ public function getNode(): Node ) : null, ], ), - ), - valueVar: new Node\Expr\Variable('item'), - subNodes: [ - 'stmts' => [ - new Node\Stmt\Expression( - expr: new Node\Expr\Yield_( - value: new Node\Expr\New_( - class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\AcceptanceResultBucket'), - args: [ - new Node\Arg( - new Node\Expr\Variable('item') - ), - ], - ), - ), - ), - ], - ] + ), + valueVar: new Node\Expr\Variable('item'), + subNodes: [ + 'stmts' => [ + new Node\Stmt\Expression( + expr: new Node\Expr\Yield_( + value: new Node\Expr\New_( + class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\AcceptanceResultBucket'), + args: [ + new Node\Arg( + new Node\Expr\Variable('item') + ), + ], + ), + ), + ), + ], + ], ); } diff --git a/src/Builder/Capacity/Extractor/ListPerPage.php b/src/Builder/Capacity/Extractor/ListPerPage.php index 9912c38..6bb0bfc 100644 --- a/src/Builder/Capacity/Extractor/ListPerPage.php +++ b/src/Builder/Capacity/Extractor/ListPerPage.php @@ -13,12 +13,14 @@ final class ListPerPage implements Builder private null|Node\Expr|Node\Identifier $endpoint; private null|Node\Expr $search; private null|Node\Expr $code; + private null|string $type; public function __construct() { $this->endpoint = null; $this->search = null; $this->code = null; + $this->type = null; } public function withEndpoint(Node\Expr|Node\Identifier $endpoint): self @@ -35,13 +37,20 @@ public function withSearch(Node\Expr $search): self return $this; } - public function withCode(Node\Expr $code): self + public function withCode(?Node\Expr $code): self { $this->code = $code; return $this; } + public function withType(string $type): self + { + $this->type = $type; + + return $this; + } + public function getNode(): Node { if (null === $this->endpoint) { @@ -72,7 +81,7 @@ public function getNode(): Node ), null !== $this->code ? new Node\Arg( value: $this->code, - name: new Node\Identifier('attributeCode'), + name: $this->compileCodeNamedArgument($this->type), ) : null, ], ), @@ -93,8 +102,8 @@ class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\Acceptance ), ), ], - ] - ); + ], + ); } private function compileSearch(): array @@ -110,4 +119,12 @@ private function compileSearch(): array ), ]; } + + private function compileCodeNamedArgument(string $type): Node\Identifier + { + return match ($type) { + 'assetManager' => new Node\Identifier('assetFamilyCode'), + default => new Node\Identifier('attributeCode') + }; + } } diff --git a/src/Builder/Capacity/Lookup/All.php b/src/Builder/Capacity/Lookup/All.php index 6e90b8b..00c2211 100644 --- a/src/Builder/Capacity/Lookup/All.php +++ b/src/Builder/Capacity/Lookup/All.php @@ -4,6 +4,7 @@ namespace Kiboko\Plugin\Akeneo\Builder\Capacity\Lookup; +use Kiboko\Component\SatelliteToolbox\Builder\IsolatedValueAppendingBuilder; use Kiboko\Plugin\Akeneo\MissingEndpointException; use PhpParser\Builder; use PhpParser\Node; @@ -13,12 +14,14 @@ final class All implements Builder private null|Node\Expr|Node\Identifier $endpoint; private null|Node\Expr $search; private null|Node\Expr $code; + private null|string $type; public function __construct() { $this->endpoint = null; $this->search = null; $this->code = null; + $this->type = null; } public function withEndpoint(Node\Expr|Node\Identifier $endpoint): self @@ -35,66 +38,144 @@ public function withSearch(Node\Expr $search): self return $this; } - public function withCode(Node\Expr $code): self + public function withCode(?Node\Expr $code): self { $this->code = $code; return $this; } + public function withType(string $type): self + { + $this->type = $type; + + return $this; + } + public function getNode(): Node { if (null === $this->endpoint) { throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } - return - new Node\Stmt\Foreach_( - expr: new Node\Expr\MethodCall( - var: new Node\Expr\MethodCall( - var: new Node\Expr\PropertyFetch( - var: new Node\Expr\Variable('this'), - name: new Node\Identifier('client') + return (new IsolatedValueAppendingBuilder( + new Node\Expr\Variable('input'), + new Node\Expr\Variable('lookup'), + [ + new Node\Stmt\If_( + cond: new Node\Expr\FuncCall( + name: new Node\Name('is_null'), + args: array_filter( + [ + null !== $this->code ? new Node\Arg( + value: $this->code, + ) : null, + ], ), - name: $this->endpoint ), - name: new Node\Identifier('all'), - args: array_filter( - [ - new Node\Arg( - value: new Node\Expr\Array_( - items: $this->compileSearch(), - attributes: [ - 'kind' => Node\Expr\Array_::KIND_SHORT, - ] + subNodes: [ + 'stmts' => [ + new Node\Stmt\Return_( + expr: new Node\Expr\ConstFetch( + name: new Node\Name(name: 'null'), ), - name: new Node\Identifier('queryParameters'), ), - null !== $this->code ? new Node\Arg( - value: $this->code, - name: new Node\Identifier('attributeCode'), - ) : null, ], - ), + ], ), - valueVar: new Node\Expr\Variable('item'), - subNodes: [ - 'stmts' => [ + new Node\Stmt\TryCatch( + stmts: [ new Node\Stmt\Expression( - expr: new Node\Expr\Yield_( - value: new Node\Expr\New_( - class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\AcceptanceResultBucket'), - args: [ - new Node\Arg( - new Node\Expr\Variable('item') + expr: new Node\Expr\Assign( + var: new Node\Expr\Variable('items'), + expr: new Node\Expr\MethodCall( + var: new Node\Expr\MethodCall( + var: new Node\Expr\PropertyFetch( + var: new Node\Expr\Variable('this'), + name: new Node\Identifier('client'), ), - ], + name: $this->endpoint + ), + name: new Node\Identifier('all'), + args: array_filter( + [ + new Node\Arg( + value: new Node\Expr\Array_( + items: $this->compileSearch(), + attributes: [ + 'kind' => Node\Expr\Array_::KIND_SHORT, + ] + ), + name: new Node\Identifier('queryParameters'), + ), + null !== $this->code ? new Node\Arg( + value: $this->code, + name: $this->compileCodeNamedArgument($this->type), + ) : null, + ], + ), ), ), ), ], - ] - ); + catches: [ + new Node\Stmt\Catch_( + types: [ + new Node\Name\FullyQualified('Akeneo\Pim\ApiClient\Exception\HttpException'), + ], + var: new Node\Expr\Variable('exception'), + stmts: [ + new Node\Stmt\Expression( + expr: new Node\Expr\MethodCall( + var: new Node\Expr\PropertyFetch( + var: new Node\Expr\Variable('this'), + name: 'logger', + ), + name: new Node\Identifier('error'), + args: [ + new Node\Arg( + value: new Node\Expr\MethodCall( + var: new Node\Expr\Variable('exception'), + name: new Node\Identifier('getMessage'), + ), + ), + new Node\Arg( + value: new Node\Expr\Array_( + items: [ + new Node\Expr\ArrayItem( + value: new Node\Expr\Variable('exception'), + key: new Node\Scalar\String_('exception'), + ), + ], + attributes: [ + 'kind' => Node\Expr\Array_::KIND_SHORT, + ], + ), + ), + ], + ), + ), + new Node\Stmt\Expression( + expr: new Node\Expr\MethodCall( + var: new Node\Expr\Variable('bucket'), + name: new Node\Identifier('reject'), + args: [ + new Node\Arg( + new Node\Expr\Variable('input'), + ), + ], + ) + ), + ], + ), + ], + ), + new Node\Stmt\Return_( + expr: new Node\Expr\Variable('items'), + ), + ], + new Node\Expr\Variable('bucket') + ))->getNode(); } private function compileSearch(): array @@ -110,4 +191,12 @@ private function compileSearch(): array ), ]; } + + private function compileCodeNamedArgument(string $type): Node\Identifier + { + return match ($type) { + 'assetManager' => new Node\Identifier('assetFamilyCode'), + default => new Node\Identifier('attributeCode') + }; + } } diff --git a/src/Builder/Capacity/Lookup/ListPerPage.php b/src/Builder/Capacity/Lookup/ListPerPage.php index 6c0172b..16599f2 100644 --- a/src/Builder/Capacity/Lookup/ListPerPage.php +++ b/src/Builder/Capacity/Lookup/ListPerPage.php @@ -4,6 +4,7 @@ namespace Kiboko\Plugin\Akeneo\Builder\Capacity\Lookup; +use Kiboko\Component\SatelliteToolbox\Builder\IsolatedValueAppendingBuilder; use Kiboko\Plugin\Akeneo\MissingEndpointException; use PhpParser\Builder; use PhpParser\Node; @@ -13,12 +14,14 @@ final class ListPerPage implements Builder private null|Node\Expr|Node\Identifier $endpoint; private null|Node\Expr $search; private null|Node\Expr $code; + private null|string $type; public function __construct() { $this->endpoint = null; $this->search = null; $this->code = null; + $this->type = null; } public function withEndpoint(Node\Expr|Node\Identifier $endpoint): self @@ -35,66 +38,144 @@ public function withSearch(Node\Expr $search): self return $this; } - public function withCode(Node\Expr $code): self + public function withCode(?Node\Expr $code): self { $this->code = $code; return $this; } + public function withType(string $type): self + { + $this->type = $type; + + return $this; + } + public function getNode(): Node { if (null === $this->endpoint) { throw new MissingEndpointException(message: 'Please check your capacity builder, you should have selected an endpoint.'); } - return - new Node\Stmt\Foreach_( - expr: new Node\Expr\MethodCall( - var: new Node\Expr\MethodCall( - var: new Node\Expr\PropertyFetch( - var: new Node\Expr\Variable('this'), - name: new Node\Identifier('client') + return (new IsolatedValueAppendingBuilder( + new Node\Expr\Variable('input'), + new Node\Expr\Variable('lookup'), + [ + new Node\Stmt\If_( + cond: new Node\Expr\FuncCall( + name: new Node\Name('is_null'), + args: array_filter( + [ + null !== $this->code ? new Node\Arg( + value: $this->code, + ) : null, + ], ), - name: $this->endpoint ), - name: new Node\Identifier('listPerPage'), - args: array_filter( - [ - new Node\Arg( - value: new Node\Expr\Array_( - items: $this->compileSearch(), - attributes: [ - 'kind' => Node\Expr\Array_::KIND_SHORT, - ] + subNodes: [ + 'stmts' => [ + new Node\Stmt\Return_( + expr: new Node\Expr\ConstFetch( + name: new Node\Name(name: 'null'), ), - name: new Node\Identifier('queryParameters'), ), - null !== $this->code ? new Node\Arg( - value: $this->code, - name: new Node\Identifier('attributeCode'), - ) : null, ], - ), + ], ), - valueVar: new Node\Expr\Variable('item'), - subNodes: [ - 'stmts' => [ + new Node\Stmt\TryCatch( + stmts: [ new Node\Stmt\Expression( - expr: new Node\Expr\Yield_( - value: new Node\Expr\New_( - class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\AcceptanceResultBucket'), - args: [ - new Node\Arg( - new Node\Expr\Variable('item') + expr: new Node\Expr\Assign( + var: new Node\Expr\Variable('items'), + expr: new Node\Expr\MethodCall( + var: new Node\Expr\MethodCall( + var: new Node\Expr\PropertyFetch( + var: new Node\Expr\Variable('this'), + name: new Node\Identifier('client'), ), - ], + name: $this->endpoint + ), + name: new Node\Identifier('listPerPage'), + args: array_filter( + [ + new Node\Arg( + value: new Node\Expr\Array_( + items: $this->compileSearch(), + attributes: [ + 'kind' => Node\Expr\Array_::KIND_SHORT, + ] + ), + name: new Node\Identifier('queryParameters'), + ), + null !== $this->code ? new Node\Arg( + value: $this->code, + name: $this->compileCodeNamedArgument($this->type), + ) : null, + ], + ), ), ), ), ], - ] - ); + catches: [ + new Node\Stmt\Catch_( + types: [ + new Node\Name\FullyQualified('Akeneo\Pim\ApiClient\Exception\HttpException'), + ], + var: new Node\Expr\Variable('exception'), + stmts: [ + new Node\Stmt\Expression( + expr: new Node\Expr\MethodCall( + var: new Node\Expr\PropertyFetch( + var: new Node\Expr\Variable('this'), + name: 'logger', + ), + name: new Node\Identifier('error'), + args: [ + new Node\Arg( + value: new Node\Expr\MethodCall( + var: new Node\Expr\Variable('exception'), + name: new Node\Identifier('getMessage'), + ), + ), + new Node\Arg( + value: new Node\Expr\Array_( + items: [ + new Node\Expr\ArrayItem( + value: new Node\Expr\Variable('exception'), + key: new Node\Scalar\String_('exception'), + ), + ], + attributes: [ + 'kind' => Node\Expr\Array_::KIND_SHORT, + ], + ), + ), + ], + ), + ), + new Node\Stmt\Expression( + expr: new Node\Expr\MethodCall( + var: new Node\Expr\Variable('bucket'), + name: new Node\Identifier('reject'), + args: [ + new Node\Arg( + new Node\Expr\Variable('input'), + ), + ], + ) + ), + ], + ), + ], + ), + new Node\Stmt\Return_( + expr: new Node\Expr\Variable('items'), + ), + ], + new Node\Expr\Variable('bucket') + ))->getNode(); } private function compileSearch(): array @@ -110,4 +191,12 @@ private function compileSearch(): array ), ]; } + + private function compileCodeNamedArgument(string $type): Node\Identifier + { + return match ($type) { + 'assetManager' => new Node\Identifier('assetFamilyCode'), + default => new Node\Identifier('attributeCode') + }; + } } diff --git a/src/Capacity/Extractor/All.php b/src/Capacity/Extractor/All.php index 8377418..354c678 100644 --- a/src/Capacity/Extractor/All.php +++ b/src/Capacity/Extractor/All.php @@ -4,7 +4,6 @@ namespace Kiboko\Plugin\Akeneo\Capacity\Extractor; -use function Kiboko\Component\SatelliteToolbox\Configuration\compileValue; use function Kiboko\Component\SatelliteToolbox\Configuration\compileValueWhenExpression; use Kiboko\Contract\Configurator\InvalidConfigurationException; use Kiboko\Plugin\Akeneo; @@ -42,6 +41,7 @@ final class All implements Akeneo\Capacity\CapacityInterface 'referenceEntityAttributeOption', 'referenceEntity', 'assetManager', + 'assetMediaFile', ]; public function __construct(private ExpressionLanguage $interpreter) @@ -68,11 +68,11 @@ private function compileFilters(array ...$filters): Node\Expr } $builder->addFilter( - field: compileValue($this->interpreter, $filter['field']), - operator: compileValue($this->interpreter, $filter['operator']), - value: \array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter['value']) : null, - scope: \array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter['scope']) : null, - locale: \array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter['locale']) : null + field: compileValueWhenExpression($this->interpreter, $filter['field']), + operator: compileValueWhenExpression($this->interpreter, $filter['operator']), + value: \array_key_exists('value', $filter) ? compileValueWhenExpression($this->interpreter, $filter['value']) : null, + scope: \array_key_exists('scope', $filter) ? compileValueWhenExpression($this->interpreter, $filter['scope']) : null, + locale: \array_key_exists('locale', $filter) ? compileValueWhenExpression($this->interpreter, $filter['locale']) : null ); } @@ -90,7 +90,9 @@ public function getBuilder(array $config): Builder $builder->withSearch($this->compileFilters(...$config['search'])); } - if (\in_array($config['type'], ['attributeOption', 'assetManager']) && \array_key_exists('code', $config)) { + if (\in_array($config['type'], ['attributeOption', 'assetManager', 'assetAttribute', 'assetAttributeOption', 'familyVariant', 'referenceEntityAttribute', 'referenceEntityAttributeOption', 'referenceEntityRecord']) + && \array_key_exists('code', $config) + ) { $builder->withCode(compileValueWhenExpression($this->interpreter, $config['code'])); } diff --git a/src/Capacity/Extractor/ListPerPage.php b/src/Capacity/Extractor/ListPerPage.php index 66ca291..a69997e 100644 --- a/src/Capacity/Extractor/ListPerPage.php +++ b/src/Capacity/Extractor/ListPerPage.php @@ -4,7 +4,7 @@ namespace Kiboko\Plugin\Akeneo\Capacity\Extractor; -use function Kiboko\Component\SatelliteToolbox\Configuration\compileValue; +use function Kiboko\Component\SatelliteToolbox\Configuration\compileValueWhenExpression; use Kiboko\Contract\Configurator\InvalidConfigurationException; use Kiboko\Plugin\Akeneo; use PhpParser\Builder; @@ -40,6 +40,8 @@ final class ListPerPage implements Akeneo\Capacity\CapacityInterface 'referenceEntityAttribute', 'referenceEntityAttributeOption', 'referenceEntity', + 'assetManager', + 'assetMediaFile', ]; public function __construct(private ExpressionLanguage $interpreter) @@ -66,11 +68,11 @@ private function compileFilters(array ...$filters): Node\Expr } $builder->addFilter( - field: compileValue($this->interpreter, $filter['field']), - operator: compileValue($this->interpreter, $filter['operator']), - value: \array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter['value']) : null, - scope: \array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter['scope']) : null, - locale: \array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter['locale']) : null + field: compileValueWhenExpression($this->interpreter, $filter['field']), + operator: compileValueWhenExpression($this->interpreter, $filter['operator']), + value: \array_key_exists('value', $filter) ? compileValueWhenExpression($this->interpreter, $filter['value']) : null, + scope: \array_key_exists('scope', $filter) ? compileValueWhenExpression($this->interpreter, $filter['scope']) : null, + locale: \array_key_exists('locale', $filter) ? compileValueWhenExpression($this->interpreter, $filter['locale']) : null ); } @@ -81,16 +83,17 @@ public function getBuilder(array $config): Builder { $builder = (new Akeneo\Builder\Capacity\Extractor\ListPerPage()) ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) + ->withType($config['type']) ; if (isset($config['search']) && \is_array($config['search'])) { $builder->withSearch($this->compileFilters(...$config['search'])); } - if (\in_array($config['type'], ['attributeOption']) + if (\in_array($config['type'], ['attributeOption', 'assetManager', 'assetAttribute', 'assetAttributeOption', 'familyVariant', 'referenceEntityAttribute', 'referenceEntityAttributeOption', 'referenceEntityRecord']) && \array_key_exists('code', $config) ) { - $builder->withCode(compileValue($this->interpreter, $config['code'])); + $builder->withCode(compileValueWhenExpression($this->interpreter, $config['code'])); } return $builder; diff --git a/src/Capacity/Lookup/All.php b/src/Capacity/Lookup/All.php index 4f1d4a5..f077b64 100644 --- a/src/Capacity/Lookup/All.php +++ b/src/Capacity/Lookup/All.php @@ -4,7 +4,6 @@ namespace Kiboko\Plugin\Akeneo\Capacity\Lookup; -use function Kiboko\Component\SatelliteToolbox\Configuration\compileValue; use function Kiboko\Component\SatelliteToolbox\Configuration\compileValueWhenExpression; use Kiboko\Contract\Configurator\InvalidConfigurationException; use Kiboko\Plugin\Akeneo; @@ -42,6 +41,7 @@ final class All implements Akeneo\Capacity\CapacityInterface 'referenceEntityAttributeOption', 'referenceEntity', 'assetManager', + 'assetMediaFile', ]; public function __construct(private ExpressionLanguage $interpreter) @@ -68,11 +68,11 @@ private function compileFilters(array ...$filters): Node\Expr } $builder->addFilter( - field: compileValue($this->interpreter, $filter['field']), - operator: compileValue($this->interpreter, $filter['operator']), - value: \array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter['value']) : null, - scope: \array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter['scope']) : null, - locale: \array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter['locale']) : null + field: compileValueWhenExpression($this->interpreter, $filter['field']), + operator: compileValueWhenExpression($this->interpreter, $filter['operator']), + value: \array_key_exists('value', $filter) ? compileValueWhenExpression($this->interpreter, $filter['value']) : null, + scope: \array_key_exists('scope', $filter) ? compileValueWhenExpression($this->interpreter, $filter['scope']) : null, + locale: \array_key_exists('locale', $filter) ? compileValueWhenExpression($this->interpreter, $filter['locale']) : null ); } @@ -83,13 +83,16 @@ public function getBuilder(array $config): Builder { $builder = (new Akeneo\Builder\Capacity\Lookup\All()) ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) + ->withType($config['type']) ; if (isset($config['search']) && \is_array($config['search'])) { $builder->withSearch($this->compileFilters(...$config['search'])); } - if (\in_array($config['type'], ['attributeOption', 'assetManager']) && \array_key_exists('code', $config)) { + if (\in_array($config['type'], ['attributeOption', 'assetManager', 'assetAttribute', 'assetAttributeOption', 'familyVariant', 'referenceEntityAttribute', 'referenceEntityAttributeOption', 'referenceEntityRecord']) + && \array_key_exists('code', $config) + ) { $builder->withCode(compileValueWhenExpression($this->interpreter, $config['code'])); } diff --git a/src/Capacity/Lookup/Download.php b/src/Capacity/Lookup/Download.php index f98dc0f..8075d38 100644 --- a/src/Capacity/Lookup/Download.php +++ b/src/Capacity/Lookup/Download.php @@ -4,12 +4,14 @@ namespace Kiboko\Plugin\Akeneo\Capacity\Lookup; +use Kiboko\Contract\Configurator\InvalidConfigurationException; use function Kiboko\Component\SatelliteToolbox\Configuration\compileValue; use Kiboko\Contract\Configurator; use Kiboko\Plugin\Akeneo; use PhpParser\Builder; use PhpParser\Node; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use function Kiboko\Component\SatelliteToolbox\Configuration\compileValueWhenExpression; final class Download implements Akeneo\Capacity\CapacityInterface { @@ -42,7 +44,7 @@ public function getBuilder(array $config): Builder if (!\array_key_exists('file', $config)) { throw new Configurator\InvalidConfigurationException('The configuration option "file" should be defined.'); } - $builder->withFile(compileValue($this->interpreter, $config['file'])); + $builder->withFile(compileValueWhenExpression($this->interpreter, $config['file'])); return $builder; } diff --git a/src/Capacity/Lookup/ListPerPage.php b/src/Capacity/Lookup/ListPerPage.php index 924a1e3..01274d9 100644 --- a/src/Capacity/Lookup/ListPerPage.php +++ b/src/Capacity/Lookup/ListPerPage.php @@ -4,7 +4,7 @@ namespace Kiboko\Plugin\Akeneo\Capacity\Lookup; -use function Kiboko\Component\SatelliteToolbox\Configuration\compileValue; +use function Kiboko\Component\SatelliteToolbox\Configuration\compileValueWhenExpression; use Kiboko\Contract\Configurator\InvalidConfigurationException; use Kiboko\Plugin\Akeneo; use PhpParser\Builder; @@ -40,6 +40,7 @@ final class ListPerPage implements Akeneo\Capacity\CapacityInterface 'referenceEntityAttribute', 'referenceEntityAttributeOption', 'referenceEntity', + 'assetManager', ]; public function __construct(private ExpressionLanguage $interpreter) @@ -66,11 +67,11 @@ private function compileFilters(array ...$filters): Node\Expr } $builder->addFilter( - field: compileValue($this->interpreter, $filter['field']), - operator: compileValue($this->interpreter, $filter['operator']), - value: \array_key_exists('value', $filter) ? compileValue($this->interpreter, $filter['value']) : null, - scope: \array_key_exists('scope', $filter) ? compileValue($this->interpreter, $filter['scope']) : null, - locale: \array_key_exists('locale', $filter) ? compileValue($this->interpreter, $filter['locale']) : null + field: compileValueWhenExpression($this->interpreter, $filter['field']), + operator: compileValueWhenExpression($this->interpreter, $filter['operator']), + value: \array_key_exists('value', $filter) ? compileValueWhenExpression($this->interpreter, $filter['value']) : null, + scope: \array_key_exists('scope', $filter) ? compileValueWhenExpression($this->interpreter, $filter['scope']) : null, + locale: \array_key_exists('locale', $filter) ? compileValueWhenExpression($this->interpreter, $filter['locale']) : null ); } @@ -81,16 +82,17 @@ public function getBuilder(array $config): Builder { $builder = (new Akeneo\Builder\Capacity\Lookup\ListPerPage()) ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst($config['type'])))) + ->withType($config['type']) ; if (isset($config['search']) && \is_array($config['search'])) { $builder->withSearch($this->compileFilters(...$config['search'])); } - if (\in_array($config['type'], ['attributeOption']) + if (\in_array($config['type'], ['attributeOption', 'assetManager', 'assetAttribute', 'assetAttributeOption', 'familyVariant', 'referenceEntityAttribute', 'referenceEntityAttributeOption', 'referenceEntityRecord']) && \array_key_exists('code', $config) ) { - $builder->withCode(compileValue($this->interpreter, $config['code'])); + $builder->withCode(compileValueWhenExpression($this->interpreter, $config['code'])); } return $builder; diff --git a/src/Configuration.php b/src/Configuration.php index fcd99b1..d1dc706 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -6,6 +6,7 @@ use Kiboko\Contract\Configurator\PluginConfigurationInterface; use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use function Kiboko\Component\SatelliteToolbox\Configuration\mutuallyExclusiveFields; final class Configuration implements PluginConfigurationInterface { @@ -36,6 +37,9 @@ public function getConfigTreeBuilder() ->setDeprecated('php-etl/akeneo-plugin', '0.1') ->end() ->end() + ->validate() + ->always(mutuallyExclusiveFields('extract', 'transform', 'lookup')) + ->end() ; return $builder; diff --git a/tests/functional/Builder/BuilderTestCase.php b/tests/functional/Builder/BuilderTestCase.php index 4d18db8..a09c162 100644 --- a/tests/functional/Builder/BuilderTestCase.php +++ b/tests/functional/Builder/BuilderTestCase.php @@ -6,7 +6,6 @@ use Kiboko\Contract\Pipeline\PipelineRunnerInterface; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; -use org\bovigo\vfs\vfsStreamWrapper; use PhpParser\Node; use PhpParser\PrettyPrinter; use PhpParser\Builder as DefaultBuilder; From 303db3a629c8ae182c879762fe71689766395314 Mon Sep 17 00:00:00 2001 From: clementzarch Date: Fri, 11 Aug 2023 12:07:47 +0200 Subject: [PATCH 18/19] remove requirement for Enterprise Edition of client --- src/Service.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Service.php b/src/Service.php index 7b6a4e1..1d9d56d 100644 --- a/src/Service.php +++ b/src/Service.php @@ -12,7 +12,7 @@ #[Configurator\Pipeline( name: 'akeneo', dependencies: [ - 'akeneo/api-php-client-ee', + 'akeneo/api-php-client', 'laminas/laminas-diactoros', 'php-http/guzzle7-adapter', ], From 940910bc634f2bc27538dafa62d99e0a137e99cd Mon Sep 17 00:00:00 2001 From: clementzarch Date: Fri, 11 Aug 2023 15:25:43 +0200 Subject: [PATCH 19/19] raise min MSI, [rector] Rector fixes, avoid case where we build "is_null(null)" --- infection.json.dist | 4 ++-- .../Capacity/Extractor/ListPerPage.php | 4 ++-- src/Builder/Capacity/Loader/Upsert.php | 4 ++-- src/Builder/Capacity/Lookup/All.php | 22 +++++++++---------- src/Builder/Capacity/Lookup/ListPerPage.php | 22 +++++++++---------- src/Builder/Client.php | 2 +- src/Builder/ConditionalLookup.php | 10 ++++----- src/Builder/Extractor.php | 8 +++---- src/Builder/Loader.php | 8 +++---- src/Builder/Lookup.php | 10 ++++----- src/Capacity/Extractor/All.php | 1 - src/Capacity/Lookup/All.php | 2 +- src/Configuration/Loader.php | 4 ++-- 13 files changed, 48 insertions(+), 53 deletions(-) diff --git a/infection.json.dist b/infection.json.dist index 59d2346..1dd827b 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -20,6 +20,6 @@ "@default": true }, "testFramework":"phpunit", - "minMsi": 30, - "minCoveredMsi": 40 + "minMsi": 50, + "minCoveredMsi": 60 } diff --git a/src/Builder/Capacity/Extractor/ListPerPage.php b/src/Builder/Capacity/Extractor/ListPerPage.php index 725019f..5d0705f 100644 --- a/src/Builder/Capacity/Extractor/ListPerPage.php +++ b/src/Builder/Capacity/Extractor/ListPerPage.php @@ -88,7 +88,7 @@ public function getNode(): Node new Node\Stmt\Expression( expr: new Node\Expr\Yield_( value: new Node\Expr\New_( - class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\AcceptanceResultBucket'), + class: new Node\Name\FullyQualified(name: \Kiboko\Component\Bucket\AcceptanceResultBucket::class), args: [ new Node\Arg( new Node\Expr\Variable('item') @@ -99,7 +99,7 @@ class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\Acceptance ), ], ], - ); + ); } private function compileSearch(): array diff --git a/src/Builder/Capacity/Loader/Upsert.php b/src/Builder/Capacity/Loader/Upsert.php index 5f7dd55..da32f5b 100644 --- a/src/Builder/Capacity/Loader/Upsert.php +++ b/src/Builder/Capacity/Loader/Upsert.php @@ -94,7 +94,7 @@ public function getNode(): Node var: new Node\Expr\Variable('line'), expr: new Node\Expr\Yield_( value: new Node\Expr\New_( - class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\AcceptanceResultBucket'), + class: new Node\Name\FullyQualified(name: \Kiboko\Component\Bucket\AcceptanceResultBucket::class), args: [ new Node\Arg( value: new Node\Expr\Variable('line'), @@ -109,7 +109,7 @@ class: new Node\Name\FullyQualified(name: 'Kiboko\\Component\\Bucket\\Acceptance new Node\Stmt\Catch_( types: [ new Node\Name\FullyQualified( - name: 'Akeneo\\Pim\\ApiClient\\Exception\\HttpException', + name: \Akeneo\Pim\ApiClient\Exception\HttpException::class, ), ], var: new Node\Expr\Variable('exception'), diff --git a/src/Builder/Capacity/Lookup/All.php b/src/Builder/Capacity/Lookup/All.php index daf4a30..36231c2 100644 --- a/src/Builder/Capacity/Lookup/All.php +++ b/src/Builder/Capacity/Lookup/All.php @@ -57,17 +57,15 @@ public function getNode(): Node return (new IsolatedValueAppendingBuilder( new Node\Expr\Variable('input'), new Node\Expr\Variable('lookup'), - [ - new Node\Stmt\If_( + array_filter([ + $this->code ? new Node\Stmt\If_( cond: new Node\Expr\FuncCall( name: new Node\Name('is_null'), - args: array_filter( - [ - null !== $this->code ? new Node\Arg( - value: $this->code, - ) : null, - ], - ), + args: [ + new Node\Arg( + value: $this->code, + ), + ], ), subNodes: [ 'stmts' => [ @@ -78,7 +76,7 @@ public function getNode(): Node ), ], ], - ), + ) : null, new Node\Stmt\TryCatch( stmts: [ new Node\Stmt\Expression( @@ -117,7 +115,7 @@ public function getNode(): Node catches: [ new Node\Stmt\Catch_( types: [ - new Node\Name\FullyQualified('Akeneo\Pim\ApiClient\Exception\HttpException'), + new Node\Name\FullyQualified(\Akeneo\Pim\ApiClient\Exception\HttpException::class), ], var: new Node\Expr\Variable('exception'), stmts: [ @@ -169,7 +167,7 @@ public function getNode(): Node new Node\Stmt\Return_( expr: new Node\Expr\Variable('items'), ), - ], + ]), new Node\Expr\Variable('bucket') ))->getNode(); } diff --git a/src/Builder/Capacity/Lookup/ListPerPage.php b/src/Builder/Capacity/Lookup/ListPerPage.php index 0ff8990..47df875 100644 --- a/src/Builder/Capacity/Lookup/ListPerPage.php +++ b/src/Builder/Capacity/Lookup/ListPerPage.php @@ -57,17 +57,15 @@ public function getNode(): Node return (new IsolatedValueAppendingBuilder( new Node\Expr\Variable('input'), new Node\Expr\Variable('lookup'), - [ - new Node\Stmt\If_( + array_filter([ + $this->code ? new Node\Stmt\If_( cond: new Node\Expr\FuncCall( name: new Node\Name('is_null'), - args: array_filter( - [ - null !== $this->code ? new Node\Arg( - value: $this->code, - ) : null, - ], - ), + args: [ + new Node\Arg( + value: $this->code, + ), + ], ), subNodes: [ 'stmts' => [ @@ -78,7 +76,7 @@ public function getNode(): Node ), ], ], - ), + ) : null, new Node\Stmt\TryCatch( stmts: [ new Node\Stmt\Expression( @@ -117,7 +115,7 @@ public function getNode(): Node catches: [ new Node\Stmt\Catch_( types: [ - new Node\Name\FullyQualified('Akeneo\Pim\ApiClient\Exception\HttpException'), + new Node\Name\FullyQualified(\Akeneo\Pim\ApiClient\Exception\HttpException::class), ], var: new Node\Expr\Variable('exception'), stmts: [ @@ -169,7 +167,7 @@ public function getNode(): Node new Node\Stmt\Return_( expr: new Node\Expr\Variable('items'), ), - ], + ]), new Node\Expr\Variable('bucket') ))->getNode(); } diff --git a/src/Builder/Client.php b/src/Builder/Client.php index 0afde3f..a143a3f 100644 --- a/src/Builder/Client.php +++ b/src/Builder/Client.php @@ -70,7 +70,7 @@ public function withFileSystem(Node\Expr $fileSystem): self public function getNode(): Node\Expr\MethodCall { $instance = new Node\Expr\New_( - new Node\Name\FullyQualified('Akeneo\\Pim\\ApiClient\\AkeneoPimClientBuilder'), + new Node\Name\FullyQualified(\Akeneo\Pim\ApiClient\AkeneoPimClientBuilder::class), [ new Node\Arg($this->baseUrl), ], diff --git a/src/Builder/ConditionalLookup.php b/src/Builder/ConditionalLookup.php index 105e762..3b6bc65 100644 --- a/src/Builder/ConditionalLookup.php +++ b/src/Builder/ConditionalLookup.php @@ -74,7 +74,7 @@ private function compileAllAlternatives(): Node expr: new Node\Expr\Assign( var: new Node\Expr\Variable('bucket'), expr: new Node\Expr\New_( - new Node\Name\FullyQualified('Kiboko\Component\Bucket\ComplexResultBucket') + new Node\Name\FullyQualified(\Kiboko\Component\Bucket\ComplexResultBucket::class) ) ) ), @@ -126,7 +126,7 @@ class: new Node\Stmt\Class_( name: null, subNodes: [ 'implements' => [ - new Node\Name\FullyQualified(name: 'Kiboko\\Contract\\Pipeline\\TransformerInterface'), + new Node\Name\FullyQualified(name: \Kiboko\Contract\Pipeline\TransformerInterface::class), ], 'stmts' => [ new Node\Stmt\ClassMethod( @@ -136,12 +136,12 @@ class: new Node\Stmt\Class_( 'params' => [ new Node\Param( var: new Node\Expr\Variable('client'), - type: new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface'), + type: new Node\Name\FullyQualified(name: \Akeneo\Pim\ApiClient\AkeneoPimClientInterface::class), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), new Node\Param( var: new Node\Expr\Variable('logger'), - type: new Node\Name\FullyQualified(name: 'Psr\\Log\\LoggerInterface'), + type: new Node\Name\FullyQualified(name: \Psr\Log\LoggerInterface::class), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), ], @@ -170,7 +170,7 @@ class: new Node\Stmt\Class_( ), args: [ new Node\Arg(value: $this->client), - new Node\Arg(value: $this->logger ?? new Node\Expr\New_(new Node\Name\FullyQualified('Psr\\Log\\NullLogger'))), + new Node\Arg(value: $this->logger ?? new Node\Expr\New_(new Node\Name\FullyQualified(\Psr\Log\NullLogger::class))), ], ); } diff --git a/src/Builder/Extractor.php b/src/Builder/Extractor.php index bc3365f..8651637 100644 --- a/src/Builder/Extractor.php +++ b/src/Builder/Extractor.php @@ -49,7 +49,7 @@ class: new Node\Stmt\Class_( name: null, subNodes: [ 'implements' => [ - new Node\Name\FullyQualified(name: 'Kiboko\\Contract\\Pipeline\\ExtractorInterface'), + new Node\Name\FullyQualified(name: \Kiboko\Contract\Pipeline\ExtractorInterface::class), ], 'stmts' => [ new Node\Stmt\ClassMethod( @@ -59,12 +59,12 @@ class: new Node\Stmt\Class_( 'params' => [ new Node\Param( var: new Node\Expr\Variable('client'), - type: new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface'), + type: new Node\Name\FullyQualified(name: \Akeneo\Pim\ApiClient\AkeneoPimClientInterface::class), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), new Node\Param( var: new Node\Expr\Variable('logger'), - type: new Node\Name\FullyQualified(name: 'Psr\\Log\\LoggerInterface'), + type: new Node\Name\FullyQualified(name: \Psr\Log\LoggerInterface::class), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), ], @@ -215,7 +215,7 @@ class: new Node\Stmt\Class_( ), args: [ new Node\Arg(value: $this->client), - new Node\Arg(value: $this->logger ?? new Node\Expr\New_(new Node\Name\FullyQualified('Psr\\Log\\NullLogger'))), + new Node\Arg(value: $this->logger ?? new Node\Expr\New_(new Node\Name\FullyQualified(\Psr\Log\NullLogger::class))), ], ); } diff --git a/src/Builder/Loader.php b/src/Builder/Loader.php index 64d9cf2..d5d4eb8 100644 --- a/src/Builder/Loader.php +++ b/src/Builder/Loader.php @@ -49,7 +49,7 @@ class: new Node\Stmt\Class_( name: null, subNodes: [ 'implements' => [ - new Node\Name\FullyQualified(name: 'Kiboko\\Contract\\Pipeline\\LoaderInterface'), + new Node\Name\FullyQualified(name: \Kiboko\Contract\Pipeline\LoaderInterface::class), ], 'stmts' => [ new Node\Stmt\ClassMethod( @@ -59,12 +59,12 @@ class: new Node\Stmt\Class_( 'params' => [ new Node\Param( var: new Node\Expr\Variable('client'), - type: new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface'), + type: new Node\Name\FullyQualified(name: \Akeneo\Pim\ApiClient\AkeneoPimClientInterface::class), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), new Node\Param( var: new Node\Expr\Variable('logger'), - type: new Node\Name\FullyQualified(name: 'Psr\\Log\\LoggerInterface'), + type: new Node\Name\FullyQualified(name: \Psr\Log\LoggerInterface::class), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), ], @@ -136,7 +136,7 @@ class: new Node\Stmt\Class_( ), args: [ new Node\Arg(value: $this->client), - new Node\Arg(value: $this->logger ?? new Node\Expr\New_(new Node\Name\FullyQualified('Psr\\Log\\NullLogger'))), + new Node\Arg(value: $this->logger ?? new Node\Expr\New_(new Node\Name\FullyQualified(\Psr\Log\NullLogger::class))), ], ); } diff --git a/src/Builder/Lookup.php b/src/Builder/Lookup.php index f659f1c..bd3a004 100644 --- a/src/Builder/Lookup.php +++ b/src/Builder/Lookup.php @@ -61,7 +61,7 @@ class: new Node\Stmt\Class_( name: null, subNodes: [ 'implements' => [ - new Node\Name\FullyQualified(name: 'Kiboko\\Contract\\Pipeline\\TransformerInterface'), + new Node\Name\FullyQualified(name: \Kiboko\Contract\Pipeline\TransformerInterface::class), ], 'stmts' => [ new Node\Stmt\ClassMethod( @@ -71,12 +71,12 @@ class: new Node\Stmt\Class_( 'params' => [ new Node\Param( var: new Node\Expr\Variable('client'), - type: new Node\Name\FullyQualified(name: 'Akeneo\\Pim\\ApiClient\\AkeneoPimClientInterface'), + type: new Node\Name\FullyQualified(name: \Akeneo\Pim\ApiClient\AkeneoPimClientInterface::class), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), new Node\Param( var: new Node\Expr\Variable('logger'), - type: new Node\Name\FullyQualified(name: 'Psr\\Log\\LoggerInterface'), + type: new Node\Name\FullyQualified(name: \Psr\Log\LoggerInterface::class), flags: Node\Stmt\Class_::MODIFIER_PUBLIC, ), ], @@ -107,7 +107,7 @@ class: new Node\Stmt\Class_( expr: new Node\Expr\Assign( var: new Node\Expr\Variable('bucket'), expr: new Node\Expr\New_( - new Node\Name\FullyQualified('Kiboko\Component\Bucket\ComplexResultBucket') + new Node\Name\FullyQualified(\Kiboko\Component\Bucket\ComplexResultBucket::class) ) ) ), @@ -122,7 +122,7 @@ class: new Node\Stmt\Class_( ), args: [ new Node\Arg(value: $this->client), - new Node\Arg(value: $this->logger ?? new Node\Expr\New_(new Node\Name\FullyQualified('Psr\\Log\\NullLogger'))), + new Node\Arg(value: $this->logger ?? new Node\Expr\New_(new Node\Name\FullyQualified(\Psr\Log\NullLogger::class))), ], ); } diff --git a/src/Capacity/Extractor/All.php b/src/Capacity/Extractor/All.php index 7981e04..171cd91 100644 --- a/src/Capacity/Extractor/All.php +++ b/src/Capacity/Extractor/All.php @@ -10,7 +10,6 @@ use PhpParser\Node; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use function Kiboko\Component\SatelliteToolbox\Configuration\compileValue; use function Kiboko\Component\SatelliteToolbox\Configuration\compileValueWhenExpression; final class All implements Akeneo\Capacity\CapacityInterface diff --git a/src/Capacity/Lookup/All.php b/src/Capacity/Lookup/All.php index 6bc6fed..3ab4cc4 100644 --- a/src/Capacity/Lookup/All.php +++ b/src/Capacity/Lookup/All.php @@ -93,8 +93,8 @@ private function compileFilters(array ...$filters): Node\Expr public function getBuilder(array $config): Builder { $builder = (new Akeneo\Builder\Capacity\Lookup\All()) - ->withType((string) $config['type']) ->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type'])))) + ->withType($config['type']) ; if (isset($config['search']) && \is_array($config['search'])) { diff --git a/src/Configuration/Loader.php b/src/Configuration/Loader.php index 0238c0f..994709c 100644 --- a/src/Configuration/Loader.php +++ b/src/Configuration/Loader.php @@ -230,8 +230,8 @@ public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Bui ->validate() ->ifNotInArray(array_keys(self::$endpoints)) ->thenInvalid( - sprintf('the value should be one of [%s]', implode(', ', array_keys(self::$endpoints))) - ) + sprintf('the value should be one of [%s]', implode(', ', array_keys(self::$endpoints))) + ) ->end() ->end() ->scalarNode('method')->end()