Skip to content

Commit 5191ef2

Browse files
committed
Placeholder for real travis-ci tests
1 parent 8e31c11 commit 5191ef2

File tree

5 files changed

+87
-2
lines changed

5 files changed

+87
-2
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ matrix:
1414
before_script:
1515
composer update --dev
1616

17-
# hack - lets at least test syntax at this stage
18-
script: php -l lib/Auth/Process/AttributeFromSQL.php
17+
script:
18+
php vendor/phpunit/phpunit/phpunit.php

composer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,16 @@
1111
],
1212
"require": {
1313
"simplesamlphp/composer-module-installer": "^1.1"
14+
},
15+
"require-dev": {
16+
"simplesamlphp/simplesamlphp": ">=1.14",
17+
"phpunit/phpunit": "~3.7"
18+
},
19+
"autoload-dev": {
20+
"files": ["tests/_autoload_modules.php"]
21+
},
22+
"support": {
23+
"issues": "https://github.com/safire-ac-za/simplesamlphp-module-sqlattribs/issues",
24+
"source": "https://github.com/safire-ac-za/simplesamlphp-module-sqlattribs"
1425
}
1526
}

phpunit.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<phpunit bootstrap="./vendor/autoload.php" colors="true">
3+
<testsuites>
4+
<testsuite name="The project's test suite">
5+
<directory>./tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
</phpunit>
9+

tests/_autoload_modules.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/**
4+
* This file implements a trimmed down version of the SSP module aware autoloader that can be used in tests.
5+
*
6+
* @author Patrick Radtke
7+
*/
8+
9+
/**
10+
* Autoload function for local SimpleSAMLphp modules.
11+
*
12+
* @param string $className Name of the class.
13+
*/
14+
function SimpleSAML_test_module_autoload($className)
15+
{
16+
$modulePrefixLength = strlen('sspmod_');
17+
$classPrefix = substr($className, 0, $modulePrefixLength);
18+
if ($classPrefix !== 'sspmod_') {
19+
return;
20+
}
21+
22+
$modNameEnd = strpos($className, '_', $modulePrefixLength);
23+
$moduleClass = substr($className, $modNameEnd + 1);
24+
25+
$file = dirname(dirname(__FILE__)) . '/lib/' . str_replace('_', '/', $moduleClass) . '.php';
26+
27+
if (file_exists($file)) {
28+
require_once($file);
29+
}
30+
}
31+
32+
spl_autoload_register('SimpleSAML_test_module_autoload');
33+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
// Alias the PHPUnit 6.0 ancestor if available, else fall back to legacy ancestor
3+
if (class_exists('\PHPUnit\Framework\TestCase', true) and !class_exists('\PHPUnit_Framework_TestCase', true)) {
4+
class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase', true);
5+
}
6+
7+
class Test_sspmod_sqlattribs_Auth_Process_AttributeFromSQL extends \PHPUnit_Framework_TestCase
8+
{
9+
/**
10+
* Helper function to run the filter with a given configuration.
11+
*
12+
* @param array $config The filter configuration.
13+
* @param array $request The request state.
14+
* @return array The state array after processing.
15+
*/
16+
private static function processFilter(array $config, array $request)
17+
{
18+
$filter = new \sspmod_sqlattribs_Auth_Process_AttributeFromSQL($config, null);
19+
$filter->process($request);
20+
return $request;
21+
}
22+
23+
protected function setUp()
24+
{
25+
\SimpleSAML_Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml');
26+
}
27+
28+
public function testAny()
29+
{
30+
$this->assertTrue(true, 'Just for travis.yml test');
31+
}
32+
}

0 commit comments

Comments
 (0)