diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-02-04 03:35:13 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-02-04 03:35:13 +0400 |
commit | 74c865d9db2be1f80465e42750a2a1e8fcfbce91 (patch) | |
tree | 2d30dfe3d2dd83c308d306963d6b47f028f9ebcf | |
parent | 84a22be56b65aa7bed4ae3cce3c447b49238cbad (diff) |
Adding integration test for the Bulk Tracking API, it FAILS at present! refs #4603
Thanks for the report, we didn't catch this failure as it wasn't properly continuously tested!
-rw-r--r-- | tests/PHPUnit/Integration/Core/TrackerTest.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/Core/TrackerTest.php b/tests/PHPUnit/Integration/Core/TrackerTest.php new file mode 100644 index 0000000000..52dbfabe28 --- /dev/null +++ b/tests/PHPUnit/Integration/Core/TrackerTest.php @@ -0,0 +1,33 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +/** + * @group Core + */ +class Core_TrackerTest extends DatabaseTestCase +{ + /** + * Test the Bulk tracking API as documented in: http://developer.piwik.org/api-reference/tracking-api#bulk-tracking + * + * @throws Exception + */ + public function test_trackingApiWithBulkRequests_viaCurl() + { + $piwikHost = Test_Piwik_BaseFixture::getRootUrl() . 'piwik.php'; + $command = 'curl -X POST -d \'{"requests":["?idsite=1&url=http://example.org&action_name=Test bulk log Pageview&rec=1","?idsite=1&url=http://example.net/test.htm&action_name=Another bulk page view&rec=1"],"token_auth":"33dc3f2536d3025974cccb4b4d2d98f4"}\' ' . $piwikHost; + + exec($command, $output, $result); + $output = implode("", $output); + if ($result !== 0) { + throw new Exception("tracking bulk failed: " . implode("\n", $output) . "\n\ncommand used: $command"); + } + $this->assertNotContains('error', $output); + $this->assertStringStartsWith('{"status":', $output); + $this->assertContains('success', $output); + } +} |