You are here

public function RestProcessorTest::testClearData in Radioactivity 8.3

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

@covers ::clearData

File

tests/src/Unit/RestProcessorTest.php, line 89

Class

RestProcessorTest
@coversDefaultClass \Drupal\radioactivity\RestProcessor @group radioactivity

Namespace

Drupal\Tests\radioactivity\Unit

Code

public function testClearData() {
  $data = '[{"fn":"field_ra","et":"node","id":"66","e":10,"h":"12345678"}]';
  $this->sut
    ->processData($data);
  $response = $this->sut
    ->getData();
  $this
    ->assertEquals('[[{"fn":"field_ra","et":"node","id":"66","e":10,"h":"12345678"}]]', $response);
  $response = $this->sut
    ->clearData();
  $this
    ->assertEquals('{"status":"ok","message":"Cleared."}', $response);
  $response = $this->sut
    ->getData();
  $this
    ->assertEquals('[]', $response);
}