class DefaultFormatTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php \Drupal\FunctionalTests\Routing\DefaultFormatTest
- 10 core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php \Drupal\FunctionalTests\Routing\DefaultFormatTest
- 8.9.x core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php \Drupal\FunctionalTests\Routing\DefaultFormatTest
@group routing
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Routing\DefaultFormatTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of DefaultFormatTest
File
-
core/
tests/ Drupal/ FunctionalTests/ Routing/ DefaultFormatTest.php, line 10
Namespace
Drupal\FunctionalTests\RoutingView source
class DefaultFormatTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
'default_format_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
public function testFoo() {
$this->drupalGet('/default_format_test/human');
$this->assertSame('format:html', $this->getSession()
->getPage()
->getContent());
$this->assertSession()
->responseHeaderEquals('X-Drupal-Cache', 'MISS');
$this->drupalGet('/default_format_test/human');
$this->assertSame('format:html', $this->getSession()
->getPage()
->getContent());
$this->assertSession()
->responseHeaderEquals('X-Drupal-Cache', 'HIT');
$this->drupalGet('/default_format_test/machine');
$this->assertSame('format:json', $this->getSession()
->getPage()
->getContent());
$this->assertSession()
->responseHeaderEquals('X-Drupal-Cache', 'MISS');
$this->drupalGet('/default_format_test/machine');
$this->assertSame('format:json', $this->getSession()
->getPage()
->getContent());
$this->assertSession()
->responseHeaderEquals('X-Drupal-Cache', 'HIT');
}
public function testMultipleRoutesWithSameSingleFormat() {
$this->drupalGet('/default_format_test/machine');
$this->assertSame('format:json', $this->getSession()
->getPage()
->getContent());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.