You are here

public function GatherContentUploadTest::assertItemChangedMetatag 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::assertItemChangedMetatag()
GatherContentUploadTest::testProcessPanesMetatag in gathercontent_upload/tests/src/Kernel/GatherContentUploadTest.php
Tests field manipulation for metatag content.

File

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

Class

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

Namespace

Drupal\Tests\gathercontent_upload\Kernel

Code

public function assertItemChangedMetatag(array $content, NodeInterface $entity) {
  foreach ($content as $id => $fieldValue) {
    switch ($id) {
      case 'c59b2682-e22a-413b-88d1-f63dfccb3e8b':
        $this
          ->assertEquals($entity
          ->getTitle(), $fieldValue);
        break;
      case '45a1ef4d-16c5-41a8-aafb-bdc0b5dffe3b':
        $value = $entity
          ->get('body')
          ->getValue()[0]['value'];
        $this
          ->assertEquals($value, $fieldValue);
        break;
      case '5188d4ef-d391-4286-baa4-667b103145fd':
        $meta_value = unserialize($entity
          ->get('field_meta_test')->value);
        $this
          ->assertEquals($meta_value['title'], $fieldValue);
        break;
      case 'ff93aedd-8add-413b-8313-23231f0045f8':
        $meta_value = unserialize($entity
          ->get('field_meta_test')->value);
        $this
          ->assertEquals($meta_value['description'], $fieldValue);
        break;
    }
  }
}