public function NodeTest::testInvalidBundle in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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\TestsCode
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."}');
}