Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Unit/VerificationCodeTest.php
Show All 11 Lines | class VerificationCodeTest extends TestCase | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function testGenerateShortCode() | public function testGenerateShortCode() | ||||
{ | { | ||||
$code = VerificationCode::generateShortCode(); | $code = VerificationCode::generateShortCode(); | ||||
$code_length = env('VERIFICATION_CODE_LENGTH', VerificationCode::SHORTCODE_LENGTH); | $code_length = env('VERIFICATION_CODE_LENGTH', VerificationCode::SHORTCODE_LENGTH); | ||||
$code_chars = env('VERIFICATION_CODE_CHARS', VerificationCode::SHORTCODE_CHARS); | |||||
$this->assertTrue(is_string($code)); | $this->assertTrue(is_string($code)); | ||||
$this->assertTrue(strlen($code) === $code_length); | $this->assertTrue(strlen($code) === $code_length); | ||||
$this->assertTrue(strspn($code, $code_chars) === strlen($code)); | $this->assertTrue(strspn($code, \App\Utils::CHARS) === strlen($code)); | ||||
} | } | ||||
} | } |