public function EmitControllerEndpointTest::testRestValidation in Radioactivity 8.3
Same name and namespace in other branches
- 4.0.x tests/src/Kernel/EmitControllerEndpointTest.php \Drupal\Tests\radioactivity\Kernel\EmitControllerEndpointTest::testRestValidation()
Tests that the emit endpoint does not accept invalid requests.
File
- tests/
src/ Kernel/ EmitControllerEndpointTest.php, line 41
Class
- EmitControllerEndpointTest
- Tests the Radioactivity Emit Controller Endpoint.
Namespace
Drupal\Tests\radioactivity\KernelCode
public function testRestValidation() {
$http_kernel = $this->container
->get('http_kernel');
$request = Request::create('/radioactivity/emit');
$response = $http_kernel
->handle($request);
$this
->assertEquals(Response::HTTP_OK, $response
->getStatusCode());
$this
->assertStringContainsString('"status":"error"', $response
->getContent());
$this
->assertStringContainsString('"message":"Empty request."', $response
->getContent());
}