public function ConfigFilterStorageFactoryTest::testListAll in Config Filter 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/ConfigFilterStorageFactoryTest.php \Drupal\Tests\config_filter\Kernel\ConfigFilterStorageFactoryTest::testListAll()
Test that the listAll method doesn't advertise config that doesn't exist.
File
- tests/
src/ Kernel/ ConfigFilterStorageFactoryTest.php, line 95
Class
- ConfigFilterStorageFactoryTest
- Storage factory test.
Namespace
Drupal\Tests\config_filter\KernelCode
public function testListAll() {
/** @var \Drupal\Core\Config\StorageInterface $filtered */
$filtered = $this->container
->get('config_filter.storage_factory')
->getSync();
// The pirate filter always adds the pirate config to listAll.
// But the filtered storage doesn't return the ones that don't exist.
$this
->assertNotContains('system.pirates', $filtered
->listAll());
$this
->assertFalse($filtered
->exists('system.pirates'));
// Turn on bluff mode, to make the filter properly add the config.
\Drupal::state()
->set('config_filter_test_bluff', TRUE);
$this
->assertContains('system.pirates', $filtered
->listAll());
$this
->assertTrue($filtered
->exists('system.pirates'));
}