public function EntityTest::setUp in GraphQL 8.4
Overrides GraphQLTestBase::setUp
File
- tests/
src/ Kernel/ DataProducer/ EntityTest.php, line 30
Class
- EntityTest
- Data producers Entity test class.
Namespace
Drupal\Tests\graphql\Kernel\DataProducerCode
public function setUp() : void {
parent::setUp();
$this->entity = $this
->getMockBuilder(NodeInterface::class)
->disableOriginalConstructor()
->getMock();
$this->entity_interface = $this
->getMockBuilder(EntityInterface::class)
->disableOriginalConstructor()
->getMock();
$this->user = $this
->getMockBuilder(UserInterface::class)
->disableOriginalConstructor()
->getMock();
$content_type = NodeType::create([
'type' => 'lorem',
'name' => 'ipsum',
'translatable' => TRUE,
'display_submitted' => FALSE,
]);
$content_type
->save();
$content_type = NodeType::create([
'type' => 'otherbundle',
'name' => 'otherbundle',
'translatable' => TRUE,
'display_submitted' => FALSE,
]);
$content_type
->save();
$this->node = Node::create([
'title' => 'Dolor',
'type' => 'lorem',
]);
$this->node
->save();
$this->translation_fr = $this->node
->addTranslation('fr', [
'title' => 'sit amet fr',
]);
$this->translation_fr
->save();
$this->translation_de = $this->node
->addTranslation('de', [
'title' => 'sit amet de',
]);
$this->translation_de
->save();
\Drupal::service('content_translation.manager')
->setEnabled('node', 'lorem', TRUE);
}