VocabularySerializationTest.php in Drupal 8
File
core/modules/taxonomy/tests/src/Functional/VocabularySerializationTest.php
View source
<?php
namespace Drupal\Tests\taxonomy\Functional;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\BrowserTestBase;
class VocabularySerializationTest extends BrowserTestBase {
public static $modules = [
'taxonomy',
'vocabulary_serialization_test',
];
protected $defaultTheme = 'stark';
public function setUp() {
parent::setUp();
Vocabulary::create([
'vid' => 'test',
])
->save();
}
public function testSerialization() {
$this
->drupalGet('/vocabulary_serialization_test/test');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSame('this is the output', $this
->getSession()
->getPage()
->getContent());
$this
->assertSession()
->responseHeaderEquals('X-Drupal-Cache', 'MISS');
$this
->drupalGet('/vocabulary_serialization_test/test');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSame('this is the output', $this
->getSession()
->getPage()
->getContent());
$this
->assertSession()
->responseHeaderEquals('X-Drupal-Cache', 'HIT');
}
}