You are here

public function FileCacheFactoryTest::configurationDataProvider in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php \Drupal\Tests\Component\FileCache\FileCacheFactoryTest::configurationDataProvider()

Data provider for testGetConfigurationOverrides().

File

core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php, line 99

Class

FileCacheFactoryTest
@coversDefaultClass \Drupal\Component\FileCache\FileCacheFactory @group FileCache

Namespace

Drupal\Tests\Component\FileCache

Code

public function configurationDataProvider() {
  $data = [];

  // Get a unique FileCache class.
  $file_cache = $this
    ->getMockBuilder(FileCache::class)
    ->disableOriginalConstructor()
    ->getMock();
  $class = get_class($file_cache);

  // Test fallback configuration.
  $data['fallback-configuration'] = [
    [],
    [],
    FileCache::class,
  ];

  // Test default configuration.
  $data['default-configuration'] = [
    [
      'default' => [
        'class' => $class,
      ],
    ],
    [],
    $class,
  ];

  // Test specific per collection setting.
  $data['collection-setting'] = [
    [
      'test_foo_settings' => [
        'class' => $class,
      ],
    ],
    [],
    $class,
  ];

  // Test default configuration plus specific per collection setting.
  $data['default-plus-collection-setting'] = [
    [
      'default' => [
        'class' => '\\stdClass',
      ],
      'test_foo_settings' => [
        'class' => $class,
      ],
    ],
    [],
    $class,
  ];

  // Test default configuration plus class specific override.
  $data['default-plus-class-override'] = [
    [
      'default' => [
        'class' => '\\stdClass',
      ],
    ],
    [
      'class' => $class,
    ],
    $class,
  ];

  // Test default configuration plus class specific override plus specific
  // per collection setting.
  $data['default-plus-class-plus-collection-setting'] = [
    [
      'default' => [
        'class' => '\\stdClass',
      ],
      'test_foo_settings' => [
        'class' => $class,
      ],
    ],
    [
      'class' => '\\stdClass',
    ],
    $class,
  ];
  return $data;
}