Commit 408aa0e4 authored by Ivo Fokkema's avatar Ivo Fokkema

Suppressing LOVD error messages during tests.

- getLOVDGlobals() was triggering an exit() from inc-init.php when called when not installed yet.
- Let setMutalyzerServiceURL() not die when we're not installed.
- ini_set() calls from inc-init.php were triggering warnings during CLI calls because output was already created.
- Also, Selenium shouldn't be started as root - newer Firefoxes don't like it.
parent 042ae69f
......@@ -660,7 +660,7 @@ if ($_INI['database']['driver'] == 'mysql') {
ini_set('default_charset','UTF-8');
@ini_set('default_charset','UTF-8');
if (function_exists('mb_internal_encoding')) {
mb_internal_encoding('UTF-8');
}
......@@ -729,8 +729,9 @@ if (defined('MISSING_CONF') || defined('MISSING_STAT') || !preg_match('/^([1-9]\
define('NOT_INSTALLED', true);
}
// phpunit check is necessary because our Travis tests load inc-init.php when we're not installed yet to get LOVD globals.
// inc-js-submit-settings.php check is necessary because it gets included in the install directory.
if (dirname(lovd_getProjectFile()) != '/install' && lovd_getProjectFile() != '/inc-js-submit-settings.php') {
if (dirname(lovd_getProjectFile()) != '/install' && !in_array(lovd_getProjectFile(), array('phpunit', '/inc-js-submit-settings.php'))) {
// We're not installing, so throwing an error.
if (defined('NOT_INSTALLED')) {
......@@ -773,11 +774,11 @@ if (!empty($_CONF['use_ssl']) && !SSL && !(lovd_getProjectFile() == '/api.php' &
}
// Session settings - use cookies.
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);
@ini_set('session.use_cookies', 1);
@ini_set('session.use_only_cookies', 1);
if (ini_get('session.cookie_path') == '/') {
// Don't share cookies with other systems - set the cookie path!
ini_set('session.cookie_path', lovd_getInstallURL(false));
@ini_set('session.cookie_path', lovd_getInstallURL(false));
}
if (!empty($_STAT['signature'])) {
// Set the session name to something unique, to prevent mixing cookies with other LOVDs on the same server.
......@@ -785,7 +786,7 @@ if (!empty($_STAT['signature'])) {
} else {
$_SETT['cookie_id'] = md5($_INI['database']['database'] . $_INI['database']['table_prefix']);
}
session_name('PHPSESSID_' . $_SETT['cookie_id']);
@session_name('PHPSESSID_' . $_SETT['cookie_id']);
// Start sessions - use cookies.
@session_start(); // On some Ubuntu distributions this can cause a distribution-specific error message when session cleanup is triggered.
......
......@@ -74,7 +74,8 @@ function getWebDriverInstance ()
WEBDRIVER_MAX_WAIT_DEFAULT * 1000);
// Set time for trying to access DOM elements
$webDriver->manage()->timeouts()->implicitlyWait(WEBDRIVER_IMPLICIT_WAIT);
// This keeps failing. No clue why. Both Chrome and FF don't like it, although Chrome seems to handle it on the Travis environment.
// $webDriver->manage()->timeouts()->implicitlyWait(WEBDRIVER_IMPLICIT_WAIT);
if (isset($_INI['test']['xdebug_enabled']) && $_INI['test']['xdebug_enabled'] == 'true') {
// Load page of target host. This is necessary to set a cookie.
......@@ -129,6 +130,12 @@ function setMutalyzerServiceURL ($sURL)
// the Mutalyzer team. This way, one test run of LOVD also tests their
// update.
list($db,) = getLOVDGlobals();
if (defined('NOT_INSTALLED')) {
// Just return true here. Don't fail on not being able to set this URL.
return true;
}
$result = $db->query('UPDATE ' . TABLE_CONFIG . ' SET mutalyzer_soap_url=?', array($sURL));
// Return true if query was executed successfully
......
......@@ -47,7 +47,7 @@ if [ ! -f "geckodriver" ]; then
fi
echo "Starting Selenium"
sudo java -Djava.net.preferIPv4Stack=true \
java -Djava.net.preferIPv4Stack=true \
-Dwebdriver.chrome.driver=chromedriver \
-Dwebdriver.gecko.driver=geckodriver \
-jar ${serverFile} -port 4444 &
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment