You are here

public function ImagecacheExternalTestCase::assertExternalsCacheContains in Imagecache External 7.2

Assert that the cache contains the specified number of files.

Parameters

int $num_files: The number of files that should be in the cache.

1 call to ImagecacheExternalTestCase::assertExternalsCacheContains()
ImagecacheExternalTestCase::testCachingCronCleanup in ./imagecache_external.test
Test the cron cleanup job.

File

./imagecache_external.test, line 315
Tests for Imagecache External.

Class

ImagecacheExternalTestCase
Tests the functions for working with public/private file schemes.

Code

public function assertExternalsCacheContains($num_files) {
  $externals_directory = file_build_uri(variable_get('imagecache_directory', 'externals'));
  $num_external_files = count(file_scan_directory($externals_directory, '/.+\\.(jpe?g|gif|png)$/i'));
  $params = array(
    '@expected' => $num_files,
    '@found' => $num_external_files,
  );
  $this
    ->assertEqual($num_external_files, $num_files, t('Expected @expected images to be left in cache. Found @found.', $params));
}