diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-05-08 00:33:13 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-05-08 00:33:13 +0300 |
commit | 57ea8de183868cbb5c3b199d8e3d1ce2ac285306 (patch) | |
tree | 492d13e88e808591d5957915ee5a729ddde469ef /tests/PHPUnit/System/TrackerResponseTest.php | |
parent | c6ed2a5a74fd1fa8aeec23b6f4c81666a8647c8b (diff) |
if a GET piwik.php is done without any parameter, still return a HTTP 200
Diffstat (limited to 'tests/PHPUnit/System/TrackerResponseTest.php')
-rwxr-xr-x | tests/PHPUnit/System/TrackerResponseTest.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/PHPUnit/System/TrackerResponseTest.php b/tests/PHPUnit/System/TrackerResponseTest.php index 16ab4a4e01..337aceb30c 100755 --- a/tests/PHPUnit/System/TrackerResponseTest.php +++ b/tests/PHPUnit/System/TrackerResponseTest.php @@ -94,10 +94,21 @@ class TrackerResponseTest extends SystemTestCase $this->assertResponseCode(400, $url . '1'); // has to be 16 char, but is 17 now } - public function test_response_ShouldReturnPiwikMessage_InCaseOfEmptyRequest() + // See https://github.com/piwik/piwik/issues/7850 piwik.php is used by plugins and monitoring systems to test for Piwik installation. + // it is important to return a 200 if someone does a GET request with no parameters + public function test_response_ShouldReturnPiwikMessageWithHttp200_InCaseOfEmptyGETRequest() { $url = Fixture::getTrackerUrl(); - $this->assertResponseCode(400, $url); + $this->assertResponseCode(200, $url); + + $expected = "<a href='/'>Piwik</a> is a free/libre web <a href='http://piwik.org'>analytics</a> that lets you keep control of your data."; + $this->assertHttpResponseText($expected, $url); + } + + public function test_response_ShouldReturnPiwikMessageWithHttp400_InCaseOfInvalidRequestOrIfNothingIsTracked() + { + $url = Fixture::getTrackerUrl(); + $this->assertResponseCode(400, $url . '?rec=1'); $expected = "<a href='/'>Piwik</a> is a free/libre web <a href='http://piwik.org'>analytics</a> that lets you keep control of your data."; $this->assertHttpResponseText($expected, $url); |