You are here

public function MinisiteTestBase::assertAssetFilesExist in Mini site 8

Assert assets paths exist.

1 call to MinisiteTestBase::assertAssetFilesExist()
MinisiteTestBase::assertMinisiteUploaded in tests/src/Functional/MinisiteTestBase.php
Assert that Minisite archive file was uploaded and assets expanded.

File

tests/src/Functional/MinisiteTestBase.php, line 347

Class

MinisiteTestBase
Provides methods specifically for testing Minisite module's field handling.

Namespace

Drupal\Tests\minisite\Functional

Code

public function assertAssetFilesExist($files) {
  $actual_files = array_keys(LegacyWrapper::scanDirectory(Minisite::getCommonAssetDir(), '/.*/'));
  $this
    ->assertEquals(count($actual_files), count($files));
  foreach ($files as $test_file) {
    $found_files = array_filter($actual_files, function ($value) use ($test_file) {
      return substr($value, -strlen($test_file)) === $test_file;
    });
    $this
      ->assertTrue(count($found_files) == 1, 'Asset file found in the list of created files');
  }
}