You are here

public function NodeTest::testBundleNormalization in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/rest/src/Tests/NodeTest.php \Drupal\rest\Tests\NodeTest::testBundleNormalization()

Test bundle normalization when posting bundle as a simple string.

File

core/modules/rest/src/Tests/NodeTest.php, line 153
Contains \Drupal\rest\Tests\NodeTest.

Class

NodeTest
Tests special cases for node entities.

Namespace

Drupal\rest\Tests

Code

public function testBundleNormalization() {

  // Data to be used for serialization.
  $data = [
    'type' => 'resttest',
    'title' => [
      [
        'value' => $this
          ->randomString(),
      ],
    ],
  ];
  $this
    ->postNode($data);

  // Make sure the response is "CREATED".
  $this
    ->assertResponse(201);

  // Make sure the node was created and the title matches.
  $this
    ->assertNodeTitleMatch($data);
}