Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Esia/OpenId.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ public function getConfig(): Config
* @return string|false
* @throws SignFailException
*/
public function buildUrl()
public function buildUrl(string $state = null)
{
$timestamp = $this->getTimeStamp();
$state = $this->buildState();
$state = $state ?? $this->buildState();
$message = $this->config->getScopeString()
. $timestamp
. $this->config->getClientId()
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/OpenIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ public function testGetDocInfo(): void
self::assertSame([['phone' => '555 555 555'], ['email' => 'test@gmail.com']], $info);
}

public function testBuildUrl(): void
{
$state = '47e1f1e9-8b56-4666-ac02-d1408408e5f2';
$url = $this->openId->buildUrl($state);
self::assertStringContainsString($state, $url);
}

/**
* @throws InvalidConfigurationException
*/
Expand Down