Skip to content

Commit cd8044b

Browse files
committed
Ensure AddExtensionToTheIniFile tests are Windows friendly
1 parent 9f5b449 commit cd8044b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/unit/Installing/Ini/AddExtensionToTheIniFileTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Php\Pie\Platform\TargetPhp\PhpBinaryPath;
1414
use Php\Pie\Platform\TargetPlatform;
1515
use PHPUnit\Framework\Attributes\CoversClass;
16+
use PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily;
1617
use PHPUnit\Framework\MockObject\MockObject;
1718
use PHPUnit\Framework\TestCase;
1819
use Symfony\Component\Console\Output\BufferedOutput;
@@ -26,6 +27,8 @@
2627
use function touch;
2728
use function unlink;
2829

30+
use const PHP_EOL;
31+
2932
#[CoversClass(AddExtensionToTheIniFile::class)]
3033
final class AddExtensionToTheIniFileTest extends TestCase
3134
{
@@ -82,6 +85,7 @@ public function testReturnsFalseWhenFileIsNotWritable(): void
8285
}
8386
}
8487

88+
#[RequiresOperatingSystemFamily('Linux')]
8589
public function testReturnsFalseWhenExistingIniCouldNotBeRead(): void
8690
{
8791
if (TargetPlatform::isRunningAsRoot()) {
@@ -211,7 +215,10 @@ public function testReturnsTrueWhenExtensionAdded(): void
211215
));
212216

213217
$iniContent = file_get_contents($iniFile);
214-
self::assertSame("\n; PIE automatically added this to enable the foo/bar extension\nextension=foobar\n", $iniContent);
218+
self::assertSame(
219+
PHP_EOL . '; PIE automatically added this to enable the foo/bar extension' . PHP_EOL . 'extension=foobar' . PHP_EOL,
220+
$iniContent,
221+
);
215222

216223
self::assertStringContainsString(
217224
sprintf('Enabled extension foobar in the INI file %s', $iniFile),

0 commit comments

Comments
 (0)