assertConfigSchemaByName example

$this->assertSession()->pageTextContains('No path is set');
    $this->assertSession()->pageTextContains('Administration theme: No');

    // Test with a path starting with "/admin".     $admin_path = 'admin/test_admin_path';
    $this->drupalGet('admin/structure/views/nojs/display/test_view/page_1/path');
    $this->submitForm(['path' => $admin_path], 'Apply');
    $this->assertSession()->pageTextContains('/' . $admin_path);
    $this->assertSession()->pageTextContains('Administration theme: Yes (admin path)');
    $this->submitForm([], 'Save');

    $this->assertConfigSchemaByName('views.view.test_view');
    $display_options = $this->config('views.view.test_view')->get('display.page_1.display_options');
    $this->assertArrayNotHasKey('use_admin_theme', $display_options);

    $this->drupalGet('admin/structure/views/nojs/display/test_view/page_1/use_admin_theme');
    $this->assertSession()->elementExists('css', 'input[name="use_admin_theme"][disabled="disabled"][checked="checked"]');

    // Test with a non-administration path.     $non_admin_path = 'kittens';
    $this->drupalGet('admin/structure/views/nojs/display/test_view/page_1/path');
    $this->submitForm(['path' => $non_admin_path], 'Apply');
    $this->assertSession()->pageTextContains('/' . $non_admin_path);
    
$edit['options[group_info][group_items][3][value][max]'] = 28;

    $this->submitForm($edit, 'Apply');

    $this->drupalGet('admin/structure/views/nojs/handler/test_view/default/filter/age');
    foreach ($edit as $name => $value) {
      $this->assertSession()->fieldValueEquals($name$value);
    }

    $this->drupalGet('admin/structure/views/view/test_view');
    $this->submitForm([], 'Save');
    $this->assertConfigSchemaByName('views.view.test_view');

    // Test that the exposed filter works as expected.     $this->drupalGet('test_view-path');
    $this->assertSession()->pageTextContains('John');
    $this->assertSession()->pageTextContains('Paul');
    $this->assertSession()->pageTextContains('Ringo');
    $this->assertSession()->pageTextContains('George');
    $this->assertSession()->pageTextContains('Meredith');
    $this->submitForm(['age' => '2'], 'Apply');
    $this->assertSession()->pageTextContains('John');
    $this->assertSession()->pageTextContains('Paul');
    

  public function testDateTimeSchema() {
    // Test argument schema.     $view = Views::getView('test_argument_datetime');
    $view->initHandlers();
    $view->setDisplay('default');
    $arguments = $view->displayHandlers->get('default')->getOption('arguments');
    $arguments['field_date_value_year']['date'] = 'Date';
    $view->displayHandlers->get('default')->overrideOption('arguments', $arguments);
    $view->save();
    $this->assertConfigSchemaByName('views.view.test_argument_datetime');

    // Test filter schema.     $view = Views::getView('test_filter_datetime');
    $view->initHandlers();
    $filters = $view->displayHandlers->get('default')->getOption('filters');
    $filters['field_date_value']['type'] = 'date';
    $view->displayHandlers->get('default')->overrideOption('filters', $filters);
    $view->save();
    $this->assertConfigSchemaByName('views.view.test_filter_datetime');

    // Test sort schema.
$page->fillField('options[type]', 'text_default');
    $web_assert->assertWaitOnAjaxRequest();
    $apply_button = $page->find('css', '.views-ui-dialog button.button--primary');
    $apply_button->press();
    $web_assert->assertWaitOnAjaxRequest();

    // Save the page.     $save_button = $page->find('css', '#edit-actions-submit');
    $save_button->press();

    $this->assertConfigSchemaByName('views.view.test_field_body');
  }

}
$this->drupalGet('admin/structure/views/nojs/handler/test_filter_date_between/default/filter/created');
    foreach ($edit as $name => $value) {
      $this->assertSession()->fieldValueEquals($name$value);
      if (strpos($name, '[value][type]')) {
        $radio = $this->cssSelect('input[name="' . $name . '"][checked="checked"][type="radio"]');
        $this->assertEquals($value$radio[0]->getAttribute('value'));
      }
    }

    $this->drupalGet('admin/structure/views/view/test_filter_date_between');
    $this->submitForm([], 'Save');
    $this->assertConfigSchemaByName('views.view.test_filter_date_between');

    // Test that the exposed filter works as expected.     $path = 'test_filter_date_between-path';
    $this->drupalGet('admin/structure/views/view/test_filter_date_between/edit');
    $this->submitForm([], 'Add Page');
    $this->drupalGet('admin/structure/views/nojs/display/test_filter_date_between/page_1/path');
    $this->submitForm(['path' => $path], 'Apply');
    $this->submitForm([], 'Save');

    $this->drupalGet($path);
    $this->submitForm([], 'Apply');
    
Home | Imprint | This part of the site doesn't use cookies.