From 01850bb2d612e75d2e0cc635492e11d1343728e0 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Fri, 12 Jan 2018 13:50:19 +0300 Subject: [PATCH] Fixes ACCOUNTS-34Y MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit После перехода на utf8mb4_unicode_ci забыли обновить кодировку подключения к БД --- common/config/config.php | 4 +-- .../api/functional/EmailConfirmationCest.php | 32 +++++++++++++++---- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/common/config/config.php b/common/config/config.php index b79bd6b..b753c9f 100644 --- a/common/config/config.php +++ b/common/config/config.php @@ -12,7 +12,7 @@ return [ 'dsn' => 'mysql:host=' . (getenv('DB_HOST') ?: 'db') . ';dbname=' . getenv('DB_DATABASE'), 'username' => getenv('DB_USER'), 'password' => getenv('DB_PASSWORD'), - 'charset' => 'utf8', + 'charset' => 'utf8mb4', 'schemaMap' => [ 'mysql' => common\db\mysql\Schema::class, ], @@ -22,7 +22,7 @@ return [ 'dsn' => 'mysql:host=' . (getenv('DB_HOST') ?: 'db') . ';dbname=' . getenv('DB_DATABASE'), 'username' => getenv('DB_USER'), 'password' => getenv('DB_PASSWORD'), - 'charset' => 'utf8', + 'charset' => 'utf8mb4', 'attributes' => [ PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => false, ], diff --git a/tests/codeception/api/functional/EmailConfirmationCest.php b/tests/codeception/api/functional/EmailConfirmationCest.php index 2f4e8da..ea2d637 100644 --- a/tests/codeception/api/functional/EmailConfirmationCest.php +++ b/tests/codeception/api/functional/EmailConfirmationCest.php @@ -5,7 +5,19 @@ use tests\codeception\api\_pages\SignupRoute; class EmailConfirmationCest { - public function testLoginEmailOrUsername(FunctionalTester $I) { + public function testConfirmEmailByCorrectKey(FunctionalTester $I) { + $route = new SignupRoute($I); + + $I->wantTo('confirm my email using correct activation key'); + $route->confirm('HABGCABHJ1234HBHVD'); + $I->canSeeResponseContainsJson([ + 'success' => true, + ]); + $I->cantSeeResponseJsonMatchesJsonPath('$.errors'); + $I->canSeeAuthCredentials(true); + } + + public function testConfirmEmailByInvalidKey(FunctionalTester $I) { $route = new SignupRoute($I); $I->wantTo('see error.key_is_required expected if key is not set'); @@ -27,16 +39,22 @@ class EmailConfirmationCest { ]); } - public function testLoginByEmailCorrect(FunctionalTester $I) { + public function testConfirmByInvalidEmojiString(FunctionalTester $I) { $route = new SignupRoute($I); - $I->wantTo('confirm my email using correct activation key'); - $route->confirm('HABGCABHJ1234HBHVD'); + $I->wantTo('try to submit some long emoji string (Sentry ACCOUNTS-43Y)'); + $route->confirm( + 'ALWAYS 🕔 make sure 👍 to shave 🔪🍑 because ✌️ the last time 🕒 we let 👐😪 a bush 🌳 ' . + 'in our lives 👈😜👉 it did 9/11 💥🏢🏢✈️🔥🔥🔥 ALWAYS 🕔 make sure 👍 to shave 🔪🍑 ' . + 'because ✌️ the last time 🕒 we let 👐😪 a bush 🌳 in our lives 👈😜👉 it did 9/11 ' . + '💥🏢🏢✈️🔥🔥🔥/' + ); $I->canSeeResponseContainsJson([ - 'success' => true, + 'success' => false, + 'errors' => [ + 'key' => 'error.key_not_exists', + ], ]); - $I->cantSeeResponseJsonMatchesJsonPath('$.errors'); - $I->canSeeAuthCredentials(true); } }