You are here

public function LudwigIntegrationTest::testIntegration in Ludwig 8

Tests that packages are downloaded, added to namespaces, classes available.

File

tests/src/Kernel/LudwigIntegrationTest.php, line 26

Class

LudwigIntegrationTest
Tests that the Downloader works.

Namespace

Drupal\Tests\ludwig\Kernel

Code

public function testIntegration() {

  /** @var \Drupal\ludwig\PackageManagerInterface $package_manager */
  $package_manager = $this->container
    ->get('ludwig.package_manager');

  /** @var \Drupal\ludwig\PackageDownloader $package_downloader */
  $package_downloader = $this->container
    ->get('ludwig.package_downloader');
  $packages = $package_manager
    ->getPackages();
  foreach ($packages as $package) {
    $package_downloader
      ->download($package);
  }
  $this->container
    ->get('kernel')
    ->rebuildContainer();
  $packages = $package_manager
    ->getPackages();
  $namespaces = $this->container
    ->getParameter('container.namespaces');
  foreach ($packages as $package) {
    $this
      ->assertTrue(isset($namespaces[$package['namespace']]), 'Could not find namespace ' . $package['namespace']);
  }
  $this
    ->assertTrue(class_exists('CommerceGuys\\Intl\\Calculator'));
}