Skip to content
Extraits de code Groupes Projets
Valider 76dc3a84 rédigé par Martin Keckeis's avatar Martin Keckeis
Parcourir les fichiers

fixing windows tests

parent 954a31ea
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -771,6 +771,10 @@ class Fixture extends \PHPUnit_Framework_Assert ...@@ -771,6 +771,10 @@ class Fixture extends \PHPUnit_Framework_Assert
echo "Geoip database $outfileName is not found. Downloading from $url...\n"; echo "Geoip database $outfileName is not found. Downloading from $url...\n";
$dump = fopen($url, 'rb'); $dump = fopen($url, 'rb');
if($dump === false){
throw new Exception('Could not download Geoip database from ' . $url);
}
$outfile = fopen($outfileName, 'wb'); $outfile = fopen($outfileName, 'wb');
if(!$outfile) { if(!$outfile) {
throw new Exception("Failed to create file $outfileName - please check permissions"); throw new Exception("Failed to create file $outfileName - please check permissions");
......
...@@ -348,11 +348,7 @@ class AssetManagerTest extends IntegrationTestCase ...@@ -348,11 +348,7 @@ class AssetManagerTest extends IntegrationTestCase
*/ */
private function adjustExpectedJsContent($expectedJsContent) private function adjustExpectedJsContent($expectedJsContent)
{ {
$expectedJsContent = str_replace("\n", "\r\n", $expectedJsContent); return $this->specifyCacheBusterInExpectedContent($expectedJsContent, $this->cacheBuster->piwikVersionBasedCacheBuster());
$expectedJsContent = $this->specifyCacheBusterInExpectedContent($expectedJsContent, $this->cacheBuster->piwikVersionBasedCacheBuster());
return $expectedJsContent;
} }
/** /**
...@@ -409,9 +405,9 @@ class AssetManagerTest extends IntegrationTestCase ...@@ -409,9 +405,9 @@ class AssetManagerTest extends IntegrationTestCase
private function getJsTranslationScript() private function getJsTranslationScript()
{ {
return return
'<script type="text/javascript">' . PHP_EOL . '<script type="text/javascript">' . "\n" .
'var translations = [];' . PHP_EOL . 'var translations = [];' . "\n" .
'if (typeof(piwik_translations) == \'undefined\') { var piwik_translations = new Object; }for(var i in translations) { piwik_translations[i] = translations[i];} ' . PHP_EOL . 'if (typeof(piwik_translations) == \'undefined\') { var piwik_translations = new Object; }for(var i in translations) { piwik_translations[i] = translations[i];} ' . "\n" .
'</script>'; '</script>';
} }
...@@ -471,7 +467,7 @@ class AssetManagerTest extends IntegrationTestCase ...@@ -471,7 +467,7 @@ class AssetManagerTest extends IntegrationTestCase
$this->triggerGetMergedNonCoreJavaScript(); $this->triggerGetMergedNonCoreJavaScript();
$expectedContent = $this->adjustExpectedJsContent('/* Piwik Javascript - cb={{{CACHE-BUSTER-JS}}}*/' . PHP_EOL); $expectedContent = $this->adjustExpectedJsContent('/* Piwik Javascript - cb={{{CACHE-BUSTER-JS}}}*/' . "\n");
$this->validateExpectedContent($expectedContent); $this->validateExpectedContent($expectedContent);
} }
...@@ -597,7 +593,7 @@ class AssetManagerTest extends IntegrationTestCase ...@@ -597,7 +593,7 @@ class AssetManagerTest extends IntegrationTestCase
*/ */
public function test_getCssInclusionDirective() public function test_getCssInclusionDirective()
{ {
$expectedCssInclusionDirective = '<link rel="stylesheet" type="text/css" href="index.php?module=Proxy&action=getCss" />' . PHP_EOL; $expectedCssInclusionDirective = '<link rel="stylesheet" type="text/css" href="index.php?module=Proxy&action=getCss" />' . "\n";
$this->assertEquals($expectedCssInclusionDirective, $this->assetManager->getCssInclusionDirective()); $this->assertEquals($expectedCssInclusionDirective, $this->assetManager->getCssInclusionDirective());
} }
...@@ -611,10 +607,10 @@ class AssetManagerTest extends IntegrationTestCase ...@@ -611,10 +607,10 @@ class AssetManagerTest extends IntegrationTestCase
$expectedJsInclusionDirective = $expectedJsInclusionDirective =
$this->getJsTranslationScript() . $this->getJsTranslationScript() .
'<script type="text/javascript" src="tests/PHPUnit/Unit/AssetManager/scripts/SimpleObject.js"></script>' . PHP_EOL . '<script type="text/javascript" src="tests/PHPUnit/Unit/AssetManager/scripts/SimpleObject.js"></script>' . "\n" .
'<script type="text/javascript" src="tests/PHPUnit/Unit/AssetManager/scripts/SimpleArray.js"></script>' . PHP_EOL . '<script type="text/javascript" src="tests/PHPUnit/Unit/AssetManager/scripts/SimpleArray.js"></script>' . "\n" .
'<script type="text/javascript" src="tests/PHPUnit/Unit/AssetManager/scripts/SimpleComments.js"></script>' . PHP_EOL . '<script type="text/javascript" src="tests/PHPUnit/Unit/AssetManager/scripts/SimpleComments.js"></script>' . "\n" .
'<script type="text/javascript" src="tests/PHPUnit/Unit/AssetManager/scripts/SimpleAlert.js"></script>' . PHP_EOL; '<script type="text/javascript" src="tests/PHPUnit/Unit/AssetManager/scripts/SimpleAlert.js"></script>' . "\n";
$this->assertEquals($expectedJsInclusionDirective, $this->assetManager->getJsInclusionDirective()); $this->assertEquals($expectedJsInclusionDirective, $this->assetManager->getJsInclusionDirective());
} }
...@@ -626,8 +622,8 @@ class AssetManagerTest extends IntegrationTestCase ...@@ -626,8 +622,8 @@ class AssetManagerTest extends IntegrationTestCase
{ {
$expectedJsInclusionDirective = $expectedJsInclusionDirective =
$this->getJsTranslationScript() . $this->getJsTranslationScript() .
'<script type="text/javascript" src="index.php?module=Proxy&action=getCoreJs"></script>' . PHP_EOL . '<script type="text/javascript" src="index.php?module=Proxy&action=getCoreJs"></script>' . "\n" .
'<script type="text/javascript" src="index.php?module=Proxy&action=getNonCoreJs"></script>' . PHP_EOL; '<script type="text/javascript" src="index.php?module=Proxy&action=getNonCoreJs"></script>' . "\n";
$this->assertEquals($expectedJsInclusionDirective, $this->assetManager->getJsInclusionDirective()); $this->assertEquals($expectedJsInclusionDirective, $this->assetManager->getJsInclusionDirective());
} }
......
...@@ -34,7 +34,10 @@ class OutputTest extends IntegrationTestCase ...@@ -34,7 +34,10 @@ class OutputTest extends IntegrationTestCase
public function tearDown() public function tearDown()
{ {
$this->output->destroy(); if(is_object($this->output)){
$this->output->destroy();
}
File::reset(); File::reset();
parent::tearDown(); parent::tearDown();
......
...@@ -33,7 +33,9 @@ class ProcessTest extends IntegrationTestCase ...@@ -33,7 +33,9 @@ class ProcessTest extends IntegrationTestCase
public function tearDown() public function tearDown()
{ {
$this->process->finishProcess(); if(is_object($this->process)){
$this->process->finishProcess();
}
File::reset(); File::reset();
} }
......
...@@ -64,7 +64,7 @@ class LogAggregatorTest extends IntegrationTestCase ...@@ -64,7 +64,7 @@ class LogAggregatorTest extends IntegrationTestCase
1=1 1=1
ORDER BY ORDER BY
5', 5',
'bind' => Array ( 'bind' => array (
0 => '2012-01-01 00:00:00', 0 => '2012-01-01 00:00:00',
1 => '2012-01-31 23:59:59', 1 => '2012-01-31 23:59:59',
2 => 1 2 => 1
...@@ -87,7 +87,7 @@ class LogAggregatorTest extends IntegrationTestCase ...@@ -87,7 +87,7 @@ class LogAggregatorTest extends IntegrationTestCase
1=1 1=1
ORDER BY ORDER BY
5', 5',
'bind' => Array ( 'bind' => array (
0 => '2012-01-01 00:00:00', 0 => '2012-01-01 00:00:00',
1 => '2012-01-31 23:59:59', 1 => '2012-01-31 23:59:59',
2 => 1 2 => 1
......
...@@ -15,4 +15,4 @@ if (typeof SimpleObject !== 'object') { ...@@ -15,4 +15,4 @@ if (typeof SimpleObject !== 'object') {
} }
} }
}()); }());
} }
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter