You are here

public function JSDelivrTest::test_convertFiles in Libraries CDN API 7

@covers ::convertFiles()

File

tests/src/Plugin/LibrariesCDN/JSDelivrTest.php, line 224
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_convertFiles() {
  $this->plugin
    ->setLibrary('jquery');
  $urls = $this->plugin
    ->getConfiguration('urls');
  $files = array(
    'file1.js',
    'file2.js',
  );
  $version = '1.0';
  $data = $this->plugin
    ->convertFiles($files, $version);
  foreach ($data as $key => $file) {
    $url = sprintf($urls['convertFiles'], $this->plugin
      ->getLibrary(), $version) . $files[$key];
    $this
      ->assertEquals($url, $file);
  }
}