mirror of
https://github.com/PGYER/codefever.git
synced 2026-05-10 15:46:21 +08:00
27 lines
512 B
PHP
Executable File
27 lines
512 B
PHP
Executable File
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use service\Utility\TOTP;
|
|
|
|
class TOTPTest extends TestCase {
|
|
protected $phoneNumber = '11122223333';
|
|
|
|
public function testGenerate()
|
|
{
|
|
$actual = TOTP::generate($this->phoneNumber);
|
|
$this->assertEquals(6, strlen($actual));
|
|
|
|
return $actual;
|
|
}
|
|
|
|
/**
|
|
* @depends testGenerate
|
|
*/
|
|
public function testCheck($code)
|
|
{
|
|
$actual = TOTP::check($this->phoneNumber, $code);
|
|
|
|
$this->assertTrue($actual);
|
|
}
|
|
}
|