protected function SerializerTest::setUp in JSON:API 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/Serializer/SerializerTest.php \Drupal\Tests\jsonapi\Kernel\Serializer\SerializerTest::setUp()
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ Serializer/ SerializerTest.php, line 54
Class
- SerializerTest
- Tests the JSON API serializer.
Namespace
Drupal\Tests\jsonapi\Kernel\SerializerCode
protected function setUp() {
parent::setUp();
// Add the entity schemas.
$this
->installEntitySchema('node');
$this
->installEntitySchema('user');
// Add the additional table schemas.
$this
->installSchema('system', [
'sequences',
]);
$this
->installSchema('node', [
'node_access',
]);
$this
->installSchema('user', [
'users_data',
]);
$this->user = User::create([
'name' => $this
->randomString(),
'status' => 1,
]);
$this->user
->save();
NodeType::create([
'type' => 'foo',
])
->save();
$this
->createTextField('node', 'foo', 'field_text', 'Text');
$this->node = Node::create([
'title' => 'Test Node',
'type' => 'foo',
'field_text' => [
'value' => 'This is some text.',
'format' => 'text_plain',
],
'uid' => $this->user
->id(),
]);
$this->node
->save();
$this->sut = $this->container
->get('jsonapi.serializer_do_not_use_removal_imminent');
}