mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Implemented WebHooks delivery queue.
Completely removed usage of the RabbitMQ. Queue now based on Redis channels. Worker process now extracted as separate docker container. Base image upgraded to the 1.8.0 version (PHP 7.2.7 and pcntl extension).
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace tests\codeception\common\unit\models;
|
||||
|
||||
use Codeception\Specify;
|
||||
use common\components\UserPass;
|
||||
use common\models\Account;
|
||||
use common\tasks\CreateWebHooksDeliveries;
|
||||
use tests\codeception\common\fixtures\MojangUsernameFixture;
|
||||
use tests\codeception\common\unit\TestCase;
|
||||
use Yii;
|
||||
use const common\LATEST_RULES_VERSION;
|
||||
|
||||
/**
|
||||
* @covers \common\models\Account
|
||||
*/
|
||||
class AccountTest extends TestCase {
|
||||
use Specify;
|
||||
|
||||
@@ -119,4 +125,37 @@ class AccountTest extends TestCase {
|
||||
$this->assertNull($account->getRegistrationIp());
|
||||
}
|
||||
|
||||
public function testAfterSaveInsertEvent() {
|
||||
$account = new Account();
|
||||
$account->afterSave(true, [
|
||||
'username' => 'old-username',
|
||||
]);
|
||||
$this->assertNull($this->tester->grabLastQueuedJob());
|
||||
}
|
||||
|
||||
public function testAfterSaveNotMeaningfulAttributes() {
|
||||
$account = new Account();
|
||||
$account->afterSave(false, [
|
||||
'updatedAt' => time(),
|
||||
]);
|
||||
$this->assertNull($this->tester->grabLastQueuedJob());
|
||||
}
|
||||
|
||||
public function testAfterSavePushEvent() {
|
||||
$changedAttributes = [
|
||||
'username' => 'old-username',
|
||||
'email' => 'old-email@ely.by',
|
||||
'uuid' => 'c3cc0121-fa87-4818-9c0e-4acb7f9a28c5',
|
||||
'status' => 10,
|
||||
'lang' => 'en',
|
||||
];
|
||||
|
||||
$account = new Account();
|
||||
$account->afterSave(false, $changedAttributes);
|
||||
/** @var CreateWebHooksDeliveries $job */
|
||||
$job = $this->tester->grabLastQueuedJob();
|
||||
$this->assertInstanceOf(CreateWebHooksDeliveries::class, $job);
|
||||
$this->assertSame($job->payloads['changedAttributes'], $changedAttributes);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user