You are here

public function GatherContentUploadTest::assertItemChangedMetatagMultilang in GatherContent 8.5

Checks if all the fields are correctly set for metatag content.

Parameters

array $content: Content array.

\Drupal\node\NodeInterface $entity: Node entity object.

1 call to GatherContentUploadTest::assertItemChangedMetatagMultilang()
GatherContentUploadTest::testProcessPanesMetatagMultilang in gathercontent_upload/tests/src/Kernel/GatherContentUploadTest.php
Tests field manipulation for metatag content.

File

gathercontent_upload/tests/src/Kernel/GatherContentUploadTest.php, line 255

Class

GatherContentUploadTest
@coversDefaultClass \Drupal\gathercontent_upload\Export\Exporter @group gathercontent_upload

Namespace

Drupal\Tests\gathercontent_upload\Kernel

Code

public function assertItemChangedMetatagMultilang(array $content, NodeInterface $entity) {
  foreach ($content as $id => $fieldValue) {
    switch ($id) {
      case 'be66d719-ae0e-4c31-ad57-9a07ba3b1aaf':
        $this
          ->assertEquals($entity
          ->getTitle(), $fieldValue);
        break;
      case '66da5837-604a-45d9-a72e-484cdd963076':
        $value = $entity
          ->get('body')
          ->getValue()[0]['value'];
        $this
          ->assertEquals($value, $fieldValue);
        break;
      case '836a5f14-f93e-47c7-9ec3-0ac511b104b8':
        $meta_value = unserialize($entity
          ->get('field_meta_alt')->value);
        $this
          ->assertEquals($meta_value['title'], $fieldValue);
        break;
      case '8ea8bea0-8a78-4a48-a04b-3d8ff6c8c568':
        $meta_value = unserialize($entity
          ->get('field_meta_alt')->value);
        $this
          ->assertEquals($meta_value['description'], $fieldValue);
        break;
    }
  }
}