mirror of
https://github.com/elyby/accounts.git
synced 2024-12-28 08:00:25 +05:30
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
|
<?php
|
||
|
namespace tests\codeception\api\traits;
|
||
|
|
||
|
use api\traits\ApiNormalize;
|
||
|
use Codeception\Specify;
|
||
|
use Codeception\TestCase\Test;
|
||
|
|
||
|
class ApiNormalizeTestClass {
|
||
|
use ApiNormalize;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @property \tests\codeception\api\UnitTester $actor
|
||
|
*/
|
||
|
class ApiNormalizerTest extends Test {
|
||
|
use Specify;
|
||
|
|
||
|
public function testNormalizeModelErrors() {
|
||
|
$object = new ApiNormalizeTestClass();
|
||
|
$this->specify('', function() use ($object) {
|
||
|
$normalized = $object->normalizeModelErrors([
|
||
|
'rulesAgreement' => [
|
||
|
'error.you_must_accept_rules',
|
||
|
],
|
||
|
'email' => [
|
||
|
'error.email_required',
|
||
|
],
|
||
|
'username' => [
|
||
|
'error.username_too_short',
|
||
|
'error.username_not_unique',
|
||
|
],
|
||
|
]);
|
||
|
|
||
|
expect($normalized)->equals([
|
||
|
'rulesAgreement' => 'error.you_must_accept_rules',
|
||
|
'email' => 'error.email_required',
|
||
|
'username' => 'error.username_too_short',
|
||
|
]);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}
|