Remove files that are ignored before they are generated

This commit is contained in:
Oliver Davies 2024-10-31 12:00:00 +00:00
parent a56d9b2d5e
commit f0121f8bc6
2 changed files with 59 additions and 0 deletions

View file

@ -0,0 +1,25 @@
<?php
use App\Command\RemoveIgnoredFilesCommand;
use App\DataTransferObject\TemplateFile;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class RemoveIgnoredFilesCommandTest extends KernelTestCase
{
public function test_it_removes_any_ignored_files(): void
{
$filenamesToGenerate = [
new TemplateFile(data: '', name: 'phpcs.xml.dist'),
new TemplateFile(data: '', name: 'phpstan.neon.dist'),
];
$filenamesToIgnore = ['phpstan.neon.dist'];
$command = new RemoveIgnoredFilesCommand($filenamesToIgnore);
$command->execute([[], [], $filenamesToGenerate], function ($result) {
self::assertCount(1, $result[1]);
self::assertSame('phpcs.xml.dist', $result[1][0]->name);
});
}
}