Skip to content

Commit

Permalink
fix UrlTrait::validate call test for the different methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioigoume committed Jan 2, 2025
1 parent 8c9a764 commit 7a8e7bb
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions tests/src/Controller/Cas20ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,28 @@ protected function setUp(): void
];
}

public function testProxyValidatePassesTheCorrectMethodToValidate(): void
public static function validateMethods(): array
{
return [
'Call serviceValidate action' => [
'ST-',
'serviceValidate',
],
'Call proxyValidate action' => [
'PT-',
'proxyValidate',
],
];
}

#[DataProvider('validateMethods')]
public function testProxyValidatePassesTheCorrectMethodToValidate(string $prefix, string $method): void
{
$casconfig = Configuration::loadFromArray($this->moduleConfig);
$requestParameters = [
'renew' => false,
'service' => 'https://myservice.com/abcd',
'ticket' => 'ST-' . $this->sessionId,
'ticket' => $prefix . $this->sessionId,
];

$request = Request::create(
Expand All @@ -127,10 +142,10 @@ public function testProxyValidatePassesTheCorrectMethodToValidate(): void

$expectedArguments = [
'request' => $request,
'method' => 'proxyValidate',
'method' => $method,
'renew' => false,
'target' => null,
'ticket' => 'ST-' . $this->sessionId,
'ticket' => $prefix . $this->sessionId,
'service' => 'https://myservice.com/abcd',
'pgtUrl' => null,
];
Expand All @@ -142,7 +157,7 @@ public function testProxyValidatePassesTheCorrectMethodToValidate(): void

$controllerMock->expects($this->once())->method('validate')
->with(...$expectedArguments);
$controllerMock->proxyValidate($request, ...$requestParameters);
$controllerMock->$method($request, ...$requestParameters);
}

public static function queryParameterValues(): array
Expand Down

0 comments on commit 7a8e7bb

Please sign in to comment.