Chris@16
|
1 <?php
|
Chris@16
|
2
|
Chris@16
|
3 namespace Drupal\FunctionalTests\Routing;
|
Chris@16
|
4
|
Chris@16
|
5 use Drupal\Tests\BrowserTestBase;
|
Chris@16
|
6
|
Chris@16
|
7 /**
|
Chris@16
|
8 * @group routing
|
Chris@16
|
9 */
|
Chris@16
|
10 class DefaultFormatTest extends BrowserTestBase {
|
Chris@16
|
11
|
Chris@16
|
12 /**
|
Chris@16
|
13 * {@inheritdoc}
|
Chris@16
|
14 */
|
Chris@16
|
15 public static $modules = ['system', 'default_format_test'];
|
Chris@16
|
16
|
Chris@16
|
17 public function testFoo() {
|
Chris@16
|
18 $this->drupalGet('/default_format_test/human');
|
Chris@16
|
19 $this->assertSame('format:html', $this->getSession()->getPage()->getContent());
|
Chris@16
|
20 $this->assertSame('MISS', $this->drupalGetHeader('X-Drupal-Cache'));
|
Chris@18
|
21 $this->drupalGet('/default_format_test/human');
|
Chris@18
|
22 $this->assertSame('format:html', $this->getSession()->getPage()->getContent());
|
Chris@18
|
23 $this->assertSame('HIT', $this->drupalGetHeader('X-Drupal-Cache'));
|
Chris@16
|
24
|
Chris@16
|
25 $this->drupalGet('/default_format_test/machine');
|
Chris@16
|
26 $this->assertSame('format:json', $this->getSession()->getPage()->getContent());
|
Chris@16
|
27 $this->assertSame('MISS', $this->drupalGetHeader('X-Drupal-Cache'));
|
Chris@18
|
28 $this->drupalGet('/default_format_test/machine');
|
Chris@18
|
29 $this->assertSame('format:json', $this->getSession()->getPage()->getContent());
|
Chris@18
|
30 $this->assertSame('HIT', $this->drupalGetHeader('X-Drupal-Cache'));
|
Chris@16
|
31 }
|
Chris@16
|
32
|
Chris@16
|
33 public function testMultipleRoutesWithSameSingleFormat() {
|
Chris@16
|
34 $this->drupalGet('/default_format_test/machine');
|
Chris@16
|
35 $this->assertSame('format:json', $this->getSession()->getPage()->getContent());
|
Chris@16
|
36 }
|
Chris@16
|
37
|
Chris@16
|
38 }
|