[['id' => 'abcd1234', 'type' => 'heading', 'data' => ['text' => 'Hallo', 'level' => '2', 'align' => 'left']]]]; $b = ['blocks' => [['data' => ['align' => 'left', 'level' => '2', 'text' => 'Hallo'], 'type' => 'heading', 'id' => 'abcd1234']]]; $c = ['blocks' => [['id' => 'abcd1234', 'type' => 'heading', 'data' => ['text' => 'Anders', 'level' => '2', 'align' => 'left']]]]; $swapped = ['blocks' => array_reverse([...$a['blocks'], ...$c['blocks']])]; $this->assertTrue(Content::same($a, $b)); $this->assertFalse(Content::same($a, $c)); $this->assertFalse(Content::same(['blocks' => [...$a['blocks'], ...$c['blocks']]], $swapped), 'Die Reihenfolge von Blöcken zählt.'); } public function test_form_answers_follow_the_form_order(): void { $form = new Form(['fields' => [ ['type' => 'text', 'data' => ['label' => 'Name', 'key' => 'name']], ['type' => 'text', 'data' => ['label' => 'Abteilung', 'key' => 'abteilung']], ['type' => 'textarea', 'data' => ['label' => 'Begründung', 'key' => 'begruendung']], ]]); $submission = new FormSubmission(['data' => [ 'altfeld' => ['label' => 'Altes Feld', 'type' => 'text', 'value' => 'x'], 'begruendung' => ['label' => 'Begründung', 'type' => 'textarea', 'value' => 'weil'], 'name' => ['label' => 'Name', 'type' => 'text', 'value' => 'Anna'], 'abteilung' => ['label' => 'Abteilung', 'type' => 'text', 'value' => 'Pflege'], ]]); $submission->setRelation('form', $form); $this->assertSame(['name', 'abteilung', 'begruendung', 'altfeld'], array_keys($submission->orderedAnswers())); } }