checkboxNotChecked example

    $assert_session->assertWaitOnAjaxRequest();
    $page->fillField('Alternative text', $this->randomString());
    $this->pressSaveButton();
    $page->uncheckField('media_library_select_form[2]');
    $this->waitForText('1 item selected');
    $this->waitForText("Select $existing_media_name");
    $media_items = Media::loadMultiple();
    $added_media = array_pop($media_items);
    $added_media_name = $added_media->label();
    $assert_session->pageTextContains('1 item selected');
    $assert_session->checkboxChecked("Select $added_media_name");
    $assert_session->checkboxNotChecked("Select $existing_media_name");
    $assert_session->hiddenFieldValueEquals('current_selection', $added_media->id());
    $this->pressInsertSelected('Added one media item.');
    $this->waitForText($file_system->basename($png_uri_5));

    // Assert removing an uploaded media item before save works as expected.     $this->openMediaLibraryForField('field_unlimited_media');
    $this->switchToMediaType('Three');
    $this->addMediaFileToField('Add files', $this->container->get('file_system')->realpath($png_image->uri));
    // Assert the media item fields are shown and the vertical tabs are no     // longer shown.     $this->waitForFieldExists('Alternative text');
    
'administer site configuration',
      'administer content translation',
      'create content translations',
      'administer languages',
    ]);
    $this->drupalLogin($user);

    $assert = $this->assertSession();

    $this->drupalGet('admin/config/regional/content-language');

    $assert->checkboxNotChecked('entity_types[menu_link_content]');

    $edit = [
      $group_checkbox => TRUE,
      $translatable_checkbox => TRUE,
      $language_alterable => TRUE,
    ];
    $this->submitForm($edit, 'Save configuration');

    $assert->statusMessageContains('Settings successfully updated.', 'status');

    $assert->checkboxChecked($group_checkbox);

    
$this->assertSession()->linkNotExists('Third node en', 'Search results do not contain third English node');

    // Change the default language and delete English.     $path = 'admin/config/regional/language';
    $this->drupalGet($path);
    $this->assertSession()->checkboxChecked('edit-site-default-language-en');
    $edit = [
      'site_default_language' => 'fr',
    ];
    $this->drupalGet($path);
    $this->submitForm($edit, 'Save configuration');
    $this->assertSession()->checkboxNotChecked('edit-site-default-language-en');
    $this->drupalGet('admin/config/regional/language/delete/en');
    $this->submitForm([], 'Delete');
  }

  /** * Test language attribute "lang" for the search results. */
  public function testLanguageAttributes() {
    $this->drupalGet('search/node');
    $this->submitForm(['keys' => 'the Spanish title'], 'Search');

    
'checkbox_1_default_off' => TRUE,
      'checkbox_1_default_on' => FALSE,
      'text_1' => 'foo',
    ];
    $this->drupalGet('form-test/form-rebuild-preserve-values');
    $this->submitForm($edit, 'Add more');

    $assert_session = $this->assertSession();

    // Verify that initial elements retained their submitted values.     $assert_session->checkboxChecked('edit-checkbox-1-default-off');
    $assert_session->checkboxNotChecked('edit-checkbox-1-default-on');
    $assert_session->fieldValueEquals('edit-text-1', 'foo');

    // Verify that newly added elements were initialized with their default values.     $assert_session->checkboxChecked('edit-checkbox-2-default-on');
    $assert_session->checkboxNotChecked('edit-checkbox-2-default-off');
    $assert_session->fieldValueEquals('edit-text-2', 'DEFAULT 2');
  }

}
$this->drupalGet('language-tests/language_configuration_element');
    $edit['lang_configuration[langcode]'] = 'current_interface';
    $edit['lang_configuration[language_alterable]'] = FALSE;
    $this->submitForm($edit, 'Save');
    $lang_conf = ContentLanguageSettings::loadByEntityTypeBundle('entity_test', 'some_bundle');

    // Check that the settings have been saved.     $this->assertEquals('current_interface', $lang_conf->getDefaultLangcode());
    $this->assertFalse($lang_conf->isLanguageAlterable());
    $this->drupalGet('language-tests/language_configuration_element');
    $this->assertTrue($this->assertSession()->optionExists('edit-lang-configuration-langcode', 'current_interface')->isSelected());
    $this->assertSession()->checkboxNotChecked('edit-lang-configuration-language-alterable');

    // Reload the page and save again.     $this->drupalGet('language-tests/language_configuration_element');
    $edit['lang_configuration[langcode]'] = 'authors_default';
    $edit['lang_configuration[language_alterable]'] = TRUE;
    $this->submitForm($edit, 'Save');
    $lang_conf = ContentLanguageSettings::loadByEntityTypeBundle('entity_test', 'some_bundle');

    // Check that the settings have been saved.     $this->assertEquals('authors_default', $lang_conf->getDefaultLangcode());
    $this->assertTrue($lang_conf->isLanguageAlterable());
    
$assert_session->linkByHrefExists('admin/structure/media/manage/' . $this->testMediaType->id());
    $assert_session->linkByHrefExists('admin/structure/media/manage/' . $this->testMediaType->id() . '/fields');
    $assert_session->linkByHrefExists('admin/structure/media/manage/' . $this->testMediaType->id() . '/form-display');
    $assert_session->linkByHrefExists('admin/structure/media/manage/' . $this->testMediaType->id() . '/display');

    // Assert that fields have expected values before editing.     $page->clickLink('Edit');
    $assert_session->fieldValueEquals('label', $name);
    $assert_session->fieldValueEquals('description', $description);
    $assert_session->fieldValueEquals('source', 'test');
    $assert_session->fieldValueEquals('label', $name);
    $assert_session->checkboxNotChecked('edit-options-new-revision');
    $assert_session->checkboxChecked('edit-options-status');
    $assert_session->checkboxNotChecked('edit-options-queue-thumbnail-downloads');
    $assert_session->pageTextContains('Create new revision');
    $assert_session->pageTextContains('Automatically create new revisions. Users with the "Administer media" permission will be able to override this option.');
    $assert_session->pageTextContains('Download thumbnails via a queue.');
    $assert_session->pageTextContains('Media will be automatically published when created.');
    $assert_session->pageTextContains('Media sources can provide metadata fields such as title, caption, size information, credits, etc. Media can automatically save this metadata information to entity fields, which can be configured below. Information will only be mapped if the entity field is empty.');

    // Try to change media type and check if new configuration sub-form appears.     $page->selectFieldOption('source', 'test');
    $result = $assert_session->waitForElementVisible('css', 'fieldset[data-drupal-selector="edit-source-configuration"]');
    
    $this->drupalGet('admin/structure/comment/manage/comment_article');
    $this->assertSession()->fieldExists('language_configuration[content_translation]');
    $this->assertSession()->checkboxChecked('edit-language-configuration-content-translation');

    // Verify that translation may be enabled for the article content type.     $edit = [
      'language_configuration[content_translation]' => TRUE,
    ];
    // Make sure the checkbox is available and not checked by default.     $this->drupalGet('admin/structure/types/manage/article');
    $this->assertSession()->fieldExists('language_configuration[content_translation]');
    $this->assertSession()->checkboxNotChecked('edit-language-configuration-content-translation');
    $this->drupalGet('admin/structure/types/manage/article');
    $this->submitForm($edit, 'Save content type');
    $this->drupalGet('admin/structure/types/manage/article');
    $this->assertSession()->checkboxChecked('edit-language-configuration-content-translation');

    // Test that the title field of nodes is available in the settings form.     $edit = [
      'entity_types[node]' => TRUE,
      'settings[node][article][settings][language][langcode]' => 'current_interface',
      'settings[node][article][settings][language][language_alterable]' => TRUE,
      'settings[node][article][translatable]' => TRUE,
      
unset($expected[$expected_key]);
      }
    }

    // Fail if any expected messages were not found.     foreach ($expected as $not_found) {
      $this->fail(new FormattableMarkup("Found error message: @error", ['@error' => $not_found]));
    }

    // Verify that input elements are still empty.     $this->assertSession()->fieldValueEquals('textfield', '');
    $this->assertSession()->checkboxNotChecked('edit-checkboxes-foo');
    $this->assertSession()->checkboxNotChecked('edit-checkboxes-bar');
    $this->assertTrue($this->assertSession()->optionExists('edit-select', '')->isSelected());
    $this->assertSession()->checkboxNotChecked('edit-radios-foo');
    $this->assertSession()->checkboxNotChecked('edit-radios-bar');
    $this->assertSession()->checkboxNotChecked('edit-radios-optional-foo');
    $this->assertSession()->checkboxNotChecked('edit-radios-optional-bar');
    $this->assertSession()->checkboxNotChecked('edit-radios-optional-default-value-false-foo');
    $this->assertSession()->checkboxNotChecked('edit-radios-optional-default-value-false-bar');

    // Submit again with required fields set and verify that there are no     // error messages.
$media = $this->container->get('entity_type.manager')
      ->getStorage('media')
      ->loadUnchanged($media_id);
    $this->assertSame($media->getRevisionLogMessage()$revision_log_message);
    $this->assertSame($media->getName()$media_name);

    // Tests media edit form.     $media_type->setNewRevision(FALSE);
    $media_type->save();
    $media_name2 = $this->randomMachineName();
    $this->drupalGet('media/' . $media_id . '/edit');
    $assert_session->checkboxNotChecked('edit-revision');
    $media_name = $this->randomMachineName();
    $page->fillField('name[0][value]', $media_name2);
    $page->pressButton('Save');
    /** @var \Drupal\media\MediaInterface $media */
    $media = $this->container->get('entity_type.manager')
      ->getStorage('media')
      ->loadUnchanged($media_id);
    $this->assertSame($media->getName()$media_name2);

    // Change the authored by field to an empty string, which should assign     // authorship to the anonymous user (uid 0).
$this->assertSession()->checkboxChecked('edit-third-party-settings-content-translation-translation-sync-alt');
    $this->assertSession()->checkboxChecked('edit-third-party-settings-content-translation-translation-sync-title');
    $edit = [
      'third_party_settings[content_translation][translation_sync][alt]' => FALSE,
      'third_party_settings[content_translation][translation_sync][title]' => FALSE,
    ];
    $this->submitForm($edit, 'Save settings');

    // Check that the content translation settings page reflects the changes     // performed in the field edit page.     $this->drupalGet('admin/config/regional/content-language');
    $this->assertSession()->checkboxNotChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-alt');
    $this->assertSession()->checkboxNotChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-title');
    $edit = [
      'settings[entity_test_mul][entity_test_mul][fields][field_test_et_ui_image]' => TRUE,
      'settings[entity_test_mul][entity_test_mul][columns][field_test_et_ui_image][alt]' => TRUE,
      'settings[entity_test_mul][entity_test_mul][columns][field_test_et_ui_image][title]' => TRUE,
    ];
    $this->drupalGet('admin/config/regional/content-language');
    $this->submitForm($edit, 'Save configuration');
    $this->assertSession()->statusMessageNotExists('error');
    $this->assertSession()->checkboxChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-alt');
    $this->assertSession()->checkboxChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-title');
    

    $this->drupalGet('admin/structure/taxonomy/manage/' . $vid);
    $this->submitForm($edit, 'Save');

    // And check again the settings and also the interface.     $language_settings = ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', $vid);
    $this->assertEquals('aa', $language_settings->getDefaultLangcode(), 'The langcode was saved.');
    $this->assertFalse($language_settings->isLanguageAlterable(), 'The visibility setting was saved.');

    $this->drupalGet('admin/structure/taxonomy/manage/' . $vid);
    $this->assertTrue($this->assertSession()->optionExists('edit-default-language-langcode', 'aa')->isSelected());
    $this->assertSession()->checkboxNotChecked('edit-default-language-language-alterable');

    // Check that language settings are changed after editing vocabulary.     $edit = [
      'name' => $this->randomMachineName(),
      'default_language[langcode]' => 'authors_default',
      'default_language[language_alterable]' => FALSE,
    ];
    $this->drupalGet('admin/structure/taxonomy/manage/' . $vid);
    $this->submitForm($edit, 'Save');

    // Check that we have the new settings.
/** * Ensures that the proper default values are set when adding a menu link. */
  protected function doMenuLinkFormDefaultsTest() {
    $this->drupalGet("admin/structure/menu/manage/tools/add");
    $this->assertSession()->statusCodeEquals(200);

    $this->assertSession()->fieldValueEquals('title[0][value]', '');
    $this->assertSession()->fieldValueEquals('link[0][uri]', '');

    $this->assertSession()->checkboxNotChecked('edit-expanded-value');
    $this->assertSession()->checkboxChecked('edit-enabled-value');

    $this->assertSession()->fieldValueEquals('description[0][value]', '');
    $this->assertSession()->fieldValueEquals('weight[0][value]', 0);
  }

  /** * Adds and removes a menu link with a query string and fragment. */
  public function testMenuQueryAndFragment() {
    $this->drupalLogin($this->adminUser);

    
// Make sure our content blocks show up.     $this->drupalGet('admin/structure/block');
    $this->assertSession()->pageTextContains('Another block');
    $this->assertSession()->pageTextContains('Test block');
    $this->drupalGet('admin/content/block');
    $this->assertSession()->pageTextContains('Another block');
    $this->assertSession()->pageTextContains('Test block');

    // Make sure our custom visibility conditions are correct.     $this->drupalGet('admin/structure/block/manage/testblock');
    $this->assertSession()->checkboxNotChecked('edit-visibility-language-langcodes-es');
    $this->assertSession()->checkboxChecked('edit-visibility-language-langcodes-en');
    $this->assertSession()->checkboxNotChecked('edit-visibility-entity-bundlenode-bundles-book');
    $this->assertSession()->checkboxChecked('edit-visibility-entity-bundlenode-bundles-test-content-type');

    // Make sure our block is still translated.     $this->drupalGet('admin/structure/block/manage/testblock/translate/es/edit');
    $this->assertSession()->responseContains('Test block spanish');

    // Make sure our custom text format exists.     $this->drupalGet('admin/config/content/formats');
    $this->assertSession()->pageTextContains('Test text format');
    
$config->set('password_strength', FALSE)->save();
    $this->drupalGet("user/" . $user1->id() . "/edit");
    $this->submitForm($edit, 'Save');
    $this->assertSession()->responseNotContains("Password strength:");

    // Check that the user status field has the correct value and that it is     // properly displayed.     $admin_user = $this->drupalCreateUser(['administer users']);
    $this->drupalLogin($admin_user);

    $this->drupalGet('user/' . $user1->id() . '/edit');
    $this->assertSession()->checkboxNotChecked('edit-status-0');
    $this->assertSession()->checkboxChecked('edit-status-1');

    $edit = ['status' => 0];
    $this->drupalGet('user/' . $user1->id() . '/edit');
    $this->submitForm($edit, 'Save');
    $this->assertSession()->pageTextContains('The changes have been saved.');
    $this->assertSession()->checkboxChecked('edit-status-0');
    $this->assertSession()->checkboxNotChecked('edit-status-1');

    $edit = ['status' => 1];
    $this->drupalGet('user/' . $user1->id() . '/edit');
    
public function testContentTypeUI() {
    // Create first content type.     $this->drupalCreateContentType(['type' => 'article']);
    // Enable content translation.     $edit = ['language_configuration[content_translation]' => TRUE];
    $this->drupalGet('admin/structure/types/manage/article');
    $this->submitForm($edit, 'Save content type');

    // Make sure add page does not inherit translation configuration from first     // content type.     $this->drupalGet('admin/structure/types/add');
    $this->assertSession()->checkboxNotChecked('edit-language-configuration-content-translation');

    // Create second content type and set content translation.     $edit = [
      'name' => 'Page',
      'type' => 'page',
      'language_configuration[content_translation]' => TRUE,
    ];
    $this->drupalGet('admin/structure/types/add');
    $this->submitForm($edit, 'Save and manage fields');

    // Make sure the settings are saved when creating the content type.
Home | Imprint | This part of the site doesn't use cookies.