Namespace
Drupal\Tests\theming_example\Functional
File
-
modules/theming_example/tests/src/Functional/ThemingExampleTest.php
View source
<?php
namespace Drupal\Tests\theming_example\Functional;
use Drupal\Tests\examples\Functional\ExamplesBrowserTestBase;
class ThemingExampleTest extends ExamplesBrowserTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'theming_example',
];
protected $profile = 'minimal';
public function testThemingPage() {
$this->drupalGet('/examples/theming_example');
$this->assertSession()
->responseContains('Some examples of pages and forms that are run through theme functions.</h1>');
$this->assertSession()
->responseContains('examples/theming_example/form_select">Simple form 1</a>');
$this->assertSession()
->responseContains('examples/theming_example/form_text">Simple form 2</a>');
$this->drupalGet('/examples/theming_example/list');
$this->assertSession()
->responseMatches('/<link rel="stylesheet".*theming_example.css/');
$li_list = $this->xpath('//ul[contains(@class,"render-version-list")]/li');
$this->assertTrue($li_list[0]->getText() == 'First item');
$li_list = $this->xpath('//ol[contains(@class,"theming-example-list")]/li');
$this->assertTrue($li_list[1]->getText() == 'Second item');
$this->drupalGet('/examples/theming_example/form_select');
$this->assertSession()
->responseContains('<h3 data-drupal-selector="edit-title">Choose which ordering you want</h3>');
$this->assertSession()
->responseContains('<strong>Choose which ordering you want</strong>');
$this->assertSession()
->responseMatches('/<div class="container-inline choice-wrapper"><div class="[a-zA-Z- ]* form-item-choice/');
$this->assertSession()
->responseNotMatches('/<link rel="stylesheet".*theming_example.css/');
$this->drupalGet('/examples/theming_example/form_text');
$this->assertSession()
->pageTextContains('Please input something!');
}
}
Classes