You are here

public function JSDelivrTest::test_getInformation in Libraries CDN API 7

@covers ::getInformation()

File

tests/src/Plugin/LibrariesCDN/JSDelivrTest.php, line 305
Contains \Drupal\Tests\Libraries_cdn\Plugin\LibrariesCDN\JSDelivrTest.

Class

JSDelivrTest
@coversDefaultClass \Drupal\libraries_cdn\Plugin\LibrariesCDN\JSDelivr

Namespace

Drupal\Tests\libraries_cdn\Plugin\LibrariesCDN

Code

public function test_getInformation() {

  // Test 1
  $this->plugin
    ->setLibrary('ol3');
  $results = array(
    array(
      'name' => 'ol3',
      'lastversion' => '3.8.2',
    ),
  );
  $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' => json_encode($results),
  ));
  $data = $this->plugin
    ->getInformation();
  $this
    ->assertNotEmpty($data['name']);
}