@@ -118,11 +118,14 @@ public function testImportWithSimpleGlob()
118118 $ this ->assertSame (__FILE__ , strtr ($ loader ->import ('FileLoaderTest.* ' ), '/ ' , \DIRECTORY_SEPARATOR ));
119119 }
120120
121- public function testImportWithExclude ()
121+ /**
122+ * @dataProvider importWithExcludeProvider
123+ */
124+ public function testImportWithExclude (string $ include , string $ exclude , int $ expectedCount )
122125 {
123126 $ loader = new TestFileLoader (new FileLocator (__DIR__ .'/../Fixtures ' ));
124- $ loadedFiles = $ loader ->import (' Include/* ' , null , false , null , __DIR__ . ' /../Fixtures/Include/{ExcludeFile.txt} ' );
125- $ this ->assertCount (2 , $ loadedFiles );
127+ $ loadedFiles = $ loader ->import ($ include , null , false , null , $ exclude );
128+ $ this ->assertCount ($ expectedCount , $ loadedFiles );
126129 $ this ->assertNotContains ('ExcludeFile.txt ' , $ loadedFiles );
127130 }
128131
@@ -137,6 +140,24 @@ public function testExcludeTrailingSlashConsistency(string $exclude)
137140 $ this ->assertNotContains ('baz.txt ' , $ loadedFiles );
138141 }
139142
143+ public static function importWithExcludeProvider (): iterable
144+ {
145+ yield ['Include/* ' , __DIR__ .'/../Fixtures/Include/{ExcludeFile.txt} ' , 2 ];
146+ yield ['Include/ ' , __DIR__ .'/../Fixtures/Include/{ExcludeFile.txt} ' , 4 ];
147+ yield ['Include ' , __DIR__ .'/../Fixtures/Include/{ExcludeFile.txt} ' , 4 ];
148+ yield ['Include/**/* ' , __DIR__ .'/../Fixtures/Include/{ExcludeFile.txt} ' , 4 ];
149+ yield ['Include/* ' , __DIR__ .'/../Fixtures/Include/{Exclude*.txt} ' , 2 ];
150+ yield ['Include/ ' , __DIR__ .'/../Fixtures/Include/{Exclude*.txt} ' , 4 ];
151+ yield ['Include ' , __DIR__ .'/../Fixtures/Include/{Exclude*.txt} ' , 4 ];
152+ yield ['Include/**/* ' , __DIR__ .'/../Fixtures/Include/{Exclude*.txt} ' , 4 ];
153+ yield ['Include/ ' , __DIR__ .'/../Fixtures/Include/**/{ExcludeFile.txt} ' , 3 ];
154+ yield ['Include ' , __DIR__ .'/../Fixtures/Include/**/{ExcludeFile.txt} ' , 3 ];
155+ yield ['Include/**/* ' , __DIR__ .'/../Fixtures/Include/**/{ExcludeFile.txt} ' , 3 ];
156+ yield ['Include/ ' , __DIR__ .'/../Fixtures/Include/**/{Exclude*.txt} ' , 3 ];
157+ yield ['Include ' , __DIR__ .'/../Fixtures/Include/**/{Exclude*.txt} ' , 3 ];
158+ yield ['Include/**/* ' , __DIR__ .'/../Fixtures/Include/**/{Exclude*.txt} ' , 3 ];
159+ }
160+
140161 public static function excludeTrailingSlashConsistencyProvider (): iterable
141162 {
142163 yield [__DIR__ .'/../Fixtures/Exclude/ExcludeToo/ ' ];
0 commit comments