public function PatternMatchingTest::testPatternMatching in Config Ignore 8.2
Test the ignored config matching against names.
@dataProvider patternProvider
Parameters
array $patterns: The config of ignored names.
array $test: An array with config names as keys and the expected outcome as value.
File
- tests/
src/ Unit/ PatternMatchingTest.php, line 28
Class
- PatternMatchingTest
- Test the pattern matching.
Namespace
Drupal\Tests\config_ignore\UnitCode
public function testPatternMatching(array $patterns, array $test) {
$filter = new IgnoreFilter([
'ignored' => $patterns,
], 'config_ignore', [], new MemoryStorage());
// In order to test much faster we access the protected method.
$method = new \ReflectionMethod(IgnoreFilter::class, 'matchConfigName');
$method
->setAccessible(TRUE);
foreach ($test as $name => $expected) {
static::assertEquals($expected, $method
->invoke($filter, $name), $name);
}
if (!in_array(TRUE, $test, TRUE) || !in_array(FALSE, $test, TRUE)) {
// Make sure there is always a positive and negative test.
$this
->markAsRisky();
}
}