You are here

protected function LingotekTestBase::resetStorageCachesAndReloadNode in Lingotek Translation 3.5.x

Same name and namespace in other branches
  1. 4.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::resetStorageCachesAndReloadNode()
  2. 3.4.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::resetStorageCachesAndReloadNode()
  3. 3.6.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::resetStorageCachesAndReloadNode()
  4. 3.7.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::resetStorageCachesAndReloadNode()
  5. 3.8.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::resetStorageCachesAndReloadNode()

Resets node and metadata storage caches and reloads the node.

Return value

\Drupal\node\NodeInterface The node.

18 calls to LingotekTestBase::resetStorageCachesAndReloadNode()
LingotekNodeNotificationCallbackQueueWorkerTest::testAutomatedNotificationNodeTranslation in tests/src/Functional/LingotekNodeNotificationCallbackQueueWorkerTest.php
Tests that a node can be translated using the links on the management page.
LingotekNodeNotificationCallbackTest::testArchivedNotificationCallback in tests/src/Functional/LingotekNodeNotificationCallbackTest.php
Tests that a node is archived on the right callback.
LingotekNodeNotificationCallbackTest::testAutomatedNotificationNodeTranslation in tests/src/Functional/LingotekNodeNotificationCallbackTest.php
Tests that a node can be translated using the links on the management page.
LingotekNodeNotificationCallbackTest::testDocumentCancelledAfterUploading in tests/src/Functional/LingotekNodeNotificationCallbackTest.php
Tests that a document_cancelled callback is handled after document upload.
LingotekNodeNotificationCallbackTest::testDocumentUpdated in tests/src/Functional/LingotekNodeNotificationCallbackTest.php
Tests that a document_updated callback is handled after document update.

... See full list

File

tests/src/Functional/LingotekTestBase.php, line 730

Class

LingotekTestBase
Base class for Lingotek test. Performs authorization of the account.

Namespace

Drupal\Tests\lingotek\Functional

Code

protected function resetStorageCachesAndReloadNode() {

  /** @var \Drupal\node\NodeStorageInterface $node_storage */
  $node_storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('node');

  /** @var \Drupal\Core\Entity\EntityStorageInterface; $metadata_storage */
  $metadata_storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('lingotek_content_metadata');

  // The node and the metadata caches need to be reset before reload.
  $metadata_storage
    ->resetCache([
    1,
  ]);
  $node_storage
    ->resetCache([
    1,
  ]);

  /** @var \Drupal\node\NodeInterface $node */
  $node = $node_storage
    ->load(1);
  return $node;
}