Skip to content

Commit

Permalink
Prevent null|string function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
MKodde committed Jul 11, 2024
1 parent 50d25d2 commit a1c3daa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,11 @@ public function getIdentityNameId(): string
*/
public function getNormalizedSchacHomeOrganization(): ?string
{
return strtolower(
$this->stateHandler->getSchacHomeOrganization()
);
$schacHomeOrganization = $this->stateHandler->getSchacHomeOrganization();
if ($schacHomeOrganization === null) {
return null;
}
return strtolower($schacHomeOrganization);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ public function iEnterTheOtp(): void
public function iEnterTheSmsVerificationCode(): void
{
$cookieValue = $this->minkContext->getSession()->getDriver()->getCookie('smoketest-sms-service');
if ($cookieValue === null) {
throw new RuntimeException('Unable to load the smoketest-sms-service cookie');
}
$matches = [];
preg_match('/^Your\ SMS\ code:\ (.*)$/', $cookieValue, $matches);
$this->minkContext->fillField('gateway_verify_sms_challenge_challenge', $matches[1]);
Expand Down

0 comments on commit a1c3daa

Please sign in to comment.