Skip to content

Commit f1df32b

Browse files
committed
wip
1 parent d5ffe92 commit f1df32b

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

tests/Commands/ValidateCommandTest.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,66 @@ public function staleExportIgnoresAreConsideredAsInvalid(): void
15231523
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
15241524
}
15251525

1526+
#[Test]
1527+
#[Ticket('https://github.com/raphaelstolt/lean-package-validator/issues/54')]
1528+
public function createdHeaderIsReplacedByModifiedHeader(): void
1529+
{
1530+
$gitattributesContent = <<<CONTENT
1531+
# This file was generated by the lean package validator (http://git.io/lean-package-validator).
1532+
1533+
# These files are always considered text and should use LF.
1534+
# See core.whitespace @ http://git-scm.com/docs/git-config for whitespace flags.
1535+
1536+
*.php text eol=lf
1537+
1538+
# Ignore all non production artifacts with an "export-ignore".
1539+
.gitattributes export-ignore
1540+
.github/ export-ignore
1541+
.gitignore export-ignore
1542+
phpunit.xml.dist export-ignore
1543+
1544+
CONTENT;
1545+
1546+
$this->createTemporaryGitattributesFile($gitattributesContent);
1547+
1548+
$artifactFilenames = ['.gitignore', '.gitattributes', 'phpunit.xml.dist'];
1549+
1550+
$this->createTemporaryFiles(
1551+
$artifactFilenames,
1552+
['.github', 'tests']
1553+
);
1554+
1555+
$command = $this->application->find('validate');
1556+
$commandTester = new CommandTester($command);
1557+
$commandTester->execute([
1558+
'command' => $command->getName(),
1559+
'directory' => WORKING_DIRECTORY,
1560+
'--overwrite' => true
1561+
]);
1562+
1563+
1564+
$expectedGitattributesContent = <<<CONTENT
1565+
# This file was partly modified by the lean package validator (http://git.io/lean-package-validator).
1566+
1567+
# These files are always considered text and should use LF.
1568+
# See core.whitespace @ http://git-scm.com/docs/git-config for whitespace flags.
1569+
1570+
*.php text eol=lf
1571+
1572+
# Ignore all non production artifacts with an "export-ignore".
1573+
.gitattributes export-ignore
1574+
.github/ export-ignore
1575+
.gitignore export-ignore
1576+
phpunit.xml.dist export-ignore
1577+
tests/ export-ignore
1578+
1579+
CONTENT;
1580+
$this->assertStringEqualsFile(
1581+
WORKING_DIRECTORY . DIRECTORY_SEPARATOR . '.gitattributes',
1582+
$expectedGitattributesContent
1583+
);
1584+
}
1585+
15261586
#[Test]
15271587
#[Ticket('https://github.com/raphaelstolt/lean-package-validator/issues/8')]
15281588
#[DataProvider('optionProvider')]

0 commit comments

Comments
 (0)