diff options
author | Matthieu Aubry <mattab@users.noreply.github.com> | 2016-07-21 05:09:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-21 05:09:46 +0300 |
commit | afd490ae730db7f75240289c203dde1abd2035dc (patch) | |
tree | 7751f29de812a6ccd0440ab7632866e7adbdbff5 /tests/PHPUnit/System/EnvironmentValidationTest.php | |
parent | 870465c6041cfdc344e89fb7878357638bfad1c6 (diff) |
When Piwik config file becomes un-readable, make it clear that the file still exists but is not readable (#10331)
* * In messages, make it more clear whether config file exists and/or is (not) readable
* When the config file exists but is not readable, provide users the choice between making the file readable, or starting a fresh install
* As long as Piwik is not installed, piwik.php should not return 500 when config file is not readable
* Fixes #10283
* UI tests: updated message when config file is not found
Diffstat (limited to 'tests/PHPUnit/System/EnvironmentValidationTest.php')
-rw-r--r-- | tests/PHPUnit/System/EnvironmentValidationTest.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/PHPUnit/System/EnvironmentValidationTest.php b/tests/PHPUnit/System/EnvironmentValidationTest.php index c283cbbd8f..f96032f36d 100644 --- a/tests/PHPUnit/System/EnvironmentValidationTest.php +++ b/tests/PHPUnit/System/EnvironmentValidationTest.php @@ -46,25 +46,24 @@ class EnvironmentValidationTest extends SystemTestCase $this->simulateAbsentConfigFile('global.ini.php'); $output = $this->triggerPiwikFrom($entryPoint); + $this->assertOutputContainsConfigFileMissingError('global.ini.php', $output); + } - public function getEntryPointsThatErrorWithNoLocal() + public function test_NoLocalConfigFile_TriggersError_inTracker() { - return array( - array('tracker'), - array('console') - ); + $this->simulateAbsentConfigFile('config.ini.php'); + + $output = $this->triggerPiwikFrom('tracker'); + $this->assertContains('As Piwik is not installed yet, the Tracking API will now exit without error', $output); } - /** - * @dataProvider getEntryPointsThatErrorWithNoLocal - */ - public function test_NoLocalConfigFile_TriggersError($entryPoint) + public function test_NoLocalConfigFile_TriggersError_inConsole() { $this->simulateAbsentConfigFile('config.ini.php'); - $output = $this->triggerPiwikFrom($entryPoint); + $output = $this->triggerPiwikFrom('console'); $this->assertOutputContainsConfigFileMissingError('config.ini.php', $output); } @@ -104,6 +103,7 @@ class EnvironmentValidationTest extends SystemTestCase $this->simulateBadConfigFile($configFile); $output = $this->triggerPiwikFrom($entryPoint); + $this->assertOutputContainsBadConfigFileError($output); } @@ -123,7 +123,7 @@ class EnvironmentValidationTest extends SystemTestCase private function assertOutputContainsConfigFileMissingError($fileName, $output) { - $this->assertRegExp("/The configuration file \\{.*\\/" . preg_quote($fileName) . "\\} has not been found or could not be read\\./", $output); + $this->assertRegExp("/.*The configuration file \\{.*\\/" . preg_quote($fileName) . "\\} has not been found or could not be read\\..*/", $output, "Output did not contain the expected exception for $fileName --- Output was --- $output"); } private function assertOutputContainsBadConfigFileError($output) |