Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordiosmosis <benakamoorthi@fastmail.fm>2013-10-17 00:15:23 +0400
committerdiosmosis <benakamoorthi@fastmail.fm>2013-10-17 00:15:39 +0400
commitaa7d9a9474b6ca280d0e4825f6ab8bbb660c3ad3 (patch)
tree2536e63538ead5b08c315cde555baf859646b298 /tests
parent1ae582b686d09f57c4c107aae71487717f696512 (diff)
Output entries in diffviewer.html even if diff files could not be generated.
Diffstat (limited to 'tests')
m---------tests/PHPUnit/UI0
-rw-r--r--tests/PHPUnit/UITest.php33
2 files changed, 24 insertions, 9 deletions
diff --git a/tests/PHPUnit/UI b/tests/PHPUnit/UI
-Subproject d70398e9a9b38d32e2153d2ab08625af8adb3f7
+Subproject f54bb82611655eb8dd9deff89c32b37f5846793
diff --git a/tests/PHPUnit/UITest.php b/tests/PHPUnit/UITest.php
index e073711a55..5c73427d4b 100644
--- a/tests/PHPUnit/UITest.php
+++ b/tests/PHPUnit/UITest.php
@@ -22,6 +22,8 @@ abstract class UITest extends IntegrationTestCase
private static $recursiveProxyLinkNames = array('libs', 'plugins', 'tests');
private static $imageMagickAvailable = false;
+ public static $failureScreenshotNames = array();
+
public static function createAccessInstance()
{
Access::setSingletonInstance($access = new Test_Access_OverrideLogin());
@@ -185,6 +187,8 @@ Generated screenshot: $processedPath");
$expected = file_get_contents($expectedPath);
if ($expected != $processed) {
+ self::$failureScreenshotNames[] = $name;
+
$diffPath = self::getScreenshotDiffPath($name);
echo "\nFail: generated screenshot does not match expected for '$name'.
@@ -295,20 +299,24 @@ Screenshot diff: $diffPath\n";
private static function outputDiffViewerHtmlFile()
{
+ list($processedDir, $expectedDir) = self::getProcessedAndExpectedDirs();
$diffDir = self::getScreenshotDiffDir();
- $diffFiles = array();
- foreach (scandir($diffDir) as $file) {
- if (strpos($file, ".png") != strlen($file) - 4) continue;
+ $diffViewerEntries = array();
+ foreach (self::$failureScreenshotNames as $name) {
+ $name = static::getOutputPrefix() . '_' . $name;
+ $file = $name . '.png';
- $parts = explode('.', $file, 2);
- $name = reset($parts);
+ $diffFileOrError = $diffDir . '/' . $file;
+ if (!is_file($diffFileOrError)) {
+ $diffFileOrError = false;
+ }
- $diffFiles[] = array(
+ $diffViewerEntries[] = array(
'name' => $name,
'expectedUrl' => 'https://raw.github.com/piwik/piwik-ui-tests/master/expected-ui-screenshots/' . $file,
'processedUrl' => '../processed-ui-screenshots/' . $file,
- 'diffUrl' => $file
+ 'diffUrl' => $diffFileOrError
);
}
@@ -323,13 +331,20 @@ Screenshot diff: $diffPath\n";
<th>Processed</th>
<th>Difference</th>
</tr>';
- foreach ($diffFiles as $fileInfo) {
+ foreach ($diffViewerEntries as $fileInfo) {
$diffViewerHtml .= '
<tr>
<td>' . $fileInfo['name'] . '</td>
<td><a href="' . $fileInfo['expectedUrl'] . '">Expected</a></td>
<td><a href="' . $fileInfo['processedUrl'] . '">Processed</a></td>
- <td><a href="' . $fileInfo['diffUrl'] . '">Difference</a></td>
+ <td>';
+ if (!empty($fileInfo['diffUrl'])) {
+ $diffViewerHtml .= '<a href="' . $fileInfo['diffUrl'] . '">Difference</a>';
+ } else {
+ $diffViewerHtml .= "<em>Could not create diff.</em>";
+ }
+ $diffViewerHtml .= '
+ </td>
</tr>';
}
$diffViewerHtml .= '