You are here

protected function LingotekNodeNotificationCallbackTest::resetStorageCachesAndReloadNode in Lingotek Translation 8.2

Same name and namespace in other branches
  1. 3.0.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::resetStorageCachesAndReloadNode()
  2. 3.1.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::resetStorageCachesAndReloadNode()
  3. 3.2.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::resetStorageCachesAndReloadNode()
  4. 3.3.x tests/src/Functional/LingotekNodeNotificationCallbackTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeNotificationCallbackTest::resetStorageCachesAndReloadNode()

Resets node and metadata storage caches and reloads the node.

Return value

\Drupal\node\NodeInterface The node.

13 calls to LingotekNodeNotificationCallbackTest::resetStorageCachesAndReloadNode()
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.
LingotekNodeNotificationCallbackTest::testImportFailureWhileUpdating in tests/src/Functional/LingotekNodeNotificationCallbackTest.php
Tests that an import_failure callback is handled after document update.

... See full list

File

tests/src/Functional/LingotekNodeNotificationCallbackTest.php, line 2041

Class

LingotekNodeNotificationCallbackTest
Tests translating a node using the notification callback.

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;
}