You are here

public function ContentHubStatusReportTest::testContentHubStatusReportWithNoClients in Acquia Content Hub 8.2

Test Status Report with No Clients.

File

tests/src/Kernel/ContentHubStatusReportTest.php, line 69

Class

ContentHubStatusReportTest
Tests the Content Hub settings form.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

public function testContentHubStatusReportWithNoClients() {
  $options = [
    "from" => 0,
    "query" => [
      "bool" => [
        "filter" => [
          [
            "term" => [
              "data.type" => 'client',
            ],
          ],
        ],
      ],
    ],
    "size" => 50,
    "sort" => [
      "data.modified" => "desc",
    ],
  ];
  $this->client
    ->searchEntity($options)
    ->willReturn([]);
  $this->clientFactory
    ->getClient()
    ->willReturn($this->client
    ->reveal());
  $this->container
    ->set('acquia_contenthub.client.factory', $this->clientFactory
    ->reveal());
  $controller = new StatusReportController($this->container
    ->get('acquia_contenthub.client.factory'), $this->container
    ->has('pager.manager') ? $this->container
    ->get('pager.manager') : NULL);
  $request = new Request();
  $build = $controller
    ->statusReportPage($request);
  $this
    ->assertFalse(array_key_exists(0, $build[0]['clients_table']), 'Empty Search Response returns no data.');
}