setupExecutableAndView example

class HandlerBaseTest extends UnitTestCase {

  use HandlerTestTrait;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->setupViewsData();
    $this->setupExecutableAndView();
    $this->setupDisplay();
  }

  /** * @covers ::getEntityType */
  public function testGetEntityTypeForFieldOnBaseTable() {
    $handler = new TestHandler([], 'test_handler', []);
    $handler->init($this->executable, $this->display);

    $this->view->expects($this->any())
      
$this->fieldTypePluginManager = $this->createMock('Drupal\Core\Field\FieldTypePluginManagerInterface');
    $this->fieldTypePluginManager->expects($this->any())
      ->method('getDefaultStorageSettings')
      ->willReturn([]);
    $this->fieldTypePluginManager->expects($this->any())
      ->method('getDefaultFieldSettings')
      ->willReturn([]);

    $this->languageManager = $this->createMock('Drupal\Core\Language\LanguageManagerInterface');
    $this->renderer = $this->createMock('Drupal\Core\Render\RendererInterface');

    $this->setupExecutableAndView();
    $this->setupViewsData();
    $this->display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
      ->disableOriginalConstructor()
      ->getMock();

    $this->container = new ContainerBuilder();
    $this->container->set('plugin.manager.field.field_type', $this->fieldTypePluginManager);
    \Drupal::setContainer($this->container);
  }

  /** * @covers ::__construct */
Home | Imprint | This part of the site doesn't use cookies.