major update
This commit is contained in:
@@ -28,12 +28,12 @@ class MicrosoftOidcStateStoreServiceTest extends TestCase
|
||||
$store->store('state-a', ['tenant_id' => 5, 'nonce' => 'n1']);
|
||||
|
||||
$first = $store->consume('state-a');
|
||||
$this->assertTrue($first['ok'] ?? false);
|
||||
$this->assertTrue($first['ok']);
|
||||
$this->assertSame(5, (int) (($first['entry']['tenant_id'] ?? 0)));
|
||||
|
||||
$second = $store->consume('state-a');
|
||||
$this->assertFalse($second['ok'] ?? true);
|
||||
$this->assertSame('state_invalid', (string) ($second['error'] ?? ''));
|
||||
$this->assertFalse($second['ok']);
|
||||
$this->assertSame('state_invalid', (string) $second['error']);
|
||||
}
|
||||
|
||||
public function testConsumeReturnsExpiredForOldState(): void
|
||||
@@ -45,8 +45,8 @@ class MicrosoftOidcStateStoreServiceTest extends TestCase
|
||||
]);
|
||||
|
||||
$result = $store->consume('state-old');
|
||||
$this->assertFalse($result['ok'] ?? true);
|
||||
$this->assertSame('state_expired', (string) ($result['error'] ?? ''));
|
||||
$this->assertFalse($result['ok']);
|
||||
$this->assertSame('state_expired', (string) $result['error']);
|
||||
}
|
||||
|
||||
public function testStoreRespectsMaxEntriesAndPrunesOldStates(): void
|
||||
@@ -58,13 +58,13 @@ class MicrosoftOidcStateStoreServiceTest extends TestCase
|
||||
$store->store('state-3', ['created_at' => time() - 1]);
|
||||
|
||||
$invalid = $store->consume('state-1');
|
||||
$this->assertFalse($invalid['ok'] ?? true);
|
||||
$this->assertSame('state_invalid', (string) ($invalid['error'] ?? ''));
|
||||
$this->assertFalse($invalid['ok']);
|
||||
$this->assertSame('state_invalid', (string) $invalid['error']);
|
||||
|
||||
$valid2 = $store->consume('state-2');
|
||||
$this->assertTrue($valid2['ok'] ?? false);
|
||||
$this->assertTrue($valid2['ok']);
|
||||
|
||||
$valid3 = $store->consume('state-3');
|
||||
$this->assertTrue($valid3['ok'] ?? false);
|
||||
$this->assertTrue($valid3['ok']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user