diff -u b/src/Form/LingotekJobManagementContentEntitiesForm.php b/src/Form/LingotekJobManagementContentEntitiesForm.php --- b/src/Form/LingotekJobManagementContentEntitiesForm.php +++ b/src/Form/LingotekJobManagementContentEntitiesForm.php @@ -35,7 +35,8 @@ $entity_query = $metadataStorage->getQuery(); $entity_query->condition('job_id', $this->jobId); - $ids = $entity_query->accessCheck()->execute(); + $entity_query->accessCheck(); + $ids = $entity_query->execute(); /** @var \Drupal\lingotek\Entity\LingotekContentMetadata[] $metadatas */ $metadatas = $metadataStorage->loadMultiple($ids); diff -u b/src/Plugin/LingotekFieldProcessor/LingotekLayoutBuilderATProcessor.php b/src/Plugin/LingotekFieldProcessor/LingotekLayoutBuilderATProcessor.php --- b/src/Plugin/LingotekFieldProcessor/LingotekLayoutBuilderATProcessor.php +++ b/src/Plugin/LingotekFieldProcessor/LingotekLayoutBuilderATProcessor.php @@ -12,6 +12,7 @@ use Drupal\Core\Entity\RevisionableInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Field\FieldDefinitionInterface; +use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\PluginBase; use Drupal\layout_builder\SectionListInterface; @@ -217,7 +218,7 @@ */ public function store(ContentEntityInterface &$translation, string $langcode, ContentEntityInterface &$revision, string $field_name, FieldDefinitionInterface $field_definition, array &$field_data) { // TODO: Ensure we use LB_AT. - /** @var SectionListInterface[] $sourceSections */ + /** @var FieldItemInterface[] $sourceSections */ $sourceSections = $revision->get($field_name); $translation->set($field_name, NULL); // If we are embedding content blocks, we need to translate those too. @@ -247,7 +248,7 @@ } foreach ($sourceSections as $delta => &$field_item) { /** @var \Drupal\layout_builder\Section $sectionObject */ - $sectionObject = clone $field_item->getSection($delta); + $sectionObject = clone $field_item->__get('section'); $components = $sectionObject->getComponents(); foreach ($components as $componentUuid => &$component) { $config = $component->get('configuration'); reverted: --- b/src/Plugin/LingotekFieldProcessor/LingotekTablefieldProcessor.php +++ a/src/Plugin/LingotekFieldProcessor/LingotekTablefieldProcessor.php @@ -28,7 +28,7 @@ */ public function extract(ContentEntityInterface &$entity, string $field_name, FieldDefinitionInterface $field_definition, array &$data, array &$visited = [], string $revision_mode = LingotekContentTranslationEntityRevisionResolver::RESOLVE_LATEST_TRANSLATION_AFFECTED) { foreach ($entity->get($field_name) as $index => $field_item) { + $tableValue = $field_item->value; - $tableValue = $field_item->getValue(); $embedded_data = []; foreach ($tableValue as $row_index => $row) { if ($row_index === 'caption') { diff -u b/src/Plugin/RelatedEntitiesDetector/NestedLayoutBuilderEntitiesDetector.php b/src/Plugin/RelatedEntitiesDetector/NestedLayoutBuilderEntitiesDetector.php --- b/src/Plugin/RelatedEntitiesDetector/NestedLayoutBuilderEntitiesDetector.php +++ b/src/Plugin/RelatedEntitiesDetector/NestedLayoutBuilderEntitiesDetector.php @@ -167,10 +167,10 @@ private function prepareBlockContentIds(array $blockContentRevisionIds) { /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $blockContentStorage */ $blockContentStorage = $this->entityTypeManager->getStorage('block_content'); - $ids = $blockContentStorage->getQuery() - ->condition($blockContentStorage->getEntityType()->getKey('revision'), $blockContentRevisionIds, 'IN') - ->accessCheck() - ->execute(); + $query = $blockContentStorage->getQuery() + ->condition($blockContentStorage->getEntityType()->getKey('revision'), $blockContentRevisionIds, 'IN'); + $query->accessCheck(FALSE); + $ids = $query->execute(); return $ids; } diff -u b/tests/src/Functional/LingotekNodeParagraphsTranslationTest.php b/tests/src/Functional/LingotekNodeParagraphsTranslationTest.php --- b/tests/src/Functional/LingotekNodeParagraphsTranslationTest.php +++ b/tests/src/Functional/LingotekNodeParagraphsTranslationTest.php @@ -646,7 +646,7 @@ $this->assertSession()->pageTextNotContains('Las llamas son muy chulas por segunda vez EDITADO'); $this->assertSession()->pageTextContains('Las llamas son muy chulas por tercera vez EDITADO'); - $paragraphs = $this->xpath('//div[contains(@class, "paragraph")]'); + $paragraphs = $this->xpath('//div[starts-with(@class, "paragraph")]'); $this->assertCount(2, $paragraphs); } diff -u b/tests/src/FunctionalJavascript/LingotekNodeParagraphsTranslationTest.php b/tests/src/FunctionalJavascript/LingotekNodeParagraphsTranslationTest.php --- b/tests/src/FunctionalJavascript/LingotekNodeParagraphsTranslationTest.php +++ b/tests/src/FunctionalJavascript/LingotekNodeParagraphsTranslationTest.php @@ -123,7 +123,7 @@ // the upload status. $toggle = $page->find('css', 'li.dropbutton-toggle button'); $toggle->click(); - $dropButton = $page->find('css', 'li.check-upload-status.dropbutton-action a'); + $dropButton = $page->find('css', 'li.check-upload-status.dropbutton__item.dropbutton-action.secondary-action a'); $dropButton->click(); // This is a batch process, wait to finish. @@ -226,7 +226,7 @@ // the upload status. $toggle = $page->find('css', 'li.dropbutton-toggle button'); $toggle->click(); - $dropButton = $page->find('css', 'li.check-upload-status.dropbutton-action a'); + $dropButton = $page->find('css', 'li.check-upload-status.dropbutton__item.dropbutton-action.secondary-action a'); $dropButton->click(); // This is a batch process, wait to finish. diff -u b/tests/src/Unit/Plugin/LingotekFormComponent/Filter/GnodeGroupTest.php b/tests/src/Unit/Plugin/LingotekFormComponent/Filter/GnodeGroupTest.php --- b/tests/src/Unit/Plugin/LingotekFormComponent/Filter/GnodeGroupTest.php +++ b/tests/src/Unit/Plugin/LingotekFormComponent/Filter/GnodeGroupTest.php @@ -15,7 +15,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\group\Entity\GroupInterface; use Drupal\group\Entity\GroupTypeInterface; -use Drupal\group\Plugin\GroupContentEnablerManagerInterface; +use Drupal\group\Plugin\Group\Relation\GroupRelationTypeManager; use Drupal\lingotek\LingotekConfigurationServiceInterface; use Drupal\lingotek\LingotekContentTranslationServiceInterface; use Drupal\lingotek\Plugin\LingotekFormComponent\Filter\GnodeGroup; @@ -143,7 +143,7 @@ $this->filter->setStringTranslation($translation); $container = new Container(); - $this->groupContentEnablerManager = $this->createMock(GroupContentEnablerManagerInterface::class); + $this->groupContentEnablerManager = $this->createMock(GroupRelationTypeManager::class); $container->set('plugin.manager.group_content_enabler', $this->groupContentEnablerManager); \Drupal::setContainer($container); @@ -279,42 +279,58 @@ $select = $this->createMock(PagerSelectExtender::class); - $select->expects($this->exactly(3)) - ->method('innerJoin') + $select->method('innerJoin') ->willReturnCallback(function () use ($select) { return $select; }); - - $select->expects($this->exactly(2)) - ->method('condition') + $select->method('condition') ->willReturnCallback(function () use ($select) { return $select; }); - - $select->innerJoin('group_content_field_data', 'group_content', "entity_table.entity_id = group_content.entity_id"); - $select->condition('group_content.gid', 'group_1', '='); - $select->condition('group_content.type', ['group_type_1-definition_1-bundle'], 'IN'); + $select->innerJoin( + $this->equalTo('group_content_field_data'), + $this->equalTo('group_content'), + $this->equalTo("entity_table.entity_id= group_content.entity_id") + ); + $select->condition( + $this->equalTo('group_content.gid'), + $this->equalTo('group_1'), + $this->equalTo('=') + ); + $select->condition( + $this->equalTo('group_content.type'), + $this->equalTo(['group_type_1-definition_1-bundle']), + $this->equalTo('IN') + ); $select->expects($this->once()) ->method('getUnion') ->willReturn([ ['query' => $unionQuery], ]); - $select = $this->createMock(PagerSelectExtender::class); - $select->expects($this->exactly(3)) - ->method('innerJoin') - ->willReturnCallback(function () use ($select) { - return $select; + + $unionQuery->method('innerJoin') + ->willReturnCallback(function () use ($unionQuery) { + return $unionQuery; }); - - $select->expects($this->exactly(2)) - ->method('condition') - ->willReturnCallback(function () use ($select) { - return $select; + $unionQuery->method('condition') + ->willReturnCallback(function () use ($unionQuery) { + return $unionQuery; }); + $unionQuery->innerJoin( + $this->equalTo('group_content_field_data'), + $this->equalTo('group_content'), + $this->equalTo("entity_table.entity_id= group_content.entity_id") + ); + $unionQuery->condition( + $this->equalTo('group_content.gid'), + $this->equalTo('group_1'), + $this->equalTo('=') + ); + $unionQuery->condition( + $this->equalTo('group_content.type'), + $this->equalTo(['group_type_1-definition_1-bundle']), + $this->equalTo('IN') + ); - $select->innerJoin('group_content_field_data', 'group_content', "entity_table.entity_id = group_content.entity_id"); - $select->condition('group_content.gid', 'group_1', '='); - $select->condition('group_content.type', ['group_type_1-definition_1-bundle'], 'IN'); - $this->filter->filter('my_entity_type_id', [], 'group_1', $select); } diff -u b/tests/src/Unit/Plugin/RelatedEntitiesDetector/HtmlLinkDetectorTest.php b/tests/src/Unit/Plugin/RelatedEntitiesDetector/HtmlLinkDetectorTest.php --- b/tests/src/Unit/Plugin/RelatedEntitiesDetector/HtmlLinkDetectorTest.php +++ b/tests/src/Unit/Plugin/RelatedEntitiesDetector/HtmlLinkDetectorTest.php @@ -244,26 +244,22 @@ * @dataProvider dataProviderFieldTypes */ public function testRunExtract($fieldType, $hasSummary) { - $callCount = 0; + $count = 0; $this->lingotekConfiguration->expects($this->exactly(3)) ->method('isEnabled') - ->willReturnCallback(function ($arg1, $arg2) use (&$callCount) { - $callCount++; - - switch ($callCount) { - case 1: - $this->assertEquals(['the_first_type', 'first_bundle'], [$arg1, $arg2]); - return TRUE; - - case 2: - $this->assertEquals(['entity_id', 'second_bundle'], [$arg1, $arg2]); - return TRUE; - - case 3: - $this->assertEquals(['entity_id', 'third_bundle'], [$arg1, $arg2]); - return FALSE; + ->willReturnCallback(function ($type, $bundle) use (&$count) { + $count++; + if ($count === 1 && $type === 'the_first_type' && $bundle === 'first_bundle') { + return TRUE; + } + elseif ($count === 2 && $type === 'entity_id' && $bundle === 'second_bundle') { + return TRUE; } + elseif ($count === 3 && $type === 'entity_id' && $bundle === 'third_bundle') { + return FALSE; + } }); + $titleFieldDefinition = $this->createMock(BaseFieldDefinition::class); $titleFieldDefinition->expects($this->once()) ->method('getType') @@ -389,46 +385,45 @@ ->method('loadByProperties') ->with(['uri' => 'public://example.png']) ->willReturn([13 => $file]); + + $loadCalls = [ + 8 => $firstEntity, + 2 => $secondEntity, + 5 => $thirdEntity, + 13 => $file, + ]; + $callCount = 0; $entityStorage->expects($this->exactly(4)) ->method('load') - ->withConsecutive([8], [2], [5], [13]) - ->willReturnOnConsecutiveCalls($firstEntity, $secondEntity, $thirdEntity, $file); + ->willReturnCallback(function ($entityId) use (&$callCount, $loadCalls) { + $callCount++; + if (isset($loadCalls[$entityId])) { + return $loadCalls[$entityId]; + } + return NULL; + }); $this->entityTypeManager->expects($this->any()) ->method('getStorage') ->willReturn($entityStorage); - $this->entityRepository->expects($this->exactly(4)) - ->method('loadEntityByUuid') - ->withConsecutive(['the_first_type', 'the-first-entity-uuid'], ['entity_id', 'the-second-entity-uuid'], ['entity_id', 'the-third-entity-uuid'], ['file', 'the-file-entity-uuid']) - ->willReturnOnConsecutiveCalls($firstEntity, $secondEntity, $thirdEntity, $file); - + $uuidMap = [ + 'the-first-entity-uuid' => $firstEntity, + 'the-second-entity-uuid' => $secondEntity, + 'the-third-entity-uuid' => $thirdEntity, + 'the-file-entity-uuid' => $file, + ]; $callCount = 0; - $entityUuids = [ - ['the_first_type', 'the-first-entity-uuid'], - ['entity_id', 'the-second-entity-uuid'], - ['third_entity_type', 'the-third-entity-uuid'], - ['file', 'the-file-entity-uuid'], - ]; $this->entityRepository->expects($this->exactly(4)) ->method('loadEntityByUuid') - ->willReturnCallback(function () use ($entityUuids, &$callCount, $firstEntity, $secondEntity, $thirdEntity, $file) { - $uuids = $entityUuids[$callCount]; + ->willReturnCallback(function ($entityType, $uuid) use (&$callCount, $uuidMap) { $callCount++; - switch ($uuids) { - case ['the_first_type', 'the-first-entity-uuid']: - return $firstEntity; - - case ['entity_id', 'the-second-entity-uuid']: - return $secondEntity; - - case ['third_entity_type', 'the-third-entity-uuid']: - return $thirdEntity; - - case ['file', 'the-file-entity-uuid']: - return $file; + if (isset($uuidMap[$uuid])) { + return $uuidMap[$uuid]; } + return NULL; }); + $data = [ (object) [ 'value' => '

This is a text with a relative link to a content

', only in patch2: unchanged: --- a/src/Plugin/LingotekFormComponent/Field/Title.php +++ b/src/Plugin/LingotekFormComponent/Field/Title.php @@ -45,7 +45,7 @@ class Title extends LingotekFormComponentFieldBase { * {@inheritdoc} */ public function getData(EntityInterface $entity) { - return $entity->hasLinkTemplate('canonical') ? Link::fromTextAndUrl($entity->label(), $entity->toUrl())->toString() : $entity->label(); + return $entity->hasLinkTemplate('canonical') ? Link::fromTextAndUrl($entity->label(), $entity->toUrl()) : $entity->label(); } } only in patch2: unchanged: --- a/tests/modules/lingotek_test/document_responses/node+nullpath.json +++ b/tests/modules/lingotek_test/document_responses/node+nullpath.json @@ -11,7 +11,7 @@ ], "path": [ { - "alias": null + "alias": "" } ] } \ No newline at end of file only in patch2: unchanged: --- a/tests/src/Unit/Plugin/LingotekFieldProcessor/LingotekLayoutBuilderATProcessorTest.php +++ b/tests/src/Unit/Plugin/LingotekFieldProcessor/LingotekLayoutBuilderATProcessorTest.php @@ -8,6 +8,7 @@ use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Entity\EntityStorageInterface; +use Drupal\Core\Entity\RevisionableStorageInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Field\BaseFieldDefinition; @@ -362,7 +363,7 @@ class LingotekLayoutBuilderATProcessorTest extends UnitTestCase { ->willReturn([$fieldItem]); $blockEntity = $this->createMock(ContentEntityInterface::class); - $entityStorage = $this->createMock(EntityStorageInterface::class); + $entityStorage = $this->createMock(RevisionableStorageInterface::class); $entityStorage->expects($this->once()) ->method('loadRevision') ->with(6) @@ -531,7 +532,7 @@ class LingotekLayoutBuilderATProcessorTest extends UnitTestCase { $blockEntity->expects($this->once()) ->method('bundle') ->willReturn('basic'); - $entityStorage = $this->createMock(EntityStorageInterface::class); + $entityStorage = $this->createMock(RevisionableStorageInterface::class); $entityStorage->expects($this->exactly(2)) ->method('loadRevision') ->with(6)