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
49 changes: 25 additions & 24 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,32 @@ on: # yamllint disable-line rule:truthy
workflow_dispatch:

jobs:
phplinter:
name: 'PHP-Linter'
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']

uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/[email protected]
with:
php-version: ${{ matrix.php-version }}

linter:
name: Linter
runs-on: ['ubuntu-latest']
name: 'Linter'
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Lint Code Base
uses: super-linter/super-linter/slim@v7
env:
SAVE_SUPER_LINTER_OUTPUT: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: 'tools/linters'
LOG_LEVEL: NOTICE
VALIDATE_ALL_CODEBASE: true
VALIDATE_CSS: true
VALIDATE_JAVASCRIPT_ES: true
VALIDATE_JSON: true
VALIDATE_PHP_BUILTIN: true
VALIDATE_YAML: true
VALIDATE_XML: true
VALIDATE_GITHUB_ACTIONS: true
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/[email protected]
with:
enable_eslinter: true
enable_jsonlinter: true
enable_stylelinter: false
enable_yamllinter: true

quality:
name: Quality control
needs: [unit-tests-linux]
runs-on: [ubuntu-latest]

steps:
Expand Down Expand Up @@ -109,7 +108,9 @@ jobs:

security:
name: Security checks
needs: [unit-tests-linux]
runs-on: [ubuntu-latest]

steps:
- name: Setup PHP, with composer and extensions
# https://github.com/shivammathur/setup-php
Expand Down Expand Up @@ -151,7 +152,7 @@ jobs:
unit-tests-linux:
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
runs-on: ${{ matrix.operating-system }}
needs: [linter, quality, security]
needs: [phplinter, linter]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -216,7 +217,7 @@ jobs:
unit-tests-windows:
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
runs-on: ${{ matrix.operating-system }}
needs: [linter, quality, security]
needs: [phplinter, linter]
strategy:
fail-fast: true
matrix:
Expand Down
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---

coverage:
status:
project:
Expand Down
50 changes: 32 additions & 18 deletions routing/routes/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
---

negotiate-auth:
path: /auth
defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::auth' }
methods: [GET]
path: /auth
defaults: {
_controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::auth'
}
methods: [GET]

negotiate-error:
path: /error
defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::error' }
methods: [GET]
path: /error
defaults: {
_controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::error'
}
methods: [GET]

negotiate-enable:
path: /enable
defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::enable' }
methods: [GET]
path: /enable
defaults: {
_controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::enable'
}
methods: [GET]

negotiate-disable:
path: /disable
defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::disable' }
methods: [GET]
path: /disable
defaults: {
_controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::disable'
}
methods: [GET]

negotiate-retry:
path: /retry
defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::retry' }
methods: [GET]
path: /retry
defaults: {
_controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::retry'
}
methods: [GET]

negotiate-fallback:
path: /fallback
defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::fallback' }
methods: [GET]
path: /fallback
defaults: {
_controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::fallback'
}
methods: [GET]
9 changes: 1 addition & 8 deletions tests/src/Controller/NegotiateControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@
*
* @package SimpleSAML\Test
*/
class NegotiateControllerTest extends TestCase
final class NegotiateControllerTest extends TestCase

Check failure on line 21 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

UnusedClass

tests/src/Controller/NegotiateControllerTest.php:21:13: UnusedClass: Class SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest is never used (see https://psalm.dev/075)

Check failure on line 21 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

UnusedClass

tests/src/Controller/NegotiateControllerTest.php:21:13: UnusedClass: Class SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest is never used (see https://psalm.dev/075)
{
/** @var \SimpleSAML\Configuration */
protected Configuration $config;

Check warning on line 23 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PropertyNotSetInConstructor

tests/src/Controller/NegotiateControllerTest.php:23:29: PropertyNotSetInConstructor: Property SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest::$config is not defined in constructor of SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest or in any methods called in the constructor (see https://psalm.dev/074)

Check warning on line 23 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PropertyNotSetInConstructor

tests/src/Controller/NegotiateControllerTest.php:23:29: PropertyNotSetInConstructor: Property SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest::$config is not defined in constructor of SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest or in any methods called in the constructor (see https://psalm.dev/074)

/** @var \SimpleSAML\Session */
protected Session $session;

Check warning on line 24 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PropertyNotSetInConstructor

tests/src/Controller/NegotiateControllerTest.php:24:23: PropertyNotSetInConstructor: Property SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest::$session is not defined in constructor of SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest or in any methods called in the constructor (see https://psalm.dev/074)

Check warning on line 24 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PropertyNotSetInConstructor

tests/src/Controller/NegotiateControllerTest.php:24:23: PropertyNotSetInConstructor: Property SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest::$session is not defined in constructor of SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest or in any methods called in the constructor (see https://psalm.dev/074)

/**
* Set up for each test.
*/
protected function setUp(): void

Check failure on line 29 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

MissingOverrideAttribute

tests/src/Controller/NegotiateControllerTest.php:29:5: MissingOverrideAttribute: Method SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest::setup should have the "Override" attribute (see https://psalm.dev/358)

Check failure on line 29 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

MissingOverrideAttribute

tests/src/Controller/NegotiateControllerTest.php:29:5: MissingOverrideAttribute: Method SimpleSAML\Test\Module\negotiateext\Controller\NegotiateControllerTest::setup should have the "Override" attribute (see https://psalm.dev/358)
{
parent::setUp();

Expand Down Expand Up @@ -125,8 +122,6 @@
public function testEnable(): void
{
$c = new Controller\NegotiateController($this->config, $this->session);

/** @var \SimpleSAML\XHTML\Template $response */
$response = $c->enable();

// Validate response
Expand All @@ -141,13 +136,13 @@
}
}

$this->assertEquals($cookie->getValue(), null);

Check warning on line 139 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:139:29: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)

Check warning on line 139 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:139:29: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)
$this->assertEquals($cookie->getDomain(), null);

Check warning on line 140 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:140:29: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)

Check warning on line 140 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:140:29: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)
$this->assertEquals($cookie->getPath(), '/');

Check warning on line 141 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:141:29: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)

Check warning on line 141 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:141:29: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)
$this->assertEquals($expiration = $cookie->getExpiresTime(), mktime(0, 0, 0, 1, 1, 2038));

Check warning on line 142 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:142:43: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)

Check warning on line 142 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:142:43: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)
$this->assertEquals($cookie->getMaxAge(), $expiration - time());

Check warning on line 143 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:143:29: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)

Check warning on line 143 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:143:29: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)
$this->assertTrue($cookie->isSecure());

Check warning on line 144 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:144:27: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)

Check warning on line 144 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:144:27: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)
$this->assertTrue($cookie->isHttpOnly());

Check warning on line 145 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:145:27: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)

Check warning on line 145 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:145:27: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 133 (see https://psalm.dev/018)
}


Expand All @@ -157,8 +152,6 @@
public function testDisable(): void
{
$c = new Controller\NegotiateController($this->config, $this->session);

/** @var \SimpleSAML\XHTML\Template $response */
$response = $c->disable();

// Validate response
Expand All @@ -173,7 +166,7 @@
}
}

$this->assertEquals($cookie->getValue(), 'true');

Check warning on line 169 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:169:29: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 163 (see https://psalm.dev/018)

Check warning on line 169 in tests/src/Controller/NegotiateControllerTest.php

View workflow job for this annotation

GitHub Actions / Quality control

PossiblyUndefinedVariable

tests/src/Controller/NegotiateControllerTest.php:169:29: PossiblyUndefinedVariable: Possibly undefined variable $cookie, first seen on line 163 (see https://psalm.dev/018)
$this->assertEquals($cookie->getDomain(), null);
$this->assertEquals($cookie->getPath(), '/');
$this->assertEquals($expiration = $cookie->getExpiresTime(), mktime(0, 0, 0, 1, 1, 2038));
Expand Down
7 changes: 7 additions & 0 deletions tools/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

extends: default

rules:
line-length:
max: 120
14 changes: 14 additions & 0 deletions tools/linters/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// eslint.config.js
const { defineConfig } = require("eslint/config");

module.exports = defineConfig([
{
languageOptions: {
ecmaVersion: 2015,
sourceType: "module"
},
files: [
"**.js"
],
}
]);
Loading