|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ChadicusTest\Psr\Http\ServerMiddleware; |
|
4
|
|
|
|
|
5
|
|
|
use Chadicus\Psr\Http\ServerMiddleware\Token; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* @coversDefaultClass \Chadicus\Psr\Http\ServerMiddleware\Token |
|
9
|
|
|
* @covers ::__construct |
|
10
|
|
|
*/ |
|
11
|
|
|
final class TokenTest extends \PHPUnit\Framework\TestCase |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* Verify basic behavior of getPublicKey(). |
|
15
|
|
|
* |
|
16
|
|
|
* @test |
|
17
|
|
|
* @covers ::getPublicKey |
|
18
|
|
|
* |
|
19
|
|
|
* @return void |
|
20
|
|
|
*/ |
|
21
|
|
|
public function getPublicKey() |
|
22
|
|
|
{ |
|
23
|
|
|
$token = new Token('a public key', 'not under test', 'not under test', time()); |
|
24
|
|
|
$this->assertSame('a public key', $token->getPublicKey()); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Verify basic behavior of getSignature(). |
|
29
|
|
|
* |
|
30
|
|
|
* @test |
|
31
|
|
|
* @covers ::getSignature |
|
32
|
|
|
* |
|
33
|
|
|
* @return void |
|
34
|
|
|
*/ |
|
35
|
|
|
public function getSignature() |
|
36
|
|
|
{ |
|
37
|
|
|
$token = new Token('not under test', 'a signature', 'not under test', time()); |
|
38
|
|
|
$this->assertSame('a signature', $token->getSignature()); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Verify basic behavior of getNonce(). |
|
43
|
|
|
* |
|
44
|
|
|
* @test |
|
45
|
|
|
* @covers ::getNonce |
|
46
|
|
|
* |
|
47
|
|
|
* @return void |
|
48
|
|
|
*/ |
|
49
|
|
|
public function getNonce() |
|
50
|
|
|
{ |
|
51
|
|
|
$token = new Token('not under test', 'not under test', '12345', time()); |
|
52
|
|
|
$this->assertSame('12345', $token->getNonce()); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Verify basic behavior of getTimestamp(). |
|
57
|
|
|
* |
|
58
|
|
|
* @test |
|
59
|
|
|
* @covers ::getTimestamp |
|
60
|
|
|
* |
|
61
|
|
|
* @return void |
|
62
|
|
|
*/ |
|
63
|
|
|
public function getTimestamp() |
|
64
|
|
|
{ |
|
65
|
|
|
$time = 1464053940; |
|
66
|
|
|
$token = new Token('not under test', 'not under test', 'not under test', $time); |
|
67
|
|
|
$this->assertSame(1464053940, $token->getTimestamp()); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|