
| Current Path : /var/www/html/strat/web/core/tests/Drupal/FunctionalTests/Routing/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/strat/web/core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php |
<?php
declare(strict_types=1);
namespace Drupal\FunctionalTests\Routing;
use Drupal\Tests\BrowserTestBase;
/**
* @group routing
*/
class DefaultFormatTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['system', 'default_format_test'];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
public function testFoo(): void {
$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(): void {
$this->drupalGet('/default_format_test/machine');
$this->assertSame('format:json', $this->getSession()->getPage()->getContent());
}
}