statusMessageNotExists example

// Check that special characters get handled correctly.     $this->assertSession()->statusMessageContains('This has " in the middle');
    $this->assertSession()->statusMessageContains('This has \' in the middle');
    $this->assertSession()->statusMessageContains('<em>This<span>markup will be</span> escaped</em>');
    $this->assertSession()->statusMessageContains('Peaches & cream');
    $this->assertSession()->statusMessageNotContains('Peaches &amp; cream');

    // Go to a new route that only has messages of type 'status'.     $this->drupalGet(Url::fromRoute('system_test.messenger_service'));
    // Test WebAssert::statusMessageNotExists().     $this->assertSession()->statusMessageNotExists('error');
    $this->assertSession()->statusMessageNotExists('warning');

    // Perform a few assertions that should fail. We can only call     // TestCase::expectException() once per test, so we make a few     // try/catch blocks.     $expected_failure_occurred = FALSE;
    try {
      $this->assertSession()->statusMessageContains('This message is not real');
    }
    catch (AssertionFailedError $e) {
      $expected_failure_occurred = TRUE;
    }
 'Apply to selected items');

    if ($warning_appears) {
      if ($action == 'node_publish_action') {
        $this->assertSession()->statusMessageContains(node_get_type_label($node) . ' content items were skipped as they are under moderation and may not be directly published.', 'warning');
      }
      else {
        $this->assertSession()->statusMessageContains(node_get_type_label($node) . ' content items were skipped as they are under moderation and may not be directly unpublished.', 'warning');
      }
    }
    else {
      $this->assertSession()->statusMessageNotExists('warning');
    }

    // Ensure after the action has run, the node matches the expected status.     $node = Node::load($node->id());
    $this->assertEquals($node->isPublished()$final_status);
  }

  /** * Test cases for ::testNodeStatusActions. * * @return array * An array of test cases. */
    // 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->drupalLogin($this->translator);

    $default_langcode = $this->langcodes[0];
    $langcode = $this->langcodes[1];

    // Populate the test entity with some random initial values.     $values = [
      'name' => $this->randomMachineName(),
      'user_id' => mt_rand(1, 128),
      
Home | Imprint | This part of the site doesn't use cookies.