1414use function uniqid ;
1515use function var_export ;
1616
17- class BinTest extends TestCase
17+ class SplitterTest extends TestCase
1818{
1919
20- public function testNeon (): void
20+ public function testBinaryWithNeon (): void
2121 {
2222 $ fakeRoot = $ this ->prepareSampleFolder ();
2323 $ squashed = $ this ->getSampleErrors ();
@@ -32,7 +32,7 @@ public function testNeon(): void
3232 self ::assertFileEquals (__DIR__ . '/Rule/data/baselines-neon/missing-identifier.neon ' , $ fakeRoot . '/baselines/missing-identifier.neon ' );
3333 }
3434
35- public function testPhp (): void
35+ public function testBinaryWithPhp (): void
3636 {
3737 $ fakeRoot = $ this ->prepareSampleFolder ();
3838 $ squashed = $ this ->getSampleErrors ();
@@ -47,6 +47,25 @@ public function testPhp(): void
4747 self ::assertFileEquals (__DIR__ . '/Rule/data/baselines-php/missing-identifier.php ' , $ fakeRoot . '/baselines/missing-identifier.php ' );
4848 }
4949
50+ public function testSplitter (): void
51+ {
52+ $ folder = $ this ->prepareSampleFolder ();
53+ $ squashed = $ this ->getSampleErrors ();
54+
55+ $ loaderPath = $ folder . '/baselines/loader.neon ' ;
56+ file_put_contents ($ loaderPath , Neon::encode ($ squashed ));
57+
58+ $ splitter = new BaselineSplitter ("\t" );
59+ $ written = $ splitter ->split ($ loaderPath );
60+
61+ self ::assertSame ([
62+ $ folder . '/baselines/another.identifier.neon ' => 1 ,
63+ $ folder . '/baselines/missing-identifier.neon ' => 1 ,
64+ $ folder . '/baselines/sample.identifier.neon ' => 1 ,
65+ $ folder . '/baselines/loader.neon ' => null ,
66+ ], $ written );
67+ }
68+
5069 private function prepareSampleFolder (): string
5170 {
5271 $ folder = sys_get_temp_dir () . '/ ' . uniqid ('split ' );
0 commit comments