You are here

public function NodeTest::testInvalidBundle 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::testInvalidBundle()

Test bundle normalization when posting using a simple string.

File

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

Class

NodeTest
Tests special cases for node entities.

Namespace

Drupal\rest\Tests

Code

public function testInvalidBundle() {

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

  // Make sure the response is "Bad Request".
  $this
    ->assertResponse(400);
  $this
    ->assertResponseBody('{"error":"\\"bad_bundle_name\\" is not a valid bundle type for denormalization."}');
}