Пример #1
0
 protected function setUp()
 {
     parent::setUp();
     \Drupal::service('router.builder')->rebuild();
     // Create the test field storage.
     entity_create('field_storage_config', array('entity_type' => 'entity_test_mulrev', 'field_name' => 'field_test_entity_reference', 'type' => 'entity_reference', 'settings' => array('target_type' => 'entity_test_mulrev')))->save();
     // Create the test field.
     entity_create('field_config', array('entity_type' => 'entity_test_mulrev', 'field_name' => 'field_test_entity_reference', 'bundle' => 'entity_test_mulrev'))->save();
 }
 protected function setUp()
 {
     parent::setUp();
     // Create a test entity to serialize.
     $this->values = array('name' => $this->randomMachineName(), 'user_id' => \Drupal::currentUser()->id(), 'field_test_text' => array('value' => $this->randomMachineName(), 'format' => 'full_html'));
     $this->entity = entity_create('entity_test_mulrev', $this->values);
     $this->entity->save();
     $this->serializer = $this->container->get('serializer');
     $this->installConfig(array('field'));
 }
 protected function setUp()
 {
     parent::setUp();
     // User create needs sequence table.
     $this->installSchema('system', array('sequences'));
     // Create a test user to use as the entity owner.
     $this->user = \Drupal::entityManager()->getStorage('user')->create(['name' => 'serialization_test_user', 'mail' => '*****@*****.**', 'pass' => '123456']);
     $this->user->save();
     // Create a test entity to serialize.
     $this->values = array('name' => $this->randomMachineName(), 'user_id' => $this->user->id(), 'field_test_text' => array('value' => $this->randomMachineName(), 'format' => 'full_html'));
     $this->entity = entity_create('entity_test_mulrev', $this->values);
     $this->entity->save();
     $this->serializer = $this->container->get('serializer');
     $this->installConfig(array('field'));
 }