You are here

public function NodeTest::testMissingBundle in Zircon Profile 8

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

Test when the bundle is missing.

File

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

Class

NodeTest
Tests special cases for node entities.

Namespace

Drupal\rest\Tests

Code

public function testMissingBundle() {

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

  // testing
  $this
    ->postNode($data);

  // Make sure the response is "Bad Request".
  $this
    ->assertResponse(400);
  $this
    ->assertResponseBody('{"error":"A string must be provided as a bundle value."}');
}