Skip to content

Commit

Permalink
Repair AuthorizationServiceTest and typehint entities
Browse files Browse the repository at this point in the history
  • Loading branch information
MKodde committed Feb 28, 2024
1 parent a53cb9b commit 4e910cc
Show file tree
Hide file tree
Showing 27 changed files with 30 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function getIterator()
return new ArrayIterator($this->allowedSecondFactors);
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return $this->allowedSecondFactors;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __toString(): string
return $this->contactInformation;
}

public function jsonSerialize()
public function jsonSerialize(): string
{
return $this->contactInformation;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Surfnet/Stepup/Configuration/Value/Institution.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __toString(): string
return $this->institution;
}

public function jsonSerialize()
public function jsonSerialize(): string
{
return $this->institution;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function isDefault()
return $this->isDefault;
}

public function jsonSerialize()
public function jsonSerialize(): ?array
{
if ($this->isDefault) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function __toString(): string
return $this->institutionConfigurationId;
}

public function jsonSerialize()
public function jsonSerialize(): string
{
return $this->institutionConfigurationId;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Surfnet/Stepup/Configuration/Value/InstitutionRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getType()
return $this->type;
}

public function jsonSerialize()
public function jsonSerialize(): string
{
return $this->type;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Surfnet/Stepup/Configuration/Value/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __toString(): string
return $this->location;
}

public function jsonSerialize()
public function jsonSerialize(): string
{
return $this->location;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getNumberOfTokensPerIdentity()
return $this->numberOfTokensPerIdentity;
}

public function jsonSerialize()
public function jsonSerialize(): int
{
return $this->numberOfTokensPerIdentity;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Surfnet/Stepup/Configuration/Value/RaLocationId.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __toString(): string
return $this->raLocationId;
}

public function jsonSerialize()
public function jsonSerialize(): string
{
return $this->raLocationId;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Surfnet/Stepup/Configuration/Value/RaLocationName.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __toString(): string
return $this->raLocationName;
}

public function jsonSerialize()
public function jsonSerialize(): string
{
return $this->raLocationName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function isEnabled()
return $this->showRaaContactInformationOption;
}

public function jsonSerialize()
public function jsonSerialize(): bool
{
return $this->showRaaContactInformationOption;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function isEnabled()
return $this->useRaLocationsOption;
}

public function jsonSerialize()
public function jsonSerialize(): bool
{
return $this->useRaLocationsOption;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function isEnabled()
return $this->verifyEmailOption;
}

public function jsonSerialize()
public function jsonSerialize(): bool
{
return $this->verifyEmailOption;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class AuditLogEntry implements JsonSerializable
#[ORM\Column(type: 'stepup_datetime')]
public $recordedOn;

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'actor_id' => $this->actorId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function create(
return $identity;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'id' => $this->id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function create(
return $identitySelfAssertedTokenOptions;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'identity_id' => (string)$this->identityId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function createFrom(Institution $institution): self
return $instance;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return ['name' => $this->institution];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static function nominate(
return $candidate;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'identity_id' => $this->identityId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static function create(
return $entry;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'identity_id' => $this->identityId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function __construct(
$this->status = SecondFactorStatus::unverified();
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'id' => $this->id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class RecoveryToken implements JsonSerializable
#[ORM\Column(length: 255)]
public $recoveryMethodIdentifier;

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'id' => $this->id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class UnverifiedSecondFactor implements JsonSerializable
#[ORM\Column(length: 32)]
public $verificationNonce;

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'id' => $this->id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class VerifiedSecondFactor implements JsonSerializable
#[ORM\Column(type: 'stepup_datetime')]
public $registrationRequestedAt;

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'id' => $this->id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function vettingType(): string
return $this->vettingType;
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'id' => $this->id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class VettingTypeHint implements JsonSerializable
#[ORM\Column(type: 'stepup_vetting_type_hints')]
public VettingTypeHintCollection $hints;

public function jsonSerialize()
public function jsonSerialize(): array
{
return [
'institution' => $this->institution,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function createFrom(Institution $institution): self
return $instance;
}

public function jsonSerialize()
public function jsonSerialize(): string
{
return $this->institution;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

namespace Surfnet\StepupMiddleware\ApiBundle\Tests\Authorization\Service;

use Doctrine\Common\Collections\ArrayCollection;
use Mockery as m;
use Pagerfanta\Pagerfanta;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -473,7 +474,7 @@ public function test_it_allows_self_vetting_when_one_sat_present(): void
$vettedSecondFactor->vettingType = VettingType::TYPE_SELF_ASSERTED_REGISTRATION;

$collection = m::mock(Pagerfanta::class);
$collection->shouldReceive('getIterator')->andReturn([$vettedSecondFactor]);
$collection->shouldReceive('getIterator')->andReturn(new ArrayCollection([$vettedSecondFactor]));

$this->secondFactorService
->shouldReceive('searchVettedSecondFactors')
Expand Down Expand Up @@ -509,7 +510,7 @@ public function test_it_allows_self_vetting_when_multiple_sat_present(): void
$vettedSecondFactor->vettingType = VettingType::TYPE_SELF_ASSERTED_REGISTRATION;

$collection = m::mock(Pagerfanta::class);
$collection->shouldReceive('getIterator')->andReturn([$vettedSecondFactor, $vettedSecondFactor]);
$collection->shouldReceive('getIterator')->andReturn(new ArrayCollection([$vettedSecondFactor, $vettedSecondFactor]));

$this->secondFactorService
->shouldReceive('searchVettedSecondFactors')
Expand Down Expand Up @@ -546,7 +547,7 @@ public function test_it_denies_self_vetting_when_other_vetting_type(): void
$vettedSecondFactor->vettingType = VettingType::TYPE_ON_PREMISE;

$collection = m::mock(Pagerfanta::class);
$collection->shouldReceive('getIterator')->andReturn([$vettedSecondFactor, $vettedSecondFactor]);
$collection->shouldReceive('getIterator')->andReturn(new ArrayCollection([$vettedSecondFactor, $vettedSecondFactor]));

$this->secondFactorService
->shouldReceive('searchVettedSecondFactors')
Expand Down

0 comments on commit 4e910cc

Please sign in to comment.