public function EntityShareCronServiceTest::loadNodeByProperties in Entity Share Cron 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/EntityShareCronServiceTest.php \Drupal\Tests\entity_share_cron\Unit\EntityShareCronServiceTest::loadNodeByProperties()
Method used to mock node storage. Loads a node by its UUID.
Parameters
array $properties: Array of properties to filter the nodes.
File
- tests/
src/ Unit/ EntityShareCronServiceTest.php, line 226
Class
- EntityShareCronServiceTest
- @coversDefaultClass \Drupal\entity_share_cron\EntityShareCronService @group entity_share_cron
Namespace
Drupal\Tests\entity_share_cron\UnitCode
public function loadNodeByProperties(array $properties) {
$uuid = $properties['uuid'];
$filtered_nodes = [];
foreach ($this->nodes as $node) {
if (is_array($uuid) && in_array($node
->uuid(), $uuid)) {
$filtered_nodes[] = $node;
}
elseif ($node
->uuid() == $uuid) {
$filtered_nodes[] = $node;
}
}
return $filtered_nodes;
}