Skip to content
Merged
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
26 changes: 22 additions & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,39 @@ on: # yamllint disable-line rule:truthy
jobs:
phplinter:
name: 'PHP-Linter'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['8.3', '8.4', '8.5']

uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v2.0.1
with:
php-version: ${{ matrix.php-version }}
steps:
- name: Checkout Code
uses: actions/checkout@v7

- name: Setup PHP runtime
uses: shivammathur/setup-php@v2
with:
tools: phive
php-version: ${{ matrix.php-version }}
coverage: "none"
extensions: :redis

- name: Install overtrue/phplint (latest)
run: phive install overtrue/phplint --force-accept-unsigned --target ./bin
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lint PHP files
run: ./bin/phplint --no-cache --no-progress -v

linter:
name: 'Linter'
strategy:
fail-fast: false

uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v2.0.1
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.11.6
secrets: inherit
with:
enable_eslinter: true
enable_jsonlinter: true
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@
"simplesamlphp/saml11": "~2.3"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "~1.11"
"simplesamlphp/simplesamlphp-test-framework": "~1.11",
"php-parallel-lint/php-parallel-lint": "^1.4"
},
"support": {
"issues": "https://github.com/simplesamlphp/simplesamlphp-module-casserver/issues",
"source": "https://github.com/simplesamlphp/simplesamlphp-module-casserver"
},
"scripts": {
"verify": [
"vendor/bin/parallel-lint --exclude vendor .",
"vendor/bin/phpcs -p",
"vendor/bin/phpunit --no-coverage --testdox",
"vendor/bin/phpstan --memory-limit=256M analyze -c phpstan.neon",
Expand Down
16 changes: 0 additions & 16 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -276,29 +276,13 @@ parameters:
count: 1
path: src/Cas/TicketValidator.php

-
message: '#^Property SimpleSAML\\Module\\casserver\\Controller\\Cas10Controller\:\:\$sspConfig is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: src/Controller/Cas10Controller.php

-
message: '#^Property SimpleSAML\\Module\\casserver\\Controller\\Cas20Controller\:\:\$sspConfig is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: src/Controller/Cas20Controller.php

-
message: '#^Call to an undefined method SimpleSAML\\XML\\SerializableElementInterface\:\:getXML\(\)\.$#'
identifier: method.notFound
count: 1
path: src/Controller/Cas30Controller.php

-
message: '#^Property SimpleSAML\\Module\\casserver\\Controller\\Cas30Controller\:\:\$sspConfig is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: src/Controller/Cas30Controller.php

-
message: '#^Cannot cast array to string\.$#'
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
colors="true"
bootstrap="tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
backupGlobals="false"
displayDetailsOnTestsThatTriggerWarnings="true"
cacheDirectory=".phpunit.cache">
Expand Down
1 change: 0 additions & 1 deletion tests/src/Cas/Protocol/SamlValidateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public function testSamlValidateXmlGeneration(): void

$p = xml_parser_create();
xml_parse_into_struct($p, \strval($xmlString), $vals, $index);
xml_parser_free($p);

$this->assertEquals(
$serviceUrl,
Expand Down
10 changes: 5 additions & 5 deletions tests/src/Controller/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public function testValidServiceUrl(string $serviceParam, string $redirectURL, b
$this->authSimpleMock->expects($this->once())->method('getAuthDataArray')->willReturn($state);

$controllerMock->expects($this->once())->method('getSession')->willReturn($this->sessionMock);
$this->authSimpleMock->expects($this->any())->method('isAuthenticated')->willReturn(true);
$this->authSimpleMock->expects($this->atLeastOnce())->method('isAuthenticated')->willReturn(true);
$queryParameters = [$serviceParam => 'https://example.com/ssp/module.php/cas/linkback.php'];
$loginRequest = Request::create(
uri: Module::getModuleURL('casserver/login'),
Expand Down Expand Up @@ -396,7 +396,7 @@ public function testAuthprocReceivesServiceAndIdpEntityIds(): void
$sessionId = session_create_id();
$this->sessionMock->expects($this->exactly(2))->method('getSessionId')->willReturn($sessionId);
$controllerMock->expects($this->once())->method('getSession')->willReturn($this->sessionMock);
$this->authSimpleMock->expects($this->any())->method('isAuthenticated')->willReturn(true);
$this->authSimpleMock->expects($this->atLeastOnce())->method('isAuthenticated')->willReturn(true);
$this->authSimpleMock->expects($this->once())->method('getAuthData')->with('Expire')->willReturn(9999999999);
$this->authSimpleMock->expects($this->once())->method('getAuthDataArray')->willReturn($state);

Expand Down Expand Up @@ -451,7 +451,7 @@ public function testResumedAuthprocStateRejectsDifferentService(): void
$sessionId = session_create_id();
$this->sessionMock->expects($this->exactly(2))->method('getSessionId')->willReturn($sessionId);
$controllerMock->expects($this->once())->method('getSession')->willReturn($this->sessionMock);
$this->authSimpleMock->expects($this->any())->method('isAuthenticated')->willReturn(true);
$this->authSimpleMock->expects($this->atLeastOnce())->method('isAuthenticated')->willReturn(true);
$this->authSimpleMock->expects($this->once())->method('getAuthData')->with('Expire')->willReturn(9999999999);

// The user comes back from the authproc filter having swapped in a different legal service.
Expand Down Expand Up @@ -497,7 +497,7 @@ public function testResumedAuthprocStateAcceptsMatchingService(): void
$sessionId = session_create_id();
$this->sessionMock->expects($this->exactly(2))->method('getSessionId')->willReturn($sessionId);
$controllerMock->expects($this->once())->method('getSession')->willReturn($this->sessionMock);
$this->authSimpleMock->expects($this->any())->method('isAuthenticated')->willReturn(true);
$this->authSimpleMock->expects($this->atLeastOnce())->method('isAuthenticated')->willReturn(true);
$this->authSimpleMock->expects($this->once())->method('getAuthData')->with('Expire')->willReturn(9999999999);

$queryParameters = [
Expand Down Expand Up @@ -735,7 +735,7 @@ public function testAuthenticatedPostSubmitsViaPostWithTicket(): void
$this->sessionMock->expects($this->exactly(2))->method('getSessionId')->willReturn($sessionId);

// Simulate authenticated state and required auth data
$this->authSimpleMock->expects($this->any())->method('isAuthenticated')->willReturn(true);
$this->authSimpleMock->expects($this->atLeastOnce())->method('isAuthenticated')->willReturn(true);
$this->authSimpleMock->expects($this->once())->method('getAuthData')->with('Expire')->willReturn(9999999999);
$this->authSimpleMock->expects($this->once())->method('getAuthDataArray')->willReturn([
'Attributes' => [
Expand Down
2 changes: 0 additions & 2 deletions tests/src/Ticket/FileSystemTicketStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public function testValidateTicketPathThrowsWhenTicketStorageDirectoryIsNotAcces
$store = $this->createStore($this->ticketDir);

$rp = new \ReflectionProperty($store, 'pathToTicketDirectory');
$rp->setAccessible(true);
$rp->setValue($store, $this->ticketDir . DIRECTORY_SEPARATOR . 'does-not-exist-' . bin2hex(random_bytes(4)));

$this->expectException(Exception::class);
Expand Down Expand Up @@ -135,7 +134,6 @@ private function createStore(string $ticketDir): FileSystemTicketStore
private function invokeValidateTicketPath(FileSystemTicketStore $store, string $ticketId): string
{
$rm = new \ReflectionMethod($store, 'validateTicketPath');
$rm->setAccessible(true);

$result = $rm->invoke($store, $ticketId);
self::assertIsString($result);
Expand Down