From 7a1b2e5629f12831a4ad04bdda93352051d3fc74 Mon Sep 17 00:00:00 2001 From: Eugene Leonovich Date: Tue, 13 Sep 2022 22:20:44 +0200 Subject: [PATCH] Bump tarantool/client version to v0.10 --- .github/workflows/qa.yml | 6 +- README.md | 22 ------ composer.json | 14 ++-- src/Annotation/Annotations.php | 2 - .../Requirement/ClientPackerRequirement.php | 54 ------------- .../ClientPackerRequirementTest.php | 75 ------------------- 6 files changed, 8 insertions(+), 165 deletions(-) delete mode 100644 src/Annotation/Requirement/ClientPackerRequirement.php delete mode 100755 tests/Annotation/Requirement/ClientPackerRequirementTest.php diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index b39cd10..c2fe040 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -10,17 +10,16 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] runs-on: ${{ matrix.operating-system }} steps: - name: Checkout uses: actions/checkout@v2 - - name: Setup PHP, with composer and extensions + - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - extensions: msgpack coverage: none - name: Get composer cache directory @@ -53,7 +52,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.0' - extensions: msgpack coverage: none - name: Get composer cache directory diff --git a/README.md b/README.md index 743c21f..064dc69 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ It is based on [rybakit/phpunit-extras](https://github.com/rybakit/phpunit-extra * [Lua](#lua) * [Sql](#sql) * [Requirements](#requirements) - * [ClientPacker](#clientpacker) * [LuaCondition](#luacondition) * [TarantoolVersion](#tarantoolversion) * [Expectations](#expectations) @@ -152,27 +151,6 @@ public function testExecuteQueryFetchesAllRows() : void Requirements allow skipping tests based on preconditions. -#### ClientPacker - -*Format:* - -``` -@requires clientPacker -``` -where `` is either `pure`, `pecl`, or a fully qualified class name, e.g. `Tarantool\Client\Packer\PurePacker`. - -*Example:* - -```php -/** - * @requires clientPacker pure - */ -public function testPackerUnpacksBigIntegerAsDecimal() : void -{ - // ... -} -``` - #### LuaCondition *Format:* diff --git a/composer.json b/composer.json index 5b7ddb3..58dc935 100644 --- a/composer.json +++ b/composer.json @@ -11,18 +11,16 @@ } ], "require": { - "php": "^7.1|^8", + "php": "^7.2.5|^8", "composer/semver": "^1.5", "composer/package-versions-deprecated": "^1.4", - "rybakit/phpunit-extras": "^0.2.3", - "symfony/expression-language": "^3.3|^4|^5", - "tarantool/client": "^0.8|^0.9" + "rybakit/phpunit-extras": "^0.2.4", + "symfony/expression-language": "^3.3|^4|^5|^6", + "tarantool/client": "^0.10" }, "require-dev": { - "php": "^7.1.3|^8", - "ext-msgpack": "*", - "friendsofphp/php-cs-fixer": "^2.14", - "rybakit/msgpack": "*", + "php": "^7.2.5|^8", + "friendsofphp/php-cs-fixer": "^2.19", "vimeo/psalm": "^3.9|^4" }, "autoload": { diff --git a/src/Annotation/Annotations.php b/src/Annotation/Annotations.php index 6bb4747..93db4a6 100644 --- a/src/Annotation/Annotations.php +++ b/src/Annotation/Annotations.php @@ -18,7 +18,6 @@ use Tarantool\Client\Client; use Tarantool\PhpUnit\Annotation\Processor\LuaProcessor; use Tarantool\PhpUnit\Annotation\Processor\SqlProcessor; -use Tarantool\PhpUnit\Annotation\Requirement\ClientPackerRequirement; use Tarantool\PhpUnit\Annotation\Requirement\LuaConditionRequirement; use Tarantool\PhpUnit\Annotation\Requirement\TarantoolVersionRequirement; @@ -35,7 +34,6 @@ protected function createAnnotationProcessorBuilder() : AnnotationProcessorBuild return $this->createBaseAnnotationProcessorBuilder() ->addProcessor(new LuaProcessor($client)) ->addProcessor(new SqlProcessor($client)) - ->addRequirement(new ClientPackerRequirement($client)) ->addRequirement(new LuaConditionRequirement($client)) ->addRequirement(new TarantoolVersionRequirement($client)) ; diff --git a/src/Annotation/Requirement/ClientPackerRequirement.php b/src/Annotation/Requirement/ClientPackerRequirement.php deleted file mode 100644 index 87fd5cc..0000000 --- a/src/Annotation/Requirement/ClientPackerRequirement.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Tarantool\PhpUnit\Annotation\Requirement; - -use PHPUnitExtras\Annotation\Requirement\Requirement; -use Tarantool\Client\Client; -use Tarantool\Client\Packer\PeclPacker; -use Tarantool\Client\Packer\PurePacker; - -final class ClientPackerRequirement implements Requirement -{ - private const ALIASES = [ - 'pure' => PurePacker::class, - 'pecl' => PeclPacker::class, - ]; - - private $client; - - public function __construct(Client $client) - { - $this->client = $client; - } - - public function getName() : string - { - return 'clientPacker'; - } - - public function check(string $value) : ?string - { - $packer = $this->client->getHandler()->getPacker(); - - if (isset(self::ALIASES[$value])) { - $value = self::ALIASES[$value]; - } - - if (\get_class($packer) === ltrim($value, '\\')) { - return null; - } - - return sprintf('Client packer "%s" is required', $value); - } -} diff --git a/tests/Annotation/Requirement/ClientPackerRequirementTest.php b/tests/Annotation/Requirement/ClientPackerRequirementTest.php deleted file mode 100755 index 3d7b1cc..0000000 --- a/tests/Annotation/Requirement/ClientPackerRequirementTest.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Tarantool\PhpUnit\Tests\Annotation\Requirement; - -use PHPUnit\Framework\TestCase; -use Tarantool\Client\Packer\Packer; -use Tarantool\Client\Packer\PeclPacker; -use Tarantool\Client\Packer\PurePacker; -use Tarantool\PhpUnit\Annotation\Requirement\ClientPackerRequirement; -use Tarantool\PhpUnit\Client\TestDoubleClient; - -final class ClientPackerRequirementTest extends TestCase -{ - use TestDoubleClient; - - /** - * @dataProvider provideCheckPassesForMatchedPackerData() - */ - public function testCheckPassesForMatchedPacker(Packer $packer, string $requiredPackerName) : void - { - $stubClient = $this->getTestDoubleClientBuilder() - ->willUsePacker($packer) - ->build(); - - $requirement = new ClientPackerRequirement($stubClient); - - self::assertNull($requirement->check($requiredPackerName)); - } - - public function provideCheckPassesForMatchedPackerData() : iterable - { - return [ - [new PurePacker(), 'pure'], - [new PurePacker(), PurePacker::class], - [new PeclPacker(), 'pecl'], - [new PeclPacker(), PeclPacker::class], - ]; - } - - /** - * @dataProvider provideCheckFailsForMismatchedPackerData() - */ - public function testCheckFailsForMismatchedPacker(Packer $packer, string $requiredPackerName, string $expectedPackerClass) : void - { - $stubClient = $this->getTestDoubleClientBuilder() - ->willUsePacker($packer) - ->build(); - - $requirement = new ClientPackerRequirement($stubClient); - $errorMessage = sprintf('Client packer "%s" is required', $expectedPackerClass); - - self::assertSame($errorMessage, $requirement->check($requiredPackerName)); - } - - public function provideCheckFailsForMismatchedPackerData() : iterable - { - return [ - [new PurePacker(), 'pecl', PeclPacker::class], - [new PurePacker(), PeclPacker::class, PeclPacker::class], - [new PeclPacker(), 'pure', PurePacker::class], - [new PeclPacker(), PurePacker::class, PurePacker::class], - ]; - } -}