public function EntityResourceTest::testCreateIndividualWithMissingRequiredData in JSON:API 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/Controller/EntityResourceTest.php \Drupal\Tests\jsonapi\Kernel\Controller\EntityResourceTest::testCreateIndividualWithMissingRequiredData()
@covers ::createIndividual
File
- tests/
src/ Kernel/ Controller/ EntityResourceTest.php, line 430
Class
- EntityResourceTest
- @coversDefaultClass \Drupal\jsonapi\Controller\EntityResource @group jsonapi @group legacy
Namespace
Drupal\Tests\jsonapi\Kernel\ControllerCode
public function testCreateIndividualWithMissingRequiredData() {
$node = Node::create([
'type' => 'article',
]);
Role::load(Role::ANONYMOUS_ID)
->grantPermission('create article content')
->save();
$this
->setExpectedException(HttpException::class, 'Unprocessable Entity: validation failed.');
$entity_resource = $this
->buildEntityResource('node', 'article');
$entity_resource
->createIndividual($node, new Request());
}