public function GatherContentUploadTest::assertSelection in GatherContent 8.5
Check radio and checkbox selection value.
Parameters
array $value: Response value array.
\Drupal\Core\Field\FieldItemListInterface $itemList: Item list.
2 calls to GatherContentUploadTest::assertSelection()
- GatherContentUploadTest::assertItemChanged in gathercontent_upload/
tests/ src/ Kernel/ GatherContentUploadTest.php - Checks if all the fields are correctly set.
- GatherContentUploadTest::assertItemChangedMultilang in gathercontent_upload/
tests/ src/ Kernel/ GatherContentUploadTest.php - Checks if all the fields are correctly set for multilingual content.
File
- gathercontent_upload/
tests/ src/ Kernel/ GatherContentUploadTest.php, line 288
Class
- GatherContentUploadTest
- @coversDefaultClass \Drupal\gathercontent_upload\Export\Exporter @group gathercontent_upload
Namespace
Drupal\Tests\gathercontent_upload\KernelCode
public function assertSelection(array $value, FieldItemListInterface $itemList) {
$selected = $value[0]['id'];
$targets = $itemList
->getValue();
$target = array_shift($targets);
$term = Term::load($target['target_id']);
$checkbox_value = $term
->get('gathercontent_option_ids')
->getValue()[0]['value'];
$this
->assertEquals($checkbox_value, $selected);
}