public function FilteredStorageTest::testReadFilter in Config Filter 8
Same name and namespace in other branches
- 8.2 src/Tests/FilteredStorageTest.php \Drupal\config_filter\Tests\FilteredStorageTest::testReadFilter()
Test the read methods invokes the correct filter methods.
@dataProvider readFilterProvider
File
- src/
Tests/ FilteredStorageTest.php, line 137
Class
- FilteredStorageTest
- Tests StorageWrapper operations using the CachedStorage.
Namespace
Drupal\config_filter\TestsCode
public function testReadFilter($name, $storageMethod, $filterMethod, $data, $expected) {
$source = $this
->prophesize(StorageInterface::class);
$filterA = $this
->prophesizeFilter();
$filterB = $this
->prophesizeFilter();
$source
->{$storageMethod}($name)
->willReturn($data);
$interim = $this
->randomArray();
$filterA
->{$filterMethod}($name, $data)
->willReturn($interim);
$filterB
->{$filterMethod}($name, $interim)
->willReturn($expected);
$storage = new FilteredStorage($source
->reveal(), [
$filterA
->reveal(),
$filterB
->reveal(),
]);
$this
->assertEquals($expected, $storage
->{$storageMethod}($name));
}