protected function ScheduledUpdatesTestBase::cloneFields in Scheduled Updates 8
Clone multiple fields on the Clone Field Page.
Parameters
$type_id:
array $fields:
Throws
\Exception
2 calls to ScheduledUpdatesTestBase::cloneFields()
- EmbeddedScheduledUpdateTypeTest::createType in tests/
src/ FunctionalJavascript/ EmbeddedScheduledUpdateTypeTest.php - Create a scheduled update type via the UI.
- ScheduledUpdatesTestBase::createType in tests/
src/ FunctionalJavascript/ ScheduledUpdatesTestBase.php
File
- tests/
src/ FunctionalJavascript/ ScheduledUpdatesTestBase.php, line 82 - Contains \Drupal\Tests\scheduled_updates\ScheduledUpdatesTestBase.
Class
- ScheduledUpdatesTestBase
- Define base class for Scheduled Updates Tests
Namespace
Drupal\Tests\scheduled_updates\FunctionalJavascriptCode
protected function cloneFields($type_id, array $fields) {
$this
->gotoURLIfNot("admin/config/workflow/scheduled-update-type/{$type_id}/clone-fields");
$edit = [];
foreach ($fields as $input_name => $field_info) {
// Check the field label exists.
$this
->assertSession()
->pageTextContains($field_info['label']);
// Add to post data.
$edit[$input_name] = $field_info['input_value'];
}
$this
->drupalPostForm(NULL, $edit, t('Clone Fields'));
if ($this->adminUser
->hasPermission('administer scheduled_update form display')) {
// Should be redirected to form display after cloning fields
$this
->assertUrl("admin/config/workflow/scheduled-update-type/{$type_id}/form-display");
$this
->checkFieldLabels($fields);
}
else {
// @todo Does it make any sense for admin to be able to add update types without Field UI permissions
// Enforce Field UI permissions to add scheduled update type?
$this
->assertSession()
->pageTextContains('You do not have permission to administer fields on Scheduled Updates.');
}
}