Skip to content

Commit

Permalink
tests?
Browse files Browse the repository at this point in the history
  • Loading branch information
szabogyula committed Apr 26, 2016
1 parent ccdfb58 commit 4f22a09
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 28 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
matrix:
allow_failures:
- php: hhvm
before_script: composer update --dev
script: php vendor/phpunit/phpunit/phpunit.php
11 changes: 11 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,16 @@
},
"autoload": {
"psr-4": {"SimpleSAML\\Module\\authVHO\\": "lib"}
},
"require-dev": {
"simplesamlphp/simplesamlphp": "1.14",
"phpunit/phpunit": "~3.7"
},
"autoload-dev": {
"files": ["tests/_autoload_modules.php"]
},
"support": {
"issues": "https://github.com/NIIF/simplesamlphp-module-authVHO/issues",
"source": "https://github.com/NIIF/simplesamlphp-module-authVHO"
}
}
28 changes: 0 additions & 28 deletions lib/Auth/Process/RedirectTest.php

This file was deleted.

8 changes: 8 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpunit bootstrap="./vendor/autoload.php">
<testsuites>
<testsuite name="The project's test suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
33 changes: 33 additions & 0 deletions tests/Auth/Process/RedirectTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
namespace SimpleSAML\Module\authVHO\Auth\Process;

use SimpleSAML\Module;
use SimpleSAML_Auth_ProcessingFilter;
use SimpleSAML_Auth_State;
use SimpleSAML\Utils;

/**
* A simple processing filter for testing that redirection works as it should.
*
*/
class RedirectTest extends SimpleSAML_Auth_ProcessingFilter
{
/**
* Initialize processing of the redirect test.
*
* @param array &$state The state we should update.
*/
public function process(&$state)
{
assert('is_array($state)');
assert('array_key_exists("Attributes", $state)');

// To check whether the state is saved correctly
$state['Attributes']['RedirectTest1'] = array('OK');

// Save state and redirect
$id = SimpleSAML_Auth_State::saveState($state, 'authVHO:redirectfilter-test');
$url = Module::getModuleURL('authVHO/redirecttest.php');
HTTP::redirectTrustedURL($url, array('StateId' => $id));
}
}

0 comments on commit 4f22a09

Please sign in to comment.