You are here

public function RestIncidentStorageTest::testGetSingleIncident in Radioactivity 8.3

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

@covers ::getIncidents

File

tests/src/Unit/RestIncidentStorageTest.php, line 62

Class

RestIncidentStorageTest
@coversDefaultClass \Drupal\radioactivity\RestIncidentStorage @group radioactivity

Namespace

Drupal\Tests\radioactivity\Unit

Code

public function testGetSingleIncident() {
  $incidentData = Json::decode('[[{"fn":"field_name","et":"entity_type","id":"99","e":10,"h":"fb05739ec66040df9e6c53330755753c02e73621"}]]');
  $this->sut
    ->expects($this
    ->once())
    ->method('getIncidentsFromStorage')
    ->will($this
    ->returnValue($incidentData));
  $result = $this->sut
    ->getIncidents();
  $this
    ->assertCount(1, $result);
  $this
    ->assertInstanceOf(IncidentInterface::class, $result[0]);
}