Parse filenames from a .bcignore file

This commit is contained in:
Oliver Davies 2024-10-31 12:00:00 +00:00
parent d63549023d
commit 636aed29bb
2 changed files with 36 additions and 0 deletions

15
src/IgnoreFile.php Normal file
View file

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace App;
final class IgnoreFile
{
public const FILENAME = '.bcignore';
public static function parse(): array
{
return explode("\n", file_get_contents(self::FILENAME));
}
}

View file

@ -0,0 +1,21 @@
<?php
use App\IgnoreFile;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class IgnoreFileTest extends KernelTestCase
{
public function tearDown(): void
{
@unlink(IgnoreFile::FILENAME);
parent::tearDown();
}
public function test_it_parses_a_list_of_file_names_from_an_ignore_file(): void
{
file_put_contents(IgnoreFile::FILENAME, join("\n", ['phpstan.neon.dist']));
self::assertSame(['phpstan.neon.dist'], IgnoreFile::parse());
}
}