Skip to content

Commit 597fd94

Browse files
remicollettrasher
authored andcommitted
fix 1057, ensure tests use correct configuration
1 parent e253a78 commit 597fd94

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ before_script:
88
- composer install --no-dev
99
- mysql -u root -e 'create database glpitest;'
1010
- php tools/cliinstall.php --lang=en_US --db=glpitest --user=root --tests
11-
- cp tests/config_db.php config/
12-
- php -S localhost:8088 > /dev/null 2>&1 &
11+
- php -S localhost:8088 tests/router.php &>/dev/null &
1312

1413
script:
1514
- mysql -u root -e 'select version();'

phpunit.xml.dist

+1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
<php>
1717
<const name="GLPI_CONFIG_DIR" value="./tests" />
1818
<const name="GLPI_LOG_DIR" value="./tests/files/_log" />
19+
<const name="GLPI_URI" value="http://localhost:8088" />
1920
</php>
2021
</phpunit>

tests/bootstrap.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ function loadDataset() {
137137
$CFG_GLPI['root_doc'] = '/glpi';
138138

139139
// need to set theses in DB, because tests for API use http call and this bootstrap file is not called
140-
Config::setConfigurationValues('core', ['url_base' => 'http://localhost:8088',
141-
'url_base_api' => 'http://localhost:8088/apirest.php']);
142-
$CFG_GLPI['url_base'] = 'http://localhost:8088';
143-
$CFG_GLPI['url_base_api'] = 'http://localhost:8088/apirest.php';
140+
Config::setConfigurationValues('core', ['url_base' => GLPI_URI,
141+
'url_base_api' => GLPI_URI . '/apirest.php']);
142+
$CFG_GLPI['url_base'] = GLPI_URI;
143+
$CFG_GLPI['url_base_api'] = GLPI_URI . '/apirest.php';
144144

145145
@mkdir(GLPI_LOG_DIR, 0755, true);
146146

tests/router.php

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
define('GLPI_CONFIG_DIR', __DIR__);
3+
4+
return false;

0 commit comments

Comments
 (0)