You are here

public function YamlFormStorageTest::testStorageCaching in YAML Form 8

Test form storage.

See also

\Drupal\yamlform\YamlFormEntityStorage::load

File

src/Tests/YamlFormStorageTest.php, line 26

Class

YamlFormStorageTest
Tests for form storage tests.

Namespace

Drupal\yamlform\Tests

Code

public function testStorageCaching() {

  /** @var \Drupal\yamlform\YamlFormEntityStorage $storage */
  $storage = \Drupal::entityTypeManager()
    ->getStorage('yamlform');
  $yamlform = $storage
    ->load('contact');
  $yamlform->cached = TRUE;

  // Check that load (single) has the custom 'cached' property.
  $this
    ->assertEqual($yamlform->cached, $storage
    ->load('contact')->cached);

  // Check that loadMultiple does not have the custom 'cached' property.
  // The below test will fail when and if
  // 'Issue #1885830: Enable static caching for config entities.'
  // is resolved.
  $this
    ->assert(!isset($storage
    ->loadMultiple([
    'contact',
  ])->cached));
}