Skip to content

Commit

Permalink
Reverted to heredoc and removed carriage returns from expected samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxwilko committed Jan 20, 2022
1 parent 1db7bfc commit 36a4044
Showing 1 changed file with 40 additions and 24 deletions.
64 changes: 40 additions & 24 deletions tests/Config/ConfigFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ public function testWriteDotNotationMultiple()

$contents = file_get_contents($file);

$expected = "<?php
$expected = <<<PHP
<?php
return [
'w' => [
Expand All @@ -321,9 +322,10 @@ public function testWriteDotNotationMultiple()
],
],
];
";
$this->assertEquals($expected, $contents);
PHP;

$this->assertEquals(str_replace("\r", '', $expected), $contents);

unlink($file);
}
Expand All @@ -342,7 +344,8 @@ public function testWriteDotDuplicateIntKeys()

$contents = file_get_contents($file);

$expected = "<?php
$expected = <<<PHP
<?php
return [
'w' => [
Expand All @@ -360,9 +363,10 @@ public function testWriteDotDuplicateIntKeys()
],
],
];
";
$this->assertEquals($expected, $contents);
PHP;

$this->assertEquals(str_replace("\r", '', $expected), $contents);

unlink($file);
}
Expand Down Expand Up @@ -393,15 +397,17 @@ public function testWriteFunctionCall()
'key2' => new \Winter\Storm\Config\ConfigFunction('nl2br', ['KEY_B', false])
]);

$expected = "<?php
$expected = <<<PHP
<?php
return [
'key' => env('KEY_A', true),
'key2' => nl2br('KEY_B', false),
];
";
$this->assertEquals($expected, $config->render());
PHP;

$this->assertEquals(str_replace("\r", '', $expected), $config->render());
}

public function testWriteFunctionCallOverwrite()
Expand All @@ -417,14 +423,16 @@ public function testWriteFunctionCallOverwrite()
'key' => new \Winter\Storm\Config\ConfigFunction('nl2br', ['KEY_B', false])
]);

$expected = "<?php
$expected = <<<PHP
<?php
return [
'key' => nl2br('KEY_B', false),
];
";
$this->assertEquals($expected, $config->render());
PHP;

$this->assertEquals(str_replace("\r", '', $expected), $config->render());
}

public function testInsertNull()
Expand All @@ -437,15 +445,17 @@ public function testInsertNull()
'key2' => null
]);

$expected = "<?php
$expected = <<<PHP
<?php
return [
'key' => env('KEY_A', null),
'key2' => null,
];
";
$this->assertEquals($expected, $config->render());
PHP;

$this->assertEquals(str_replace("\r", '', $expected), $config->render());
}

public function testSortAsc()
Expand All @@ -464,7 +474,8 @@ public function testSortAsc()

$config->sort();

$expected = "<?php
$expected = <<<PHP
<?php
return [
'a' => [
Expand All @@ -480,9 +491,10 @@ public function testSortAsc()
'b' => 'b',
],
];
";
$this->assertEquals($expected, $config->render());
PHP;

$this->assertEquals(str_replace("\r", '', $expected), $config->render());
}


Expand All @@ -502,7 +514,8 @@ public function testSortDesc()

$config->sort(ConfigFile::SORT_DESC);

$expected = "<?php
$expected = <<<PHP
<?php
return [
'b' => [
Expand All @@ -518,9 +531,10 @@ public function testSortDesc()
],
],
];
";
$this->assertEquals($expected, $config->render());
PHP;

$this->assertEquals(str_replace("\r", '', $expected), $config->render());
}

public function testSortUsort()
Expand All @@ -541,13 +555,15 @@ public function testSortUsort()
return $i--;
});

$expected = "<?php
$expected = <<<PHP
<?php
return [
'b' => 'b',
'a' => 'a',
];
";
$this->assertEquals($expected, $config->render());
PHP;
$this->assertEquals(str_replace("\r", '', $expected), $config->render());
}
}

0 comments on commit 36a4044

Please sign in to comment.