You are here

public function RestIncidentStorageTest::testGetSingleIncident in Radioactivity 4.0.x

Same name and namespace in other branches
  1. 8.3 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","ti":"0","e":"10","h":"4bd2afb1d12a72f3a2fdb01b8fdaf128b8c09efa"}]]');
  $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]);
}