You are here

protected function SplitFilterTest::getConfigManagerMock in Configuration Split 8

Gets a mocked version of the config manager.

Parameters

array $blacklist: The config names to blacklist.

array $graylist: The config names to graylist.

array $modules: The array of modules.

array $themes: The array of themes.

Return value

\Drupal\Core\Config\ConfigManagerInterface The mocked config manager.

2 calls to SplitFilterTest::getConfigManagerMock()
SplitFilterTest::getFilter in src/Tests/SplitFilterTest.php
Returns a SplitFilter that can be used to test its behaviour.
SplitFilterTest::testSplitFilterCreate in src/Tests/SplitFilterTest.php
Test that the static create method works and folders contain the htaccess.

File

src/Tests/SplitFilterTest.php, line 617

Class

SplitFilterTest
Test filter plugin.

Namespace

Drupal\config_split\Tests

Code

protected function getConfigManagerMock(array $blacklist = [], array $graylist = [], array $modules = [], array $themes = []) {

  // The manager returns nothing but allows the filter to set up correctly.
  // This means that the blacklist is not enhanced but only the one passed
  // as an argument is used.
  $manager = $this
    ->prophesize('Drupal\\Core\\Config\\ConfigManagerInterface');
  $manager
    ->findConfigEntityDependents(Argument::cetera())
    ->willReturn([]);

  // The config factory should return config names for at least all
  // blacklisted and gray listed configuration.
  $all_config = array_fill_keys(array_merge($blacklist, $graylist, array_keys($modules), array_keys($themes)), []);
  $manager
    ->getConfigFactory()
    ->willReturn($this
    ->getConfigStorageStub($all_config));
  return $manager
    ->reveal();
}