From 0a81489d4051fa71df0f589c298ffb94383938b9 Mon Sep 17 00:00:00 2001 From: Matthieu Aubry Date: Thu, 26 Jan 2017 14:54:41 +1300 Subject: Enable Scheduled reports with images in CI Tests + Fix build (#11269) * Cross Domain: forward pk_vid parameter when the clicked element is not directly a link but is within the link element itself * Run scheduled reports with images on PHP 5.6 * Comment * Replace today's date by placeholder in scheduled reports tests * Travis runs GD 2.1.0 * Do not generate reports with images yet it is broken refs https://github.com/piwik/piwik/issues/11276 --- tests/PHPUnit/Framework/Fixture.php | 2 +- tests/PHPUnit/Framework/TestCase/SystemTestCase.php | 2 +- tests/PHPUnit/Framework/TestRequest/Response.php | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'tests/PHPUnit/Framework') diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php index 131af64a0f..98292b366a 100644 --- a/tests/PHPUnit/Framework/Fixture.php +++ b/tests/PHPUnit/Framework/Fixture.php @@ -77,7 +77,7 @@ use ReflectionClass; class Fixture extends \PHPUnit_Framework_Assert { const IMAGES_GENERATED_ONLY_FOR_OS = 'linux'; - const IMAGES_GENERATED_FOR_PHP = '5.5'; + const IMAGES_GENERATED_FOR_PHP = '5.6'; const IMAGES_GENERATED_FOR_GD = '2.1.1'; const DEFAULT_SITE_NAME = 'Piwik test'; diff --git a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php index 746f4dbf0c..3048352b43 100755 --- a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php +++ b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php @@ -121,7 +121,7 @@ abstract class SystemTestCase extends PHPUnit_Framework_TestCase { if (!Fixture::canImagesBeIncludedInScheduledReports()) { $this->markTestSkipped( - 'Scheduled reports generated during integration tests will not contain the image graphs. ' . + '(This should not occur on Travis CI server as we expect these tests to run there). Scheduled reports generated during integration tests will not contain the image graphs. ' . 'For tests to generate images, use a machine with the following specifications : ' . 'OS = '.Fixture::IMAGES_GENERATED_ONLY_FOR_OS.', PHP = '.Fixture::IMAGES_GENERATED_FOR_PHP . ' and GD = ' . Fixture::IMAGES_GENERATED_FOR_GD diff --git a/tests/PHPUnit/Framework/TestRequest/Response.php b/tests/PHPUnit/Framework/TestRequest/Response.php index cc5b682be2..5969725de7 100644 --- a/tests/PHPUnit/Framework/TestRequest/Response.php +++ b/tests/PHPUnit/Framework/TestRequest/Response.php @@ -112,6 +112,7 @@ class Response $apiResponse = $this->normalizePdfContent($apiResponse); $apiResponse = $this->removeXmlFields($apiResponse); + $apiResponse = $this->removeTodaysDate($apiResponse); $apiResponse = $this->normalizeDecimalFields($apiResponse); $apiResponse = $this->normalizeEncodingPhp533($apiResponse); $apiResponse = $this->normalizeSpaces($apiResponse); @@ -120,6 +121,11 @@ class Response return $apiResponse; } + private function removeTodaysDate($apiResponse) + { + return str_replace(date('Y-m-d'), 'today-date-removed-in-tests', $apiResponse); + } + private function normalizeEncodingPhp533($apiResponse) { return str_replace('&#039;', "'", $apiResponse); @@ -175,6 +181,7 @@ class Response $response = preg_replace('/\(D:[0-9]{14}/', '(D:19700101000000', $response); $response = preg_replace('/\/ID \[ <.*> ]/', '', $response); $response = preg_replace('/\/id:\[ <.*> ]/', '', $response); + $response = $this->removeXmlElement($response, "xmp:CreateDate"); $response = $this->removeXmlElement($response, "xmp:ModifyDate"); $response = $this->removeXmlElement($response, "xmp:MetadataDate"); -- cgit v1.2.3