public function GatherContentUploadTest::assertItemChangedMultilang in GatherContent 8.5
Checks if all the fields are correctly set for multilingual content.
Parameters
array $content: Content array.
\Drupal\node\NodeInterface $entity: Node entity object.
1 call to GatherContentUploadTest::assertItemChangedMultilang()
- GatherContentUploadTest::testProcessGroupsMultilang in gathercontent_upload/
tests/ src/ Kernel/ GatherContentUploadTest.php - Tests field manipulation for multilingual content.
File
- gathercontent_upload/
tests/ src/ Kernel/ GatherContentUploadTest.php, line 105
Class
- GatherContentUploadTest
- @coversDefaultClass \Drupal\gathercontent_upload\Export\Exporter @group gathercontent_upload
Namespace
Drupal\Tests\gathercontent_upload\KernelCode
public function assertItemChangedMultilang(array $content, NodeInterface $entity) {
foreach ($content as $id => $fieldValue) {
switch ($id) {
case 'a91274c7-d273-4bad-82e4-caacc2175285':
$this
->assertEquals($entity
->getTranslation('en')
->getTitle(), $fieldValue);
break;
case '97c8625d-e304-44ec-a610-c7f193330fc8':
$value = $entity
->getTranslation('en')
->get('body')
->getValue()[0]['value'];
$this
->assertEquals($value, $fieldValue);
break;
case '20a410c9-28ba-44d4-a2e7-907b935da5fa':
$radio = $entity
->getTranslation('en')
->get('field_radio');
$this
->assertSelection($fieldValue, $radio);
break;
case '8fb45eed-3453-4d29-8977-2a7c9d982c5e':
$checkbox = $entity
->getTranslation('en')
->get('field_tags');
$this
->assertSelection($fieldValue, $checkbox);
break;
case '25e99975-d918-4cc3-a676-500d839a14c5':
$paragraph = $entity
->getTranslation('en')
->get('field_para');
$this
->assertParagraphText($fieldValue, $paragraph);
break;
case '215538c7-ec2e-41d6-a433-c23d46bf1e60':
$paragraph = $entity
->getTranslation('en')
->get('field_para');
$this
->assertParagraphText($fieldValue, $paragraph, TRUE);
break;
case 'f00dad7a-8429-4939-8014-498d5a4f41bd':
$value = $entity
->getTranslation('en')
->get('field_guidodo')
->getValue()[0]['value'];
$this
->assertNotEquals($value, $fieldValue);
break;
case 'beb19611-0685-483b-b409-7a47e696eb4b':
$this
->assertEquals($entity
->getTranslation('hu')
->getTitle(), $fieldValue);
break;
case 'c3dc73e4-1614-4f56-a09b-997664bd00f4':
$value = $entity
->getTranslation('hu')
->get('body')
->getValue()[0]['value'];
$this
->assertEquals($value, $fieldValue);
break;
case 'e33e4ada-a977-4c63-bfa5-df325f65e65d':
$radio = $entity
->getTranslation('hu')
->get('field_radio');
$this
->assertSelection($fieldValue, $radio);
break;
case '64896363-bd4a-4f54-9a82-fec9f0137a3d':
$checkbox = $entity
->getTranslation('hu')
->get('field_tags');
$this
->assertSelection($fieldValue, $checkbox);
break;
case 'e167651a-20ee-48cd-b4ac-5baaeae27c19':
$paragraph = $entity
->getTranslation('hu')
->get('field_para');
$this
->assertParagraphText($fieldValue, $paragraph, FALSE, TRUE);
break;
case '53295e60-dad8-430b-af3c-cc190eab4a39':
$paragraph = $entity
->getTranslation('hu')
->get('field_para');
$this
->assertParagraphText($fieldValue, $paragraph, TRUE, TRUE);
break;
case '81b210c6-b1fb-444f-a320-db58836b68de':
$value = $entity
->getTranslation('hu')
->get('field_guidodo')
->getValue()[0]['value'];
$this
->assertNotEquals($value, $fieldValue);
break;
case '715695f8-07db-4c5e-926f-bcec64412430':
case '2859eea4-5aff-4eab-9fcb-88120deea6cc':
case '135e837c-a9dd-4079-9b95-ce49a3b94cce':
case 'cb711089-9121-4257-8927-b1577d6e59e9':
// Image upload is not implemented yet.
break;
}
}
}