Upgrade PHPUnit to 8. Replace codeception/base with codeception/codeception due to release bug in the base version.

This commit is contained in:
ErickSkrauch
2019-08-02 15:57:17 +03:00
parent 7b11366a5a
commit d9f2b1a8c9
21 changed files with 522 additions and 219 deletions

View File

@@ -13,7 +13,7 @@ class TestCase extends Unit {
*/
protected $tester;
protected function tearDown() {
protected function tearDown(): void {
parent::tearDown();
Mockery::close();
}

View File

@@ -20,7 +20,7 @@ class ComponentTest extends TestCase {
*/
private $component;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->api = $this->createMock(Api::class);

View File

@@ -38,9 +38,8 @@ class CreateWebHooksDeliveriesTest extends TestCase {
'status' => 0,
];
$result = CreateWebHooksDeliveries::createAccountEdit($account, $changedAttributes);
$this->assertInstanceOf(CreateWebHooksDeliveries::class, $result);
$this->assertSame('account.edit', $result->type);
$this->assertArraySubset([
$this->assertEmpty(array_diff_assoc([
'id' => 123,
'uuid' => 'afc8dc7a-4bbf-4d3a-8699-68890088cf84',
'username' => 'mock-username',
@@ -48,8 +47,8 @@ class CreateWebHooksDeliveriesTest extends TestCase {
'lang' => 'en',
'isActive' => true,
'registered' => '2018-07-08T00:13:34+00:00',
'changedAttributes' => $changedAttributes,
], $result->payloads);
], $result->payloads));
$this->assertSame($changedAttributes, $result->payloads['changedAttributes']);
}
public function testExecute() {

View File

@@ -90,10 +90,9 @@ class DeliveryWebHookTest extends TestCase {
$task->execute(mock(Queue::class));
}
/**
* @expectedException \GuzzleHttp\Exception\ServerException
*/
public function testExecuteUnhandledException() {
$this->expectException(ServerException::class);
$this->response = new Response(502);
$task = $this->createMockedTask();
$task->type = 'account.edit';

View File

@@ -50,7 +50,7 @@ class PullMojangUsernameTest extends TestCase {
public function testExecuteUsernameExists() {
$this->mockedMethod->willReturn(new ProfileInfo('069a79f444e94726a5befca90e38aaf5', 'Notch'));
/** @var \common\models\MojangUsername $mojangUsernameFixture */
/** @var MojangUsername $mojangUsernameFixture */
$mojangUsernameFixture = $this->tester->grabFixture('mojangUsernames', 'Notch');
$task = new PullMojangUsername();
$task->username = 'Notch';
@@ -89,7 +89,7 @@ class PullMojangUsernameTest extends TestCase {
}
public function testExecuteRemoveIfExistsNoMore() {
$this->mockedMethod->willThrowException(new NoContentException(new Request('', ''), new Response()));
$this->mockedMethod->willThrowException(new NoContentException(new Request('GET', ''), new Response()));
$username = $this->tester->grabFixture('mojangUsernames', 'not-exists')['username'];
$task = new PullMojangUsername();

View File

@@ -41,7 +41,7 @@ class SendCurrentEmailConfirmationTest extends TestCase {
$this->assertSame(['mock@ely.by' => 'mock-username'], $email->getTo());
$this->assertSame('Ely.by Account change E-mail confirmation', $email->getSubject());
$children = $email->getSwiftMessage()->getChildren()[0];
$this->assertContains('GFEDCBA', $children->getBody());
$this->assertStringContainsString('GFEDCBA', $children->getBody());
}
}

View File

@@ -41,7 +41,7 @@ class SendNewEmailConfirmationTest extends TestCase {
$this->assertSame(['mock@ely.by' => 'mock-username'], $email->getTo());
$this->assertSame('Ely.by Account new E-mail confirmation', $email->getSubject());
$children = $email->getSwiftMessage()->getChildren()[0];
$this->assertContains('GFEDCBA', $children->getBody());
$this->assertStringContainsString('GFEDCBA', $children->getBody());
}
}