You are here

public function EmitControllerTest::testEmitEmptyRequest in Radioactivity 8.3

Same name and namespace in other branches
  1. 4.0.x tests/src/Unit/EmitControllerTest.php \Drupal\Tests\radioactivity\Unit\EmitControllerTest::testEmitEmptyRequest()

@covers ::emit

File

tests/src/Unit/EmitControllerTest.php, line 75

Class

EmitControllerTest
@coversDefaultClass \Drupal\radioactivity\Controller\EmitController @group radioactivity

Namespace

Drupal\Tests\radioactivity\Unit

Code

public function testEmitEmptyRequest() {
  $this->request
    ->getContent()
    ->willReturn(NULL);
  $controller = EmitController::create($this->container
    ->reveal());
  $response = $controller
    ->emit($this->request
    ->reveal());
  $this->defaultIncidentStorage
    ->addIncident()
    ->shouldNotBeCalled();
  $this
    ->assertEquals('Symfony\\Component\\HttpFoundation\\JsonResponse', get_class($response));
  $this
    ->assertEquals('{"status":"error","message":"Empty request."}', $response
    ->getContent());
}