/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->config = $this->config('rest.settings'); // Create an entity programmatically. $this->entity = $this->entityCreate('entity_test'); $this->entity->save(); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->enableService('entity:' . $this->testEntityType, 'POST', 'hal_json', array('basic_auth', 'cookie')); // Create a user account that has the required permissions to create // resources via the REST API. $permissions = $this->entityPermissions($this->testEntityType, 'create'); $permissions[] = 'restful post entity:' . $this->testEntityType; $this->account = $this->drupalCreateUser($permissions); // Serialize an entity to a string to use in the content body of the POST // request. $serializer = $this->container->get('serializer'); $entity_values = $this->entityValues($this->testEntityType); $entity = entity_create($this->testEntityType, $entity_values); $this->serialized = $serializer->serialize($entity, $this->defaultFormat); }