1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SimpleSAML\Module\monitor\Test; |
4
|
|
|
|
5
|
|
|
use \SimpleSAML\Module\monitor\Store\Sql as Sql; |
|
|
|
|
6
|
|
|
|
7
|
|
|
// This test relies on \SimpleSAML_Configuration::setPreLoadedConfig(), which is not available until after 1.15.4 |
8
|
|
|
if (method_exists('SimpleSAML_Configuration', 'setPreLoadedConfig')) { |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Tests for Sql |
12
|
|
|
*/ |
13
|
|
|
class TestSqlTest extends \SimpleSAML\Test\Utils\ClearStateTestCase |
14
|
|
|
{ |
15
|
|
|
public function testSqlSuccess() |
16
|
|
|
{ |
17
|
|
|
$globalConfig_input = [ |
18
|
|
|
'store.type' => 'sql', |
19
|
|
|
'store.sql.dsn' => 'sqlite:/modules/monitor/tests/files/test.sqlite', |
20
|
|
|
'store.sql.username' => 'test', |
21
|
|
|
'store.sql.password' => 'test', |
22
|
|
|
'store.sql.options' => null, |
23
|
|
|
'store.sql.prefix' => 'test' |
24
|
|
|
]; |
25
|
|
|
|
26
|
|
|
$globalConfig = \SimpleSAML_Configuration::loadFromArray($globalConfig_input); |
27
|
|
|
\SimpleSAML_Configuration::setPreLoadedConfig($globalConfig, 'config.php'); |
|
|
|
|
28
|
|
|
|
29
|
|
|
$test = new Sql(); |
30
|
|
|
$this->assertEquals(true, $test->pdo instanceof \PDO); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function testSqlFailure() |
34
|
|
|
{ |
35
|
|
|
$globalConfig_input = [ |
36
|
|
|
'store.type' => 'sql', |
37
|
|
|
'store.sql.dsn' => '', |
38
|
|
|
'store.sql.username' => '', |
39
|
|
|
'store.sql.password' => '', |
40
|
|
|
'store.sql.options' => null, |
41
|
|
|
'store.sql.prefix' => 'test' |
42
|
|
|
]; |
43
|
|
|
|
44
|
|
|
$globalConfig = \SimpleSAML_Configuration::loadFromArray($globalConfig_input); |
45
|
|
|
\SimpleSAML_Configuration::setPreLoadedConfig($globalConfig, 'config.php'); |
46
|
|
|
|
47
|
|
|
$this->expectException(\Exception); |
|
|
|
|
48
|
|
|
new Sql(); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
} |
53
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths