enableViewsTestModule example


  protected $normalUser;

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['views_test_config']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();

    ViewTestData::createTestViews(static::class['views_test_data']);

    $this->webUser = $this->drupalCreateUser();

    $normal_role = $this->drupalCreateRole([]);
    $this->normalUser = $this->drupalCreateUser([
      'views_test_data test permission',
    ]);
    $this->normalUser->addRole($normal_role);
    // @todo when all the plugin information is cached make a reset function and

  protected $defaultTheme = 'stark';

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

    ViewTestData::createTestViews(self::class['views_test_config']);

    $this->enableViewsTestModule();

    $admin_user = $this->drupalCreateUser([
      'administer site configuration',
      'administer views',
      'administer nodes',
      'access content overview',
    ]);

    // Disable automatic live preview to make the sequence of calls clearer.     \Drupal::configFactory()->getEditable('views.settings')->set('ui.always_live_preview', FALSE)->save();
    $this->drupalLogin($admin_user);
  }
protected function setUp($import_test_views = TRUE, $modules = ['rest_test_views']): void {
    parent::setUp($import_test_views$modules);

    // Create some test content.     for ($i = 1; $i <= 10; $i++) {
      Node::create([
        'type' => 'article',
        'title' => 'Article test ' . $i,
      ])->save();
    }

    $this->enableViewsTestModule();

    $this->view = Views::getView('test_field_counter_display');
    $this->view->setDisplay('rest_export_1');
  }

  /** * Tests the display of an excluded title field when used as a token. */
  public function testExcludedTitleTokenDisplay() {
    $actual_json = $this->drupalGet($this->view->getPath()['query' => ['_format' => 'json']]);
    $this->assertSession()->statusCodeEquals(200);

    

  protected $normalRole;

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = []): void {
    parent::setUp($import_test_views$modules);
    $this->drupalPlaceBlock('system_breadcrumb_block');

    $this->enableViewsTestModule();

    $this->webUser = $this->drupalCreateUser();
    $roles = $this->webUser->getRoles();
    $this->webRole = $roles[0];

    $this->normalRole = $this->drupalCreateRole([]);
    $this->normalUser = $this->drupalCreateUser([
      'views_test_data test permission',
    ]);
    $this->normalUser->addRole($this->normalRole);
    $this->normalUser->save();
    

  protected static $modules = ['views', 'theme_test'];

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['views_test_config']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();
  }

  /** * Tests pre_render and post_render hooks in a theme and sub-theme. */
  public function testThemedViewPage() {

    \Drupal::service('theme_installer')->install(['test_basetheme', 'test_subtheme']);

    // Make base theme default then test for hook invocations.     $this->config('system.theme')
      
/** * {@inheritdoc} */
  protected $defaultTheme = 'starterkit_theme';

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['views_test_config']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();
  }

  /** * Tests the rendered output and form output of a view element. */
  public function testViewElement() {
    $view = Views::getView('test_view_embed');
    $view->setDisplay();
    // Test a form.     $this->drupalGet('views_test_data_element_form');
    // Verify that the view container has been found on the form.

  public static $testViews = ['test_view_block', 'test_view_block2'];

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['block_test_views']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();
  }

  /** * Tests default and content block categories. */
  public function testBlockCategory() {
    $this->drupalLogin($this->drupalCreateUser([
      'administer views',
      'administer blocks',
    ]));

    
/** * {@inheritdoc} */
  protected $defaultTheme = 'starterkit_theme';

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['views_test_config']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();

    $admin_user = $this->drupalCreateUser(['administer site configuration']);
    $this->drupalLogin($admin_user);
  }

  /** * Tests the rendered output. */
  public function testFeedOutput() {
    $this->drupalCreateContentType(['type' => 'page']);

    
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['views_test_config']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();
  }

  /** * {@inheritdoc} */
  protected function viewsData() {
    $data = parent::viewsData();
    $data['views_test_data']['field_form_button_test']['field'] = [
      'title' => 'Button test',
      'help' => 'Adds a test form button.',
      'id' => 'field_form_button_test',
    ];

  protected $nodes;

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = []): void {
    parent::setUp($import_test_views$modules);

    ViewTestData::createTestViews(static::class['block_test_views']);
    $this->enableViewsTestModule();

    $this->nodeType = $this->container->get('entity_type.manager')
      ->getStorage('node_type')
      ->create([
        'name' => 'Test node type',
        'type' => 'test',
      ]);
    $this->nodeType->save();

    $this->nodes[0] = $this->container->get('entity_type.manager')
      ->getStorage('node')
      
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['views_test_config']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();
  }

  /** * Tests the title area handler. */
  public function testTitleText() {
    // Confirm that the view has the normal title before making the view return     // no result.     $this->drupalGet('test-area-title');
    $this->assertSession()->titleEquals('test_title_header | Drupal');

    

  public static $testViews = ['test_user_changed'];

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['user_test_views']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();
  }

  /** * Tests changed field. */
  public function testChangedField() {
    $path = 'test_user_changed';

    $options = [];

    $this->drupalGet($path$options);

    
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['views_test_config']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();

    $this->drupalLogin($this->drupalCreateUser(['administer views']));

    // Create 10 nodes.     for ($i = 0; $i <= 10; $i++) {
      $this->drupalCreateNode(['promote' => TRUE]);
    }
  }

  /** * Tests the display test plugin. * * @see \Drupal\views_test_data\Plugin\views\display\DisplayTest */
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['views_test_config']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();
  }

  protected function viewsData() {
    $data = parent::viewsData();
    $data['views']['test_example'] = [
      'title' => 'Test Example area',
      'help' => 'A area handler which just exists for tests.',
      'area' => [
        'id' => 'test_example',
      ],
    ];

    
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['views_test_config']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();
    $this->drupalPlaceBlock('system_breadcrumb_block');

    // Add Dutch language programmatically.     ConfigurableLanguage::createFromLangcode('nl')->save();

    // Enable page caching.     $config = $this->config('system.performance');
    $config->set('cache.page.max_age', 3600);
    $config->save();
  }

  
Home | Imprint | This part of the site doesn't use cookies.