You are here

protected function TmgmtExtensionSuitTestBase::getNodeHash in TMGMT Extension Suite 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/TmgmtExtensionSuitTestBase.php \Drupal\Tests\tmgmt_extension_suit\Functional\TmgmtExtensionSuitTestBase::getNodeHash()

Returns job item hash by node id and job id.

Parameters

$nid:

$jobId:

Return value

bool|mixed

2 calls to TmgmtExtensionSuitTestBase::getNodeHash()
CheckEntityChangesTest::testDoNotTrackTranslatableEntityChanges in tests/src/Functional/CheckEntityChangesTest.php
Test "Track changes of the translatable entities" feature is turned off.
CheckEntityChangesTest::testTrackTranslatableEntityChanges in tests/src/Functional/CheckEntityChangesTest.php
Test "Track changes of the translatable entities" feature is turned on.

File

tests/src/Functional/TmgmtExtensionSuitTestBase.php, line 167

Class

TmgmtExtensionSuitTestBase
Basic class for tmgmt extension module.

Namespace

Drupal\Tests\tmgmt_extension_suit\Functional

Code

protected function getNodeHash($nid, $jobId) {
  $hashQuery = Drupal::database()
    ->select('tmgmt_job_item', 'tji');
  $hashQuery
    ->join('tmgmt_job', 'tj', 'tj.tjid = tji.tjid');
  $hash = $hashQuery
    ->condition('tj.tjid', $jobId)
    ->condition('tji.item_id', $nid)
    ->fields('tji', [
    'tjid',
    'tes_source_content_hash',
  ])
    ->execute()
    ->fetchAllKeyed();
  return $hash ? reset($hash) : FALSE;
}