You are here

protected function ConfigListerTest::setUp in Configuration Update Manager 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/ConfigListerTest.php, line 47

Class

ConfigListerTest
Tests the \Drupal\config_update\ConfigListerWithProviders class.

Namespace

Drupal\Tests\config_update\Unit

Code

protected function setUp() {
  $lister = $this
    ->getMockBuilder('Drupal\\config_update\\ConfigListerWithProviders')
    ->setConstructorArgs([
    $this
      ->getEntityManagerMock(),
    $this
      ->getConfigStorageMock('active'),
    $this
      ->getConfigStorageMock('extension'),
    $this
      ->getConfigStorageMock('optional'),
    $this
      ->getModuleHandlerMock(),
    $this
      ->getThemeHandlerMock(),
  ])
    ->setMethods([
    'listProvidedItems',
    'getProfileName',
  ])
    ->getMock();
  $lister
    ->method('getProfileName')
    ->willReturn('standard');
  $map = [];
  foreach ($this->configProviderList as $provider => $info) {

    // Info has: [type, install storage items, optional storage items].
    // Map needs: [type, provider name, isOptional, [config items]].
    $map[] = [
      $info[0],
      $provider,
      FALSE,
      $info[1],
    ];
    $map[] = [
      $info[0],
      $provider,
      TRUE,
      $info[2],
    ];
  }
  $lister
    ->method('listProvidedItems')
    ->will($this
    ->returnValueMap($map));
  $this->configLister = $lister;
}