From 14046a564d0b531ad45f0228f1b9db9113ddd133 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 26 Sep 2016 14:51:40 +0200 Subject: glpi: add patch to ensure test suite use local server --- glpi-9.1-pr1058.patch | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++ glpi-dev.spec | 11 ++++++--- 2 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 glpi-9.1-pr1058.patch diff --git a/glpi-9.1-pr1058.patch b/glpi-9.1-pr1058.patch new file mode 100644 index 0000000..e81cced --- /dev/null +++ b/glpi-9.1-pr1058.patch @@ -0,0 +1,67 @@ +From ef8e4cb98cbd0e2c59b0059141559178e840b882 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 26 Sep 2016 11:07:53 +0200 +Subject: [PATCH] fix 1057, ensure tests use correct configuration + +--- + .travis.yml | 3 +-- + phpunit.xml.dist | 1 + + tests/bootstrap.php | 8 ++++---- + tests/router.php | 4 ++++ + 4 files changed, 10 insertions(+), 6 deletions(-) + create mode 100644 tests/router.php + +diff --git a/.travis.yml b/.travis.yml +index a4401e8..ffdef3a 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -8,8 +8,7 @@ before_script: + - composer install --no-dev + - mysql -u root -e 'create database glpitest;' + - php tools/cliinstall.php --lang=en_US --db=glpitest --user=root --tests +- - cp tests/config_db.php config/ +- - php -S localhost:8088 > /dev/null 2>&1 & ++ - php -S localhost:8088 tests/router.php &>/dev/null & + + script: + - mysql -u root -e 'select version();' +diff --git a/phpunit.xml.dist b/phpunit.xml.dist +index a25f179..e7d33da 100644 +--- a/phpunit.xml.dist ++++ b/phpunit.xml.dist +@@ -16,5 +16,6 @@ + + + ++ + + +diff --git a/tests/bootstrap.php b/tests/bootstrap.php +index bfbe957..c4dbf3f 100644 +--- a/tests/bootstrap.php ++++ b/tests/bootstrap.php +@@ -137,10 +137,10 @@ function loadDataset() { + $CFG_GLPI['root_doc'] = '/glpi'; + + // need to set theses in DB, because tests for API use http call and this bootstrap file is not called +- Config::setConfigurationValues('core', ['url_base' => 'http://localhost:8088', +- 'url_base_api' => 'http://localhost:8088/apirest.php']); +- $CFG_GLPI['url_base'] = 'http://localhost:8088'; +- $CFG_GLPI['url_base_api'] = 'http://localhost:8088/apirest.php'; ++ Config::setConfigurationValues('core', ['url_base' => GLPI_URI, ++ 'url_base_api' => GLPI_URI . '/apirest.php']); ++ $CFG_GLPI['url_base'] = GLPI_URI; ++ $CFG_GLPI['url_base_api'] = GLPI_URI . '/apirest.php'; + + @mkdir(GLPI_LOG_DIR, 0755, true); + +diff --git a/tests/router.php b/tests/router.php +new file mode 100644 +index 0000000..8b39e8c +--- /dev/null ++++ b/tests/router.php +@@ -0,0 +1,4 @@ ++%{name}.lang RET=0 : Running a PHP server -sed -e 's/localhost/127.0.0.1/' -i tests/bootstrap.php -%{_bindir}/php -S 127.0.0.1:8088 &>/dev/null & +sed -e 's/localhost:8088/127.0.0.1:8089/' phpunit.xml.dist >phpunit.xml + +%{_bindir}/php -S 127.0.0.1:8089 tests/router.php &>/dev/null & + PHPPID=$! : Running a MariaDB server @@ -335,7 +339,6 @@ cp %{SOURCE12} config/config_path.php : Run upstream test suite php tools/cliinstall.php --host=127.0.0.1:3308 --db=glpitest --user=root --tests --force --lang=en_US || RET=1 -cp tests/config_db.php config/ %{_bindir}/phpunit --verbose || RET=1 @@ -435,6 +438,8 @@ fi https://github.com/glpi-project/glpi/milestone/2?closed=1 - add patch to ensure correct autolading open https://github.com/glpi-project/glpi/pull/1056 +- add patch to ensure test suite use local server + open https://github.com/glpi-project/glpi/pull/1058 * Fri Sep 23 2016 Johan Cwiklinski - 9.1-0.1.20160922gitf4143e3 - First pre-build for 9.1 series -- cgit