You are here

protected function MinisiteTestBase::getStubAssetPath in Mini site 8

Create a stub asset path.

Return value

string Path for a stub asset.

1 call to MinisiteTestBase::getStubAssetPath()
AssetTest::testLoadAll in tests/src/Functional/AssetTest.php
Test Asset::save().

File

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

Class

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

Namespace

Drupal\Tests\minisite\Functional

Code

protected function getStubAssetPath() {
  $randomizer = new Random();
  $prefix = 'public://minisite/static/24c22dd1-2cf1-47ae-ac8a-23a7ff8b86c5/';
  $suffix = '.html';
  $dir_path = $randomizer
    ->name(10) . '/';

  // The full path of the file with the scheme should be exactly 2048
  // characters long.
  // Note that most of the browsers support URLs length under 2048 characters.
  $file_path = $randomizer
    ->name(2048 - strlen($dir_path) - strlen($prefix) - strlen($suffix)) . $suffix;
  $path = $prefix . $dir_path . $file_path;
  return $path;
}