You are here

public function ContentHubEntityExportControllerTest::testIsRequestFromAcquiaContentHub in Acquia Content Hub 8

Tests isRequestFromAcquiaContentHub method.

@covers ::isRequestFromAcquiaContentHub

File

tests/src/Unit/Controller/ContentHubEntityExportControllerTest.php, line 398

Class

ContentHubEntityExportControllerTest
Unit test for ContentHubEntityExportController class.

Namespace

Drupal\Tests\acquia_contenthub\Unit\Controller

Code

public function testIsRequestFromAcquiaContentHub() {
  $_SERVER['HTTP_USER_AGENT'] = 'Go-http-client';
  $this
    ->assertTrue($this->contentHubEntityExportController
    ->isRequestFromAcquiaContentHub());
  $_SERVER['HTTP_USER_AGENT'] = 'Unknown';
  $this
    ->assertFalse($this->contentHubEntityExportController
    ->isRequestFromAcquiaContentHub());
  unset($_SERVER['HTTP_USER_AGENT']);
  $this
    ->assertFalse($this->contentHubEntityExportController
    ->isRequestFromAcquiaContentHub());
}