You are here

public function JsonApiExtrasFunctionalTest::testOverwriteFieldWithOtherField in JSON:API Extras 8.3

File

tests/src/Functional/JsonApiExtrasFunctionalTest.php, line 147

Class

JsonApiExtrasFunctionalTest
The test class for the main functionality.

Namespace

Drupal\Tests\jsonapi_extras\Functional

Code

public function testOverwriteFieldWithOtherField() {
  $this
    ->createDefaultContent(1, 1, FALSE, TRUE, static::IS_NOT_MULTILINGUAL);

  // 1. Test if moving a field over another doesn't break
  $this->nodes[0]->field_text_moved
    ->setValue('field_text_moved_value');
  $this->nodes[0]->field_text_moved_new
    ->setValue('field_text_moved_new_value');
  $this->nodes[0]
    ->save();
  $stringResponse = $this
    ->drupalGet('/api/articles');
  $output = Json::decode($stringResponse);
  $this
    ->assertEquals($this->nodes[0]->field_text_moved_new->value, $output['data'][0]['attributes']['field_text_moved']['value']);
}