Skip to content

Commit b21bc14

Browse files
committed
Add a test case for Samyoul#6
1 parent cdbc30b commit b21bc14

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

test/U2FServerTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Samyoul\U2F\U2FServer\Tests;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use ReflectionClass;
7+
use Samyoul\U2F\U2FServer\U2FServer;
8+
9+
class U2FServerTest extends TestCase
10+
{
11+
protected static function getClassMethod(string $className, string $methodName) {
12+
$class = new ReflectionClass($className);
13+
$method = $class->getMethod($methodName);
14+
$method->setAccessible(true);
15+
return $method;
16+
}
17+
18+
public function testCreateChallenge(): void
19+
{
20+
$foo = self::getClassMethod(U2FServer::class, 'createChallenge');
21+
$challengeResult = $foo->invokeArgs(new U2FServer(), []);
22+
$this->assertMatchesRegularExpression('/^[a-z0-9_-]{20,}$/i', $challengeResult);
23+
}
24+
}

test/VoidTest.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)