diff --git a/api/tests/_bootstrap.php b/api/tests/_bootstrap.php index f962cb8..d49e5bf 100644 --- a/api/tests/_bootstrap.php +++ b/api/tests/_bootstrap.php @@ -1,10 +1,6 @@ getClassNamespace(Validator::class), 'sleep')->once(); + $this->getFunctionMock(Validator::class, 'sleep')->expects($this->once()); $validator = new Validator($mockClient); $this->assertTrue($validator->validate('12341234', $error)); @@ -54,7 +52,7 @@ class ValidatorTest extends TestCase { public function testValidateWithHugeNetworkTroubles() { $mockClient = $this->createMock(ClientInterface::class); $mockClient->expects($this->exactly(3))->method('request')->willThrowException($this->createMock(ConnectException::class)); - PHPMockery::mock($this->getClassNamespace(Validator::class), 'sleep')->times(2); + $this->getFunctionMock(Validator::class, 'sleep')->expects($this->exactly(2)); $validator = new Validator($mockClient); $this->expectException(ConnectException::class); @@ -71,8 +69,4 @@ class ValidatorTest extends TestCase { $this->assertNull($error); } - private function getClassNamespace(string $className): string { - return (new ReflectionClass($className))->getNamespaceName(); - } - } diff --git a/composer.json b/composer.json index c5e1ba9..3a3a3cf 100644 --- a/composer.json +++ b/composer.json @@ -4,6 +4,9 @@ "homepage": "https://account.ely.by", "type": "project", "minimum-stability": "stable", + "config": { + "sort-packages": true + }, "require": { "php": "^7.3", "ext-intl": "*", @@ -36,6 +39,7 @@ "require-dev": { "codeception/base": "^3.1.0", "codeception/specify": "^1.0.0", + "cweagans/composer-patches": "^1.6", "ely/php-code-style": "^0.3.0", "flow/jsonpath": "^0.4.0", "fzaninotto/faker": "^1.8", @@ -51,6 +55,13 @@ "symfony/polyfill-php72": "*", "symfony/polyfill-php73": "*" }, + "extra": { + "patches": { + "codeception/base": { + "Fix Codeception compatibility with PHPUnit8": "patches/codeception-phpunit-8-fix.patch" + } + } + }, "repositories": [ { "type": "composer", @@ -61,9 +72,6 @@ "url": "https://github.com/elyby/oauth2-server.git" } ], - "config": { - "sort-packages": true - }, "autoload": { "psr-4": { "api\\": "api", diff --git a/composer.lock b/composer.lock index 160405d..624f322 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": "d79b05dfd2bb6a2e053eaf534d42622e", + "content-hash": "0a56121050b75bd49d4d924464422c39", "packages": [ { "name": "bacon/bacon-qr-code", @@ -3023,7 +3023,10 @@ ], "type": "library", "extra": { - "branch-alias": [] + "branch-alias": [], + "patches_applied": { + "Fix Codeception compatibility with PHPUnit8": "patches/codeception-phpunit-8-fix.patch" + } }, "autoload": { "psr-4": { @@ -3271,6 +3274,50 @@ ], "time": "2019-01-28T20:25:53+00:00" }, + { + "name": "cweagans/composer-patches", + "version": "1.6.7", + "source": { + "type": "git", + "url": "https://github.com/cweagans/composer-patches.git", + "reference": "2e6f72a2ad8d59cd7e2b729f218bf42adb14f590" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/2e6f72a2ad8d59cd7e2b729f218bf42adb14f590", + "reference": "2e6f72a2ad8d59cd7e2b729f218bf42adb14f590", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": ">=5.3.0" + }, + "require-dev": { + "composer/composer": "~1.0", + "phpunit/phpunit": "~4.6" + }, + "type": "composer-plugin", + "extra": { + "class": "cweagans\\Composer\\Patches" + }, + "autoload": { + "psr-4": { + "cweagans\\Composer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Cameron Eagans", + "email": "me@cweagans.net" + } + ], + "description": "Provides a way to patch Composer packages.", + "time": "2019-08-29T20:11:49+00:00" + }, { "name": "doctrine/instantiator", "version": "1.3.0", diff --git a/console/tests/_bootstrap.php b/console/tests/_bootstrap.php index e919416..d49e5bf 100644 --- a/console/tests/_bootstrap.php +++ b/console/tests/_bootstrap.php @@ -1,7 +1,6 @@ invoke($this->testMethod, [$I, $this->scenario]); + } + +- public function toString() ++ public function toString(): string + { + return sprintf('%s: %s', ReflectionHelper::getClassShortName($this->getTestClass()), Message::ucfirst($this->getFeature())); + } +diff --git a/src/Codeception/Test/Test.php b/src/Codeception/Test/Test.php +index f5e8426f..99c9f0ae 100644 +--- a/src/Codeception/Test/Test.php ++++ b/src/Codeception/Test/Test.php +@@ -55,7 +55,7 @@ abstract class Test implements TestInterface, Interfaces\Descriptive + * + * @return mixed + */ +- abstract public function toString(); ++ abstract public function toString(): string; + + /** + * Runs a test and collects its result in a TestResult instance.