Skip to content
Extraits de code Groupes Projets
Valider c4109d87 rédigé par mattpiwik's avatar mattpiwik
Parcourir les fichiers

Refs #1446 Fixing failing test due to Windows EOL and headers already sent...

Refs #1446 Fixing failing test due to Windows EOL and headers already sent error. Also not testing 'format=original'.

git-svn-id: http://dev.piwik.org/svn/trunk@2432 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent fccd0e0f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -97,8 +97,7 @@ abstract class Piwik_DataTable_Renderer
'csv',
'tsv',
'html',
'php',
'original'
'php'
);
static public function getRenderers()
......
<?xml version="1.0" encoding="utf-8" ?>
<result>1.61803398875</result>
\ No newline at end of file
......@@ -287,7 +287,10 @@ abstract class Test_Integration extends Test_Database
// $TEST_NAME - $API_METHOD
$filename = $testName . '__' . $apiId;
$response = $request->process();
// Cast as string is important. For example when calling
// with format=original, objects or php arrays can be returned.
// we also hide errors to prevent the 'headers already sent' in the ResponseBuilder (which sends Excel headers multiple times eg.)
$response = (string)@$request->process();
file_put_contents( $pathProcessed . $filename, $response );
$expected = file_get_contents( $pathExpected . $filename);
......@@ -295,10 +298,16 @@ abstract class Test_Integration extends Test_Database
{
$this->fail(" ERROR: Could not find set of 'expected' files. For new tests, to pass the test, you can copy files from /processed into $pathExpected after checking the output is valid.");
}
$this->assertEqual($response, $expected, "In $filename, %s");
// When tests run on Windows EOL delimiters are not the same as UNIX default EOL used in the renderers
$expected = str_replace("\r\n", "\n", $expected);
$this->assertEqual(trim($response), trim($expected), "In $filename, %s");
if($response != $expected){
echo $apiId;
var_dump($response);
echo 'ERROR FOR' . $apiId . ' -- FETCHED RESPONSE, EXPECTED RESPONSE';
echo "\n";
echo ($response);
echo "\n";
echo ($expected);
echo "\n";
}
}
$this->pass();
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter