mirror of
https://github.com/opdavies/build-configs.git
synced 2025-09-05 10:55:33 +01:00
Parse filenames from a .bcignore file
This commit is contained in:
parent
d63549023d
commit
636aed29bb
2 changed files with 36 additions and 0 deletions
15
src/IgnoreFile.php
Normal file
15
src/IgnoreFile.php
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
21
tests/Kernel/IgnoreFileTest.php
Normal file
21
tests/Kernel/IgnoreFileTest.php
Normal 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());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue