You are here

public function GatherContentUploadTest::assertItemChanged in GatherContent 8.5

Checks if all the fields are correctly set.

Parameters

array $content: Content array.

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

1 call to GatherContentUploadTest::assertItemChanged()
GatherContentUploadTest::testProcessGroups in gathercontent_upload/tests/src/Kernel/GatherContentUploadTest.php
Tests the field manipulation.

File

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

Class

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

Namespace

Drupal\Tests\gathercontent_upload\Kernel

Code

public function assertItemChanged(array $content, NodeInterface $entity) {
  foreach ($content as $id => $fieldValue) {
    switch ($id) {
      case 'a9d89661-9d89-4c6d-86d3-353bfcf3214c':
        $this
          ->assertEquals($entity
          ->getTitle(), $fieldValue);
        break;
      case '9c7f806b-ff35-4ffa-9363-169770ac6e50':
        $value = $entity
          ->get('field_guidodo')
          ->getValue()[0]['value'];
        $this
          ->assertNotEquals($value, $fieldValue);
        break;
      case 'dc73c531-d911-4acc-9055-984a1aeca0cb':
        $radio = $entity
          ->get('field_radio');
        $this
          ->assertSelection($fieldValue, $radio);
        break;
      case '427bc71f-844d-4730-a5d2-5e87d03fdbf0':
        $value = $entity
          ->get('body')
          ->getValue()[0]['value'];
        $this
          ->assertEquals($value, $fieldValue);
        break;
      case '192775f3-354b-4884-bec9-0f4ecf153882':
        $checkbox = $entity
          ->get('field_tags_alt');
        $this
          ->assertSelection($fieldValue, $checkbox);
        break;
      case '361b0476-643e-41e7-97bb-a5065ad6fa1b':
        $paragraph = $entity
          ->get('field_para');
        $this
          ->assertParagraphText($fieldValue, $paragraph);
        break;
      case 'f88f8389-ad24-46ec-a669-6f293a07b4f7':
        $paragraph = $entity
          ->get('field_para');
        $this
          ->assertParagraphText($fieldValue, $paragraph, TRUE);
        break;
      case 'b11e3729-2a80-4f14-9842-87a4882fa190':
      case 'd8cbeeda-9cdf-4d3f-b94a-72a465a7cc46':

        // Not implemented yet!
        break;
    }
  }
}