Skip to content

Commit

Permalink
Fix some broken tests on Windows CI because of line endings
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Feb 22, 2020
1 parent 0448fd0 commit 7f90a61
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 57 deletions.
28 changes: 13 additions & 15 deletions test/classes/Config/FormDisplayTemplateTest.php
Expand Up @@ -560,21 +560,19 @@ public function testDisplayJavascript()

$result = $this->formDisplayTemplate->displayJavascript(['var i = 1', 'i++']);

$jsTemplate = <<<HTML
<script type="text/javascript">
if (typeof configInlineParams === 'undefined' || !Array.isArray(configInlineParams)) {
configInlineParams = [];
}
configInlineParams.push(function () {
var i = 1;
i++;
});
if (typeof configScriptLoaded !== 'undefined' && configInlineParams) {
loadInlineConfig();
}
</script>
HTML;
$jsTemplate =
'<script type="text/javascript">' . "\n"
. ' if (typeof configInlineParams === \'undefined\' || !Array.isArray(configInlineParams)) {' . "\n"
. ' configInlineParams = [];' . "\n"
. ' }' . "\n"
. ' configInlineParams.push(function () {' . "\n"
. ' var i = 1;' . "\n"
. 'i++;' . "\n"
. ' });' . "\n"
. ' if (typeof configScriptLoaded !== \'undefined\' && configInlineParams) {' . "\n"
. ' loadInlineConfig();' . "\n"
. ' }' . "\n"
. '</script>' . "\n";

$this->assertEquals($jsTemplate, $result);
}
Expand Down
42 changes: 18 additions & 24 deletions test/classes/FileListingTest.php
Expand Up @@ -41,42 +41,36 @@ public function testGetFileSelectOptions(): void

$this->assertFalse($this->fileListing->getFileSelectOptions('nonexistent directory'));

$expectedHtmlWithoutActive = <<<HTML
<option value="one.txt">
one.txt
</option>
<option value="two.md">
two.md
</option>
HTML;
$expectedHtmlWithoutActive =
' <option value="one.txt">' . "\n"
. ' one.txt' . "\n"
. ' </option>' . "\n"
. ' <option value="two.md">' . "\n"
. ' two.md' . "\n"
. ' </option>' . "\n";

$this->assertSame(
$expectedHtmlWithoutActive,
$this->fileListing->getFileSelectOptions($fixturesDir)
);

$expectedHtmlWithActive = <<<HTML
<option value="one.txt">
one.txt
</option>
<option value="two.md" selected="selected">
two.md
</option>
HTML;
$expectedHtmlWithActive =
' <option value="one.txt">' . "\n"
. ' one.txt' . "\n"
. ' </option>' . "\n"
. ' <option value="two.md" selected="selected">' . "\n"
. ' two.md' . "\n"
. ' </option>' . "\n";

$this->assertSame(
$expectedHtmlWithActive,
$this->fileListing->getFileSelectOptions($fixturesDir, '', 'two.md')
);

$expectedFilteredHtml = <<<HTML
<option value="one.txt">
one.txt
</option>
HTML;
$expectedFilteredHtml =
' <option value="one.txt">' . "\n"
. ' one.txt' . "\n"
. ' </option>' . "\n";

$this->assertSame(
$expectedFilteredHtml,
Expand Down
20 changes: 7 additions & 13 deletions test/classes/MessageTest.php
Expand Up @@ -548,12 +548,10 @@ public function testDisplay()
$this->assertFalse($this->object->isDisplayed());
$this->object->setMessage('Test Message');

$this->expectOutputString(<<<'HTML'
<div class="alert alert-primary" role="alert">
<img src="themes/dot.gif" title="" alt="" class="icon ic_s_notice"> Test Message
</div>
HTML
$this->expectOutputString(
'<div class="alert alert-primary" role="alert">' . "\n"
. ' <img src="themes/dot.gif" title="" alt="" class="icon ic_s_notice"> Test Message' . "\n"
. '</div>' . "\n"
);
$this->object->display();

Expand All @@ -569,13 +567,9 @@ public function testGetDisplay()
{
$this->object->setMessage('Test Message');
$this->assertEquals(
<<<'HTML'
<div class="alert alert-primary" role="alert">
<img src="themes/dot.gif" title="" alt="" class="icon ic_s_notice"> Test Message
</div>
HTML
,
'<div class="alert alert-primary" role="alert">' . "\n"
. ' <img src="themes/dot.gif" title="" alt="" class="icon ic_s_notice"> Test Message' . "\n"
. '</div>' . "\n",
$this->object->getDisplay()
);
}
Expand Down
Expand Up @@ -933,11 +933,10 @@ public function transformationDataProvider()
'200',
],
],
'<a href="http://image/PMA_IMAGE" rel="noopener noreferrer" target="_blank">
<img src="http://image/PMA_IMAGE" border="0" width="200" height="50">
PMA_IMAGE
</a>
',
'<a href="http://image/PMA_IMAGE" rel="noopener noreferrer" target="_blank">' . "\n"
. ' <img src="http://image/PMA_IMAGE" border="0" width="200" height="50">' . "\n"
. ' PMA_IMAGE' . "\n"
. '</a>' . "\n",
],
[
new Text_Plain_Imagelink(),
Expand Down

0 comments on commit 7f90a61

Please sign in to comment.