ViewsHandlerManager example

/** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->viewsData = $this->getMockBuilder('Drupal\views\ViewsData')
      ->disableOriginalConstructor()
      ->getMock();
    $cache_backend = $this->createMock('Drupal\Core\Cache\CacheBackendInterface');
    $this->moduleHandler = $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface');
    $this->handlerManager = new ViewsHandlerManager('test', new \ArrayObject([])$this->viewsData, $cache_backend$this->moduleHandler);
  }

  /** * Setups of the plugin factory. */
  protected function setupMockedFactory() {
    $this->factory = $this->createMock('Drupal\Component\Plugin\Factory\FactoryInterface');

    $reflection = new \ReflectionClass($this->handlerManager);
    $property = $reflection->getProperty('factory');
    $property->setValue($this->handlerManager, $this->factory);
  }
Home | Imprint | This part of the site doesn't use cookies.