|
2 | 2 |
|
3 | 3 | namespace Pdsinterop\Solid\Auth\Utils; |
4 | 4 |
|
5 | | -use PHPUnit\Framework\TestCase; |
| 5 | +use Pdsinterop\Solid\Auth\AbstractTestCase; |
6 | 6 | use Lcobucci\JWT\Validation\RequiredConstraintsViolated; |
7 | 7 |
|
8 | 8 | /** |
9 | 9 | * @coversDefaultClass \Pdsinterop\Solid\Auth\Utils\DPop |
10 | 10 | * @covers ::<!public> |
| 11 | + * |
11 | 12 | * @uses \Pdsinterop\Solid\Auth\Utils\Base64Url |
12 | 13 | */ |
13 | | -class DPOPTest extends TestCase |
| 14 | +class DPOPTest extends AbstractTestCase |
14 | 15 | { |
15 | 16 | ////////////////////////////////// FIXTURES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ |
16 | 17 |
|
@@ -67,6 +68,45 @@ private function getWrongKey() |
67 | 68 |
|
68 | 69 | /////////////////////////////////// TESTS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ |
69 | 70 |
|
| 71 | + /** |
| 72 | + * @testdox Dpop SHOULD be created WHEN instantiated without parameters |
| 73 | + */ |
| 74 | + final public function testInstantiation(): void |
| 75 | + { |
| 76 | + $actual = new DPop(); |
| 77 | + $expected = DPop::class; |
| 78 | + |
| 79 | + $this->assertInstanceOf($expected, $actual); |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * @testdox Dpop SHOULD complain WHEN ask to validate DPOP without JWT given |
| 84 | + * |
| 85 | + * @covers ::validateDpop |
| 86 | + */ |
| 87 | + final public function testValidateDpopWithoutJwt(): void |
| 88 | + { |
| 89 | + $this->expectArgumentCountError(1); |
| 90 | + |
| 91 | + $dpop = new DPop(); |
| 92 | + |
| 93 | + $dpop->validateDpop(); |
| 94 | + } |
| 95 | + |
| 96 | + /** |
| 97 | + * @testdox Dpop SHOULD complain WHEN ask to validate DPOP without Request given |
| 98 | + * |
| 99 | + * @covers ::validateDpop |
| 100 | + */ |
| 101 | + final public function testValidateDpopWithoutRequest(): void |
| 102 | + { |
| 103 | + $this->expectArgumentCountError(2); |
| 104 | + |
| 105 | + $dpop = new DPop(); |
| 106 | + |
| 107 | + $dpop->validateDpop('mock jwt'); |
| 108 | + } |
| 109 | + |
70 | 110 | /** |
71 | 111 | * @testdox Dpop SHOULD complain WHEN asked to validate a DPOP with wrong header type |
72 | 112 | * |
@@ -139,6 +179,12 @@ public function testValidateDpopWithCorrectToken(): void |
139 | 179 | $this->assertTrue($result); |
140 | 180 | } |
141 | 181 |
|
| 182 | + // getWebId |
| 183 | + |
| 184 | + /////////////////////////////// DATAPROVIDERS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ |
| 185 | + |
| 186 | + ////////////////////////////// MOCKS AND STUBS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\ |
| 187 | + |
142 | 188 | ///////////////////////////// HELPER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\ |
143 | 189 |
|
144 | 190 | protected function sign($dpop, $privateKey = null) |
|
0 commit comments