Skip to content

Commit d68d1b4

Browse files
committed
Add missing tests
1 parent 51ae014 commit d68d1b4

File tree

11 files changed

+507
-24
lines changed

11 files changed

+507
-24
lines changed

src/Attestation/Format/BaseFormat.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ abstract class BaseFormat implements JsonSerializable
4444
{
4545
/**
4646
* The attestation object data
47-
* @var array<string, mixed>
47+
* @var array<string|int, mixed>
4848
*/
4949
protected array $attestationData;
5050

@@ -68,7 +68,7 @@ abstract class BaseFormat implements JsonSerializable
6868

6969
/**
7070
* Create new instance
71-
* @param array<string, mixed> $attestationData
71+
* @param array<string|int, mixed> $attestationData
7272
* @param AuthenticatorData $authenticatorData
7373
*/
7474
public function __construct(

src/Attestation/Format/FidoU2F.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class FidoU2F extends BaseFormat
6363

6464
/**
6565
* Create new instance
66-
* @param array<string, mixed> $attestationData
66+
* @param array<string|int, mixed> $attestationData
6767
* @param AuthenticatorData $authenticatorData
6868
*/
6969
public function __construct(

src/Attestation/Format/Packed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Packed extends BaseFormat
6363

6464
/**
6565
* Create new instance
66-
* @param array<string, mixed> $attestationData
66+
* @param array<string|int, mixed> $attestationData
6767
* @param AuthenticatorData $authenticatorData
6868
*/
6969
public function __construct(

src/Attestation/Format/Tpm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Tpm extends BaseFormat
7878

7979
/**
8080
* Create new instance
81-
* @param array<string, mixed> $attestationData
81+
* @param array<string|int, mixed> $attestationData
8282
* @param AuthenticatorData $authenticatorData
8383
*/
8484
public function __construct(

src/Entity/PublicKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class PublicKey implements JsonSerializable
100100
* The attestation to use
101101
* @var string
102102
*/
103-
protected string $attestation;
103+
protected string $attestation = '';
104104

105105
/**
106106
* The relying party id. This is used only for login

src/Helper/CborDecoder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CborDecoder
5757
*/
5858
public static function decode($data)
5959
{
60-
if (is_string($data)) {
60+
if (! $data instanceof ByteBuffer) {
6161
$data = new ByteBuffer($data);
6262
}
6363

@@ -82,7 +82,7 @@ public static function decode($data)
8282
*/
8383
public static function decodeInPlace($data, int $startoffset, ?int $endOffset = null)
8484
{
85-
if (is_string($data)) {
85+
if (! $data instanceof ByteBuffer) {
8686
$data = new ByteBuffer($data);
8787
}
8888

src/Webauthn.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,18 @@ public function __construct(WebauthnConfiguration $config, array $allowedFormats
120120

121121
/**
122122
* Add a root certificate to verify new registrations
123-
* @param string $path
123+
* @param string|array<string> $path
124124
* @return $this
125125
*/
126-
public function addRootCertificate(string $path): self
126+
public function addRootCertificate($path): self
127127
{
128-
$this->certificates[] = Path::realPath($path);
128+
if (is_array($path)) {
129+
foreach ($path as $p) {
130+
$this->certificates[] = Path::realPath($p);
131+
}
132+
} else {
133+
$this->certificates[] = Path::realPath($path);
134+
}
129135

130136
return $this;
131137
}

tests/Entity/PublicKeyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@ public function testJson(): void
8888

8989
$json = $o->jsonSerialize();
9090

91-
$this->assertCount(7, $json);
91+
$this->assertCount(8, $json);
9292
}
9393
}

0 commit comments

Comments
 (0)