public function CreateTest::assertCreateEntityOverRestApi in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/rest/src/Tests/CreateTest.php \Drupal\rest\Tests\CreateTest::assertCreateEntityOverRestApi()
Creates the entity over the REST API.
Parameters
string $entity_type: The type of the entity that should be created.
string $serialized: The body for the POST request.
4 calls to CreateTest::assertCreateEntityOverRestApi()
- CreateTest::testCreateComment in core/
modules/ rest/ src/ Tests/ CreateTest.php - Test comment creation.
- CreateTest::testCreateEntityTest in core/
modules/ rest/ src/ Tests/ CreateTest.php - Tests valid and invalid create requests for 'entity_test' entity type.
- CreateTest::testCreateNode in core/
modules/ rest/ src/ Tests/ CreateTest.php - Tests several valid and invalid create requests for 'node' entity type.
- CreateTest::testCreateUser in core/
modules/ rest/ src/ Tests/ CreateTest.php - Tests several valid and invalid create requests for 'user' entity type.
File
- core/
modules/ rest/ src/ Tests/ CreateTest.php, line 361 - Contains \Drupal\rest\Tests\CreateTest.
Class
- CreateTest
- Tests the creation of resources.
Namespace
Drupal\rest\TestsCode
public function assertCreateEntityOverRestApi($entity_type, $serialized = NULL) {
// Note: this will fail with PHP 5.6 when always_populate_raw_post_data is
// set to something other than -1. See https://www.drupal.org/node/2456025.
$this
->httpRequest('entity/' . $entity_type, 'POST', $serialized, $this->defaultMimeType);
$this
->assertResponse(201);
}