Skip to content

Commit

Permalink
Merge pull request #110 from open-source-contributions/test_improvement
Browse files Browse the repository at this point in the history
Test improvement
  • Loading branch information
lorenzocattaneo authored Jun 17, 2020
2 parents 50d7979 + 46d46ff commit 29888e0
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 56 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/example export-ignore
/tests export-ignore
/phpunit.xml export-ignore
.gitattributes export-ignore
.gitattributes merge=ours
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
language: php

php:
- 7.2.26
- 7.3.12
- 7.4.1
- 7.2.28
- 7.3.15
- 7.4.3

cache:
directories:
- $HOME/.composer/cache

install:
- composer install --no-interaction
- mkdir -p example/idp_metadata
- php bin/download_idp_metadata.php ./example/idp_metadata

script:
- find . | grep 'php$' | grep -v vendor | grep -v tests | xargs ./vendor/bin/phpcs --standard=PSR2
- vendor/bin/phpunit --stderr tests
18 changes: 18 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<phpunit
bootstrap="vendor/autoload.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
strict="true">

<testsuite name="spid-php-lib tests">
<directory>./tests</directory>
</testsuite>

<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>

</phpunit>
10 changes: 4 additions & 6 deletions tests/IdpTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
declare(strict_types=1);

require_once(__DIR__ . "/../vendor/autoload.php");

final class IdpTest extends PHPUnit\Framework\TestCase
{
private static $settings = [
Expand All @@ -22,7 +20,7 @@ final class IdpTest extends PHPUnit\Framework\TestCase
["name", "familyName", "fiscalNumber", "email", "spidCode"]
]
];

private static $idps = [];

public static function setupIdps()
Expand Down Expand Up @@ -86,11 +84,11 @@ public function testLoadXMLWIthWrongFilePath()
$sp->settings['idp_metadata_folder'] = '/wrong/path/to/metadata/';

$this->expectException(\Exception::class);
$loaded = $idp->loadFromXml(self::$idps[0]);
$idp->loadFromXml(self::$idps[0]);

$this->assertAttributeNotEmpty(null, $idp);
$this->assertAttributeNotEmpty(null, $idp);
}

// TODO check if logout response should redirect
}
}
Loading

0 comments on commit 29888e0

Please sign in to comment.