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); } }