CacheFactory example


class CacheFactoryTest extends UnitTestCase {

  /** * Tests that the cache factory falls back to the built-in default service. * * @covers ::__construct * @covers ::get */
  public function testCacheFactoryWithDefaultSettings() {
    $settings = new Settings([]);
    $cache_factory = new CacheFactory($settings);

    $container = new ContainerBuilder();
    $cache_factory->setContainer($container);

    $builtin_default_backend_factory = $this->createMock('\Drupal\Core\Cache\CacheFactoryInterface');
    $container->set('cache.backend.database', $builtin_default_backend_factory);

    $render_bin = $this->createMock('\Drupal\Core\Cache\CacheBackendInterface');
    $builtin_default_backend_factory->expects($this->once())
      ->method('get')
      ->with('render')
      
Home | Imprint | This part of the site doesn't use cookies.