Skip to content

Commit 7b7d572

Browse files
tvdijensgomez
authored andcommitted
Enhance test-suite (#31)
Modernize testsuite
1 parent 7a4321b commit 7b7d572

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+488
-159
lines changed

.travis.yml

Lines changed: 115 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,124 @@
11
language: php
22

3+
stages:
4+
- pre-conditions
5+
- test
6+
- quality
7+
8+
################
9+
# Test stage #
10+
################
11+
312
php:
4-
- '7.2'
13+
- 7.2
14+
- 7.3
15+
- 7.4
516

6-
sudo: false
17+
env:
18+
- COMMAND="composer install"
19+
- COMMAND="composer update"
720

8-
cache:
9-
directories:
10-
- $HOME/.composer/cache
21+
before_script:
22+
- ${COMMAND}
1123

24+
script:
25+
- php vendor/bin/phpunit --no-coverage
1226

13-
before_install:
14-
- composer self-update
27+
jobs:
28+
fast_finish: true
1529

16-
install:
17-
- composer install --dev --no-progress --no-suggest --ansi
30+
allow_failures:
31+
- php: 7.3
32+
env: Security check (composer install)
33+
- php: 7.3
34+
env: Security check (composer update)
35+
- php: 7.3
36+
env: Psalm
37+
- php: 7.3
38+
env: PHP Codesniffer
1839

19-
script:
20-
- mkdir -p build/logs
21-
- mkdir -p build/cov
22-
- ./vendor/bin/phpspec run --no-interaction -f dot
23-
- ./vendor/bin/phpunit
24-
- ./vendor/bin/phpcov merge --clover build/logs/clover.xml build/cov
25-
26-
after_success:
27-
- travis_retry php vendor/bin/php-coveralls
40+
include:
41+
42+
##########################
43+
# Pre-conditions stage #
44+
##########################
45+
46+
- stage: pre-conditions
47+
env: Syntax check PHP
48+
php: 7.2
49+
before_script:
50+
- composer install
51+
script:
52+
- vendor/bin/check-syntax-php.sh
53+
54+
- stage: pre-conditions
55+
env: Syntax check PHP
56+
php: 7.3
57+
before_script:
58+
- composer install
59+
script:
60+
- vendor/bin/check-syntax-php.sh
61+
62+
- stage: pre-conditions
63+
env: Syntax check PHP
64+
php: 7.4
65+
before_script:
66+
- composer install
67+
script:
68+
- vendor/bin/check-syntax-php.sh
69+
70+
- stage: pre-conditions
71+
env: Syntax check YAML / XML / JSON
72+
before_script:
73+
- composer require simplesamlphp/simplesamlphp-test-framework --dev
74+
script:
75+
- vendor/simplesamlphp/simplesamlphp-test-framework/bin/check-syntax-json.sh
76+
- vendor/simplesamlphp/simplesamlphp-test-framework/bin/check-syntax-xml.sh
77+
- vendor/simplesamlphp/simplesamlphp-test-framework/bin/check-syntax-yaml.sh
78+
79+
###################
80+
# Quality stage #
81+
###################
82+
83+
- stage: quality
84+
php: 7.3
85+
env: Security check (composer install)
86+
before_script:
87+
- composer install
88+
script:
89+
- vendor/bin/security-checker security:check
90+
91+
- stage: quality
92+
php: 7.3
93+
env: Security check (composer update)
94+
before_script:
95+
- composer update
96+
script:
97+
- vendor/bin/security-checker security:check
98+
99+
- stage: quality
100+
php: 7.3
101+
env: Coveralls
102+
before_script:
103+
- composer update
104+
- php vendor/bin/phpunit
105+
script:
106+
- php vendor/bin/php-coveralls
107+
# - bash <(curl -s https://codecov.io/bash)
108+
109+
- stage: quality
110+
php: 7.3
111+
env: Psalm
112+
before_script:
113+
- composer update
114+
script:
115+
- vendor/bin/psalm
116+
- vendor/bin/psalter --issues=UnnecessaryVarAnnotation --dry-run
117+
118+
- stage: quality
119+
php: 7.3
120+
env: PHP Codesniffer
121+
before_script:
122+
- composer update
123+
script:
124+
- vendor/bin/phpcs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This module adds support for the OpenID Connect protocol through a SimpleSAMLphp
55

66
[![Build Status](https://travis-ci.org/rediris-es/simplesamlphp-module-oidc.svg?branch=master)](https://travis-ci.org/rediris-es/simplesamlphp-module-oidc)
77
[![Coverage Status](https://coveralls.io/repos/github/rediris-es/simplesamlphp-module-oidc/badge.svg?branch=master)](https://coveralls.io/github/rediris-es/simplesamlphp-module-oidc?branch=master)
8-
[![SimpleSAMLphp](https://img.shields.io/badge/simplesamlphp-1.15-red.svg)](https://simplesamlphp.org/)
8+
[![SimpleSAMLphp](https://img.shields.io/badge/simplesamlphp-1.18-red.svg)](https://simplesamlphp.org/)
99

1010
![Main screen capture](docs/oidc.png)
1111

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@
3131
"friendsofphp/php-cs-fixer": "^2.10",
3232
"friends-of-phpspec/phpspec-code-coverage": "^4.3",
3333
"php-coveralls/php-coveralls": "^2.0",
34-
"phpspec/phpspec": "^4.3",
34+
"phpspec/phpspec": "^6.1",
3535
"phpunit/php-code-coverage": "^6.0",
3636
"phpunit/phpcov": "^5.0",
3737
"phpunit/phpunit": "^7.0",
38-
"simplesamlphp/simplesamlphp": "^1.18"
38+
"simplesamlphp/simplesamlphp": "^1.18",
39+
"simplesamlphp/simplesamlphp-test-framework": "^0.1.0"
3940
},
4041
"config": {
4142
"preferred-install": {
File renamed without changes.

hooks/hook_cron.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
* file that was distributed with this source code.
1313
*/
1414

15+
16+
/**
17+
* @param array &$croninfo
18+
* @return void
19+
*/
1520
function oidc_hook_cron(&$croninfo)
1621
{
1722
assert('is_array($croninfo)');

hooks/hook_frontpage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
* file that was distributed with this source code.
1313
*/
1414

15+
/**
16+
* @param array &$links
17+
* @return void
18+
*/
1519
function oidc_hook_frontpage(&$links)
1620
{
1721
assert('is_array($links)');

lib/ClaimTranslatorExtractor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class ClaimTranslatorExtractor extends ClaimExtractor
9494
*
9595
* @throws \OpenIDConnectServer\Exception\InvalidArgumentException
9696
*/
97-
public function __construct($claimSets = [], $translationTable = [])
97+
public function __construct(array $claimSets = [], array $translationTable = [])
9898
{
9999
$this->translationTable = array_merge($this->translationTable, $translationTable);
100100

@@ -133,7 +133,7 @@ private function translateSamlAttributesToClaims($samlAttributes): array
133133
* @param array $samlAttributes
134134
* @return array
135135
*/
136-
public function extract(array $scopes, array $samlAttributes)
136+
public function extract(array $scopes, array $samlAttributes): array
137137
{
138138
$claims = $this->translateSamlAttributesToClaims($samlAttributes);
139139

lib/Controller/ClientIndexController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(ClientRepository $clientRepository, TemplateFactory
4646
* @param \Zend\Diactoros\ServerRequest $request
4747
* @return \SimpleSAML\XHTML\Template
4848
*/
49-
public function __invoke(ServerRequest $request)
49+
public function __invoke(ServerRequest $request): \SimpleSAML\XHTML\Template
5050
{
5151
$clients = $this->clientRepository->findAll();
5252

lib/Controller/ClientResetSecretController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(ClientRepository $clientRepository, SessionMessagesS
4848
* @param \Zend\Diactoros\ServerRequest $request
4949
* @return \Zend\Diactoros\Response\RedirectResponse
5050
*/
51-
public function __invoke(ServerRequest $request)
51+
public function __invoke(ServerRequest $request): RedirectResponse
5252
{
5353
$client = $this->getClientFromRequest($request);
5454
$body = $request->getParsedBody();

lib/Controller/ClientShowController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(ClientRepository $clientRepository, TemplateFactory
4444
* @param \Zend\Diactoros\ServerRequest $request
4545
* @return \SimpleSAML\XHTML\Template
4646
*/
47-
public function __invoke(ServerRequest $request)
47+
public function __invoke(ServerRequest $request): \SimpleSAML\XHTML\Template
4848
{
4949
$client = $this->getClientFromRequest($request);
5050

0 commit comments

Comments
 (0)