From 52f115a4e933bc791e8f7a81efe7b90e9a11b869 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Tue, 7 Jun 2016 12:42:55 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D1=84=D0=B8=D0=BA=D1=81=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B0=20=D1=81=D1=82=D0=B0=D0=B1?= =?UTF-8?q?=D0=B8=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=B2=D0=B5=D1=80=D1=81?= =?UTF-8?q?=D0=B8=D1=8F=20Codeception=202.1.10=20=D0=9E=D0=B1=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BC=D0=BE=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=B1=D1=83=D0=B4=D1=83=D1=89=D0=B5=D0=B9?= =?UTF-8?q?=20=D1=81=D0=BE=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=B8=D0=BC=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B8=20=D1=81=20Codeception=202.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- .../api/functional/OauthAuthCodeCest.php | 1 - .../unit/components/User/ComponentTest.php | 21 +++++++++++++++---- .../models/profile/ChangePasswordFormTest.php | 15 +++++++------ .../models/profile/ChangeUsernameFormTest.php | 2 +- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 2edb789..e0d4df1 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "yiisoft/yii2-gii": "*", "yiisoft/yii2-faker": "*", "flow/jsonpath": "^0.3.1", - "codeception/codeception": "2.1.x-dev", + "codeception/codeception": "~2.1.10", "codeception/specify": "*", "codeception/verify": "*" }, diff --git a/tests/codeception/api/functional/OauthAuthCodeCest.php b/tests/codeception/api/functional/OauthAuthCodeCest.php index 84baf07..76af106 100644 --- a/tests/codeception/api/functional/OauthAuthCodeCest.php +++ b/tests/codeception/api/functional/OauthAuthCodeCest.php @@ -84,7 +84,6 @@ class OauthAuthCodeCest { $I->loggedInAsActiveAccount(); $I->wantTo('get accept_required if I dom\'t require any scope, but this is first time request'); - $I->cleanupRedis(); $this->route->complete($this->buildQueryParams( 'ely', 'http://ely.by', diff --git a/tests/codeception/api/unit/components/User/ComponentTest.php b/tests/codeception/api/unit/components/User/ComponentTest.php index 6f666e8..7f70b67 100644 --- a/tests/codeception/api/unit/components/User/ComponentTest.php +++ b/tests/codeception/api/unit/components/User/ComponentTest.php @@ -102,14 +102,21 @@ class ComponentTest extends DbTestCase { $this->component->logout(); /** @var Component|\PHPUnit_Framework_MockObject_MockObject $component */ - $component = $this->getMock(Component::class, ['getIsGuest'], [$this->getComponentArguments()]); + $component = $this->getMockBuilder(Component::class) + ->setMethods(['getIsGuest']) + ->setConstructorArgs([$this->getComponentArguments()]) + ->getMock(); + $component ->expects($this->any()) ->method('getIsGuest') ->will($this->returnValue(false)); /** @var HeaderCollection|\PHPUnit_Framework_MockObject_MockObject $headersCollection */ - $headersCollection = $this->getMock(HeaderCollection::class, ['get']); + $headersCollection = $this->getMockBuilder(HeaderCollection::class) + ->setMethods(['get']) + ->getMock(); + $headersCollection ->expects($this->any()) ->method('get') @@ -117,7 +124,10 @@ class ComponentTest extends DbTestCase { ->will($this->returnValue('Bearer ' . $result->getJwt())); /** @var Request|\PHPUnit_Framework_MockObject_MockObject $request */ - $request = $this->getMock(Request::class, ['getHeaders']); + $request = $this->getMockBuilder(Request::class) + ->setMethods(['getHeaders']) + ->getMock(); + $request ->expects($this->any()) ->method('getHeaders') @@ -166,7 +176,10 @@ class ComponentTest extends DbTestCase { * @return \PHPUnit_Framework_MockObject_MockObject */ private function mockRequest($userIP = '127.0.0.1') { - $request = $this->getMock(Request::class, ['getHostInfo', 'getUserIP']); + $request = $this->getMockBuilder(Request::class) + ->setMethods(['getHostInfo', 'getUserIP']) + ->getMock(); + $request ->expects($this->any()) ->method('getHostInfo') diff --git a/tests/codeception/api/unit/models/profile/ChangePasswordFormTest.php b/tests/codeception/api/unit/models/profile/ChangePasswordFormTest.php index 5c3b2da..bf75d54 100644 --- a/tests/codeception/api/unit/models/profile/ChangePasswordFormTest.php +++ b/tests/codeception/api/unit/models/profile/ChangePasswordFormTest.php @@ -100,12 +100,15 @@ class ChangePasswordFormTest extends DbTestCase { public function testChangePasswordWithLogout() { /** @var Component|\PHPUnit_Framework_MockObject_MockObject $component */ - $component = $this->getMock(Component::class, ['getActiveSession'], [[ - 'identityClass' => AccountIdentity::class, - 'enableSession' => false, - 'loginUrl' => null, - 'secret' => 'secret', - ]]); + $component = $this->getMockBuilder(Component::class) + ->setMethods(['getActiveSession']) + ->setConstructorArgs([[ + 'identityClass' => AccountIdentity::class, + 'enableSession' => false, + 'loginUrl' => null, + 'secret' => 'secret', + ]]) + ->getMock(); /** @var AccountSession $session */ $session = AccountSession::findOne($this->accountSessions['admin2']['id']); diff --git a/tests/codeception/api/unit/models/profile/ChangeUsernameFormTest.php b/tests/codeception/api/unit/models/profile/ChangeUsernameFormTest.php index 5a355b1..f9e16b8 100644 --- a/tests/codeception/api/unit/models/profile/ChangeUsernameFormTest.php +++ b/tests/codeception/api/unit/models/profile/ChangeUsernameFormTest.php @@ -37,7 +37,7 @@ class ChangeUsernameFormTest extends DbTestCase { } public function testChangeWithoutChange() { - $this->scenario->incomplete('This test is written invalid'); + $this->markTestSkipped('This test is written invalid'); return; // TODO: этот тест написан неправильно - запись всё равно добавляется в базу данных, но тест не замечает