mirror of
https://github.com/elyby/accounts.git
synced 2024-11-06 08:11:24 +05:30
Fix tests
This commit is contained in:
parent
e8b71d33d0
commit
04e399c726
@ -1,10 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
Codeception\PHPUnit\Init::init();
|
|
||||||
|
|
||||||
defined('YII_DEBUG') || define('YII_DEBUG', true);
|
defined('YII_DEBUG') || define('YII_DEBUG', true);
|
||||||
defined('YII_ENV') || define('YII_ENV', 'test');
|
defined('YII_ENV') || define('YII_ENV', 'test');
|
||||||
|
|
||||||
defined('YII_APP_BASE_PATH') || define('YII_APP_BASE_PATH', __DIR__ . '/../../');
|
defined('YII_APP_BASE_PATH') || define('YII_APP_BASE_PATH', __DIR__ . '/../../');
|
||||||
|
|
||||||
require_once YII_APP_BASE_PATH . '/vendor/autoload.php';
|
require_once YII_APP_BASE_PATH . '/vendor/autoload.php';
|
||||||
|
@ -8,8 +8,6 @@ use api\tests\unit\TestCase;
|
|||||||
use GuzzleHttp\ClientInterface;
|
use GuzzleHttp\ClientInterface;
|
||||||
use GuzzleHttp\Exception\ConnectException;
|
use GuzzleHttp\Exception\ConnectException;
|
||||||
use GuzzleHttp\Psr7\Response;
|
use GuzzleHttp\Psr7\Response;
|
||||||
use phpmock\mockery\PHPMockery;
|
|
||||||
use ReflectionClass;
|
|
||||||
|
|
||||||
class ValidatorTest extends TestCase {
|
class ValidatorTest extends TestCase {
|
||||||
|
|
||||||
@ -44,7 +42,7 @@ class ValidatorTest extends TestCase {
|
|||||||
],
|
],
|
||||||
])))
|
])))
|
||||||
);
|
);
|
||||||
PHPMockery::mock($this->getClassNamespace(Validator::class), 'sleep')->once();
|
$this->getFunctionMock(Validator::class, 'sleep')->expects($this->once());
|
||||||
|
|
||||||
$validator = new Validator($mockClient);
|
$validator = new Validator($mockClient);
|
||||||
$this->assertTrue($validator->validate('12341234', $error));
|
$this->assertTrue($validator->validate('12341234', $error));
|
||||||
@ -54,7 +52,7 @@ class ValidatorTest extends TestCase {
|
|||||||
public function testValidateWithHugeNetworkTroubles() {
|
public function testValidateWithHugeNetworkTroubles() {
|
||||||
$mockClient = $this->createMock(ClientInterface::class);
|
$mockClient = $this->createMock(ClientInterface::class);
|
||||||
$mockClient->expects($this->exactly(3))->method('request')->willThrowException($this->createMock(ConnectException::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);
|
$validator = new Validator($mockClient);
|
||||||
$this->expectException(ConnectException::class);
|
$this->expectException(ConnectException::class);
|
||||||
@ -71,8 +69,4 @@ class ValidatorTest extends TestCase {
|
|||||||
$this->assertNull($error);
|
$this->assertNull($error);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getClassNamespace(string $className): string {
|
|
||||||
return (new ReflectionClass($className))->getNamespaceName();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
"homepage": "https://account.ely.by",
|
"homepage": "https://account.ely.by",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
|
"config": {
|
||||||
|
"sort-packages": true
|
||||||
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.3",
|
"php": "^7.3",
|
||||||
"ext-intl": "*",
|
"ext-intl": "*",
|
||||||
@ -36,6 +39,7 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"codeception/base": "^3.1.0",
|
"codeception/base": "^3.1.0",
|
||||||
"codeception/specify": "^1.0.0",
|
"codeception/specify": "^1.0.0",
|
||||||
|
"cweagans/composer-patches": "^1.6",
|
||||||
"ely/php-code-style": "^0.3.0",
|
"ely/php-code-style": "^0.3.0",
|
||||||
"flow/jsonpath": "^0.4.0",
|
"flow/jsonpath": "^0.4.0",
|
||||||
"fzaninotto/faker": "^1.8",
|
"fzaninotto/faker": "^1.8",
|
||||||
@ -51,6 +55,13 @@
|
|||||||
"symfony/polyfill-php72": "*",
|
"symfony/polyfill-php72": "*",
|
||||||
"symfony/polyfill-php73": "*"
|
"symfony/polyfill-php73": "*"
|
||||||
},
|
},
|
||||||
|
"extra": {
|
||||||
|
"patches": {
|
||||||
|
"codeception/base": {
|
||||||
|
"Fix Codeception compatibility with PHPUnit8": "patches/codeception-phpunit-8-fix.patch"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{
|
{
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
@ -61,9 +72,6 @@
|
|||||||
"url": "https://github.com/elyby/oauth2-server.git"
|
"url": "https://github.com/elyby/oauth2-server.git"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"config": {
|
|
||||||
"sort-packages": true
|
|
||||||
},
|
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"api\\": "api",
|
"api\\": "api",
|
||||||
|
51
composer.lock
generated
51
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "d79b05dfd2bb6a2e053eaf534d42622e",
|
"content-hash": "0a56121050b75bd49d4d924464422c39",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bacon/bacon-qr-code",
|
"name": "bacon/bacon-qr-code",
|
||||||
@ -3023,7 +3023,10 @@
|
|||||||
],
|
],
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": []
|
"branch-alias": [],
|
||||||
|
"patches_applied": {
|
||||||
|
"Fix Codeception compatibility with PHPUnit8": "patches/codeception-phpunit-8-fix.patch"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@ -3271,6 +3274,50 @@
|
|||||||
],
|
],
|
||||||
"time": "2019-01-28T20:25:53+00:00"
|
"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",
|
"name": "doctrine/instantiator",
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('YII_DEBUG') || define('YII_DEBUG', true);
|
defined('YII_DEBUG') || define('YII_DEBUG', true);
|
||||||
defined('YII_ENV') || define('YII_ENV', 'test');
|
defined('YII_ENV') || define('YII_ENV', 'test');
|
||||||
|
|
||||||
defined('YII_APP_BASE_PATH') || define('YII_APP_BASE_PATH', __DIR__ . '/../../');
|
defined('YII_APP_BASE_PATH') || define('YII_APP_BASE_PATH', __DIR__ . '/../../');
|
||||||
|
|
||||||
require_once YII_APP_BASE_PATH . '/vendor/autoload.php';
|
require_once YII_APP_BASE_PATH . '/vendor/autoload.php';
|
||||||
|
26
patches/codeception-phpunit-8-fix.patch
Normal file
26
patches/codeception-phpunit-8-fix.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
diff --git a/src/Codeception/Test/Cest.php b/src/Codeception/Test/Cest.php
|
||||||
|
index c644ed2e..5426bf3f 100644
|
||||||
|
--- a/src/Codeception/Test/Cest.php
|
||||||
|
+++ b/src/Codeception/Test/Cest.php
|
||||||
|
@@ -150,7 +150,7 @@ protected function executeTestMethod($I)
|
||||||
|
$this->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.
|
Loading…
Reference in New Issue
Block a user