You are here

public function CDNJSTest::test_getInformation in Libraries CDN API 7

@covers ::getInformation()

File

tests/src/Plugin/LibrariesCDN/CDNJSTest.php, line 311
Contains \Drupal\Tests\Libraries_cdn\Plugin\LibrariesCDN\CDNJSTest.

Class

CDNJSTest
@coversDefaultClass \Drupal\libraries_cdn\Plugin\LibrariesCDN\CDNJS

Namespace

Drupal\Tests\libraries_cdn\Plugin\LibrariesCDN

Code

public function test_getInformation() {

  // Test 1
  $this->plugin
    ->setLibrary('ol3');
  $urls = $this->plugin
    ->getConfiguration('urls');
  $url = sprintf($urls['getInformation'], $this->plugin
    ->getLibrary());
  $this->drupal7
    ->shouldReceive('drupal_http_request')
    ->once()
    ->with($url, array())
    ->andReturn(array(
    'code' => 200,
    'data' => '{"name":"ol3"}',
  ));
  $data = $this->plugin
    ->getInformation();
  $this
    ->assertNotEmpty($data['name']);
}