Skip to content

Commit 2255946

Browse files
committed
Add missing parameter tests to DPOPTest.
1 parent 91b1010 commit 2255946

1 file changed

Lines changed: 48 additions & 2 deletions

File tree

tests/unit/Utils/DPOPTest.php

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
namespace Pdsinterop\Solid\Auth\Utils;
44

5-
use PHPUnit\Framework\TestCase;
5+
use Pdsinterop\Solid\Auth\AbstractTestCase;
66
use Lcobucci\JWT\Validation\RequiredConstraintsViolated;
77

88
/**
99
* @coversDefaultClass \Pdsinterop\Solid\Auth\Utils\DPop
1010
* @covers ::<!public>
11+
*
1112
* @uses \Pdsinterop\Solid\Auth\Utils\Base64Url
1213
*/
13-
class DPOPTest extends TestCase
14+
class DPOPTest extends AbstractTestCase
1415
{
1516
////////////////////////////////// FIXTURES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1617

@@ -67,6 +68,45 @@ private function getWrongKey()
6768

6869
/////////////////////////////////// TESTS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
6970

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+
70110
/**
71111
* @testdox Dpop SHOULD complain WHEN asked to validate a DPOP with wrong header type
72112
*
@@ -139,6 +179,12 @@ public function testValidateDpopWithCorrectToken(): void
139179
$this->assertTrue($result);
140180
}
141181

182+
// getWebId
183+
184+
/////////////////////////////// DATAPROVIDERS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
185+
186+
////////////////////////////// MOCKS AND STUBS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
187+
142188
///////////////////////////// HELPER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
143189

144190
protected function sign($dpop, $privateKey = null)

0 commit comments

Comments
 (0)