pageTextNotContains example

$extensions = 'foo ' . $this->imageExtension;
    // Now tell file_save_upload() to allow the extension of our test image.     $edit = [
      'file_test_replace' => FileSystemInterface::EXISTS_REPLACE,
      'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()),
      'extensions' => $extensions,
    ];

    $this->drupalGet('file-test/upload');
    $this->submitForm($edit, 'Submit');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSession()->pageTextNotContains("Only files with the following extensions are allowed:");
    $this->assertSession()->pageTextContains("You WIN!");

    // Check that the correct hooks were called.     $this->assertFileHooksCalled(['validate', 'load', 'update']);

    // Reset the hook counters.     file_test_reset();

    // Now tell file_save_upload() to allow any extension.     $edit = [
      'file_test_replace' => FileSystemInterface::EXISTS_REPLACE,
      
    $block->getPlugin()->setConfigurationValue('block_count', 2);
    $block->save();

    $this->drupalGet('');
    // We expect only the 2 most recent forum topics to appear in the "New forum     // topics" block.     for ($index = 0; $index < 5; $index++) {
      if (in_array($index[3, 4])) {
        $this->assertSession()->linkExists($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "New forum topics" block.', ['@topic' => $topics[$index]]));
      }
      else {
        $this->assertSession()->pageTextNotContains($topics[$index]);
      }
    }
  }

  /** * Tests the "Active forum topics" block. */
  public function testActiveForumTopicsBlock() {
    $this->drupalLogin($this->adminUser);

    // Create 10 forum topics.
public function drupalGetAuthorizePHP($page_title = 'system-test-auth') {
    $this->drupalGet('system-test/authorize-init/' . $page_title);
  }

  /** * Tests the FileTransfer hooks. */
  public function testFileTransferHooks() {
    $page_title = $this->randomMachineName(16);
    $this->drupalGetAuthorizePHP($page_title);
    $this->assertSession()->titleEquals("$page_title | Drupal");
    $this->assertSession()->pageTextNotContains('It appears you have reached this page in error.');
    $this->assertSession()->pageTextContains('To continue, provide your server connection details');
    // Make sure we see the new connection method added by system_test.     $this->assertSession()->pageTextContains('System Test FileTransfer');
    // Make sure the settings form callback works.     $this->assertSession()->pageTextContains('System Test Username');
    // Test that \Drupal\Core\Render\BareHtmlPageRenderer adds assets as     // expected to the first page of the authorize.php script.     $this->assertSession()->responseContains('core/misc/states.js');
  }

}
$this->click('.tabledrag-toggle-weight');
        $page->selectFieldOption('filters[media_embed][weight]', $media_embed);
      }
    }
    if (!empty($allowed_html)) {
      $page->clickLink('Limit allowed HTML tags and correct faulty HTML');
      $page->fillField('filters[filter_html][settings][allowed_html]', $allowed_html);
    }
    $page->pressButton('Save configuration');

    if ($expected_error_message) {
      $this->assertSession()->pageTextNotContains('Added text format Another test format.');
      $this->assertSession()->pageTextContains($expected_error_message);
    }
    else {
      $this->assertSession()->pageTextContains('Added text format Another test format.');
    }
  }

  /** * @covers ::media_form_filter_format_edit_form_alter * @dataProvider providerTestValidations */
  
/** * Tests that all the numbers can be searched. */
  public function testNumberSearching() {
    for ($i = 0; $i < count($this->numbers)$i++) {
      $node = $this->nodes[$i];

      // Verify that the node title does not appear on the search page       // with a dummy search.       $this->drupalGet('search/node');
      $this->submitForm(['keys' => 'foo'], 'Search');
      $this->assertSession()->pageTextNotContains($node->label());

      // Now verify that we can find node i by searching for any of the       // numbers.       for ($j = 0; $j < count($this->numbers)$j++) {
        $number = $this->numbers[$j];
        // If the number is negative, remove the - sign, because - indicates         // "not keyword" when searching.         $number = ltrim($number, '-');

        $this->drupalGet('search/node');
        $this->submitForm(['keys' => $number], 'Search');
        
// Create another block with no instances, and test we don't get a     // confirmation message about deleting instances.     $edit3 = [];
    $edit3['info[0][value]'] = $this->randomMachineName(8);
    $body = $this->randomMachineName(16);
    $edit3['body[0][value]'] = $body;
    $this->drupalGet('block/add/basic');
    $this->submitForm($edit3, 'Save');

    // Show the delete confirm form.     $this->drupalGet('admin/content/block/3/delete');
    $this->assertSession()->pageTextNotContains('This will also remove');
  }

  /** * Tests placed content blocks create a dependency in the block placement. */
  public function testConfigDependencies() {
    $block = $this->createBlockContent();
    // Place the block.     $block_placement_id = mb_strtolower($block->label());
    $instance = [
      'id' => $block_placement_id,
      
$style = $view->display_handler->getOption('style');
    $this->assertEquals('test_style', $style['type'], 'Make sure that the test_style got saved as used style plugin.');
    $this->assertEquals($random_name$style['options']['test_option'], 'Make sure that the custom settings field got saved as expected.');

    // Test that fields are working correctly in the UI for style plugins when     // a field row plugin is selected.     $this->drupalGet("admin/structure/views/view/{$view_name}/edit");
    $this->submitForm([], 'Add Page');
    $this->drupalGet("admin/structure/views/nojs/display/{$view_name}/page_1/row");
    $this->submitForm(['row[type]' => 'fields'], 'Apply');
    // If fields are being used this text will not be shown.     $this->assertSession()->pageTextNotContains('The selected style or row format does not use fields.');
  }

}
/** * Deletes a forum. * * @param int $tid * The forum ID. */
  public function deleteForum($tid) {
    // Delete the forum.     $this->drupalGet('admin/structure/forum/edit/forum/' . $tid);
    $this->clickLink('Delete');
    $this->assertSession()->pageTextContains('Are you sure you want to delete the forum');
    $this->assertSession()->pageTextNotContains('Add forum');
    $this->assertSession()->pageTextNotContains('Add forum container');
    $this->submitForm([], 'Delete');

    // Assert that the forum no longer exists.     $this->drupalGet('forum/' . $tid);
    $this->assertSession()->statusCodeEquals(404);
  }

  /** * Runs basic tests on the indicated user. * * @param \Drupal\Core\Session\AccountInterface $user * The logged in user. * @param bool $admin * User has 'access administration pages' privilege. */
    $this->assertSession()->buttonExists('Save and continue de');
    $this->translations['Save and continue'] = 'Save and continue de';

    // Check the language direction.     $this->assertSession()->elementTextEquals('xpath', '/@dir', 'ltr');

    // Verify that the distribution name appears.     $this->assertSession()->pageTextContains($this->info['distribution']['name']);
    // Verify that the requested theme is used.     $this->assertSession()->responseContains($this->info['distribution']['install']['theme']);
    // Verify that the "Choose profile" step does not appear.     $this->assertSession()->pageTextNotContains('profile');

    parent::setUpSettings();
  }

  /** * Confirms that the installation succeeded. */
  public function testInstalled() {
    $this->assertSession()->addressEquals('user/1');
    $this->assertSession()->statusCodeEquals(200);

    
    $account = $this->drupalCreateUser([]);
    $this->drupalLogin($account);
    // Load a real user object.     $user_storage->resetCache([$account->id()]);
    $account = $user_storage->load($account->id());

    // Create a node.     $node = $this->drupalCreateNode(['uid' => $account->id()]);

    // Attempt to cancel account.     $this->drupalGet('user/' . $account->id() . '/edit');
    $this->assertSession()->pageTextNotContains("Cancel account");

    // Attempt bogus account cancellation request confirmation.     $timestamp = $account->getLastLoginTime();
    $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account$timestamp));
    $this->assertSession()->statusCodeEquals(403);
    $user_storage->resetCache([$account->id()]);
    $account = $user_storage->load($account->id());
    $this->assertTrue($account->isActive(), 'User account was not canceled.');

    // Confirm user's content has not been altered.     $node_storage->resetCache([$node->id()]);
    
// Delete both fields.     $field_storage->delete();
    $field_storage2->delete();

    $this->drupalGet('admin/modules/uninstall');
    $this->assertSession()->pageTextContains('Uninstall');
    $this->assertSession()->pageTextContains('Fields pending deletion');
    $this->cronRun();
    $this->drupalGet('admin/modules/uninstall');
    $this->assertSession()->pageTextContains('Uninstall');
    $this->assertSession()->pageTextNotContains("The Telephone number field type is used in the following field: node.field_telephone");
    $this->assertSession()->pageTextNotContains('Fields pending deletion');
  }

}
$this->waitForElementTextContains('.js-media-library-view .js-pager__items > li:nth-of-type(2)', 'Page 2');
    $assert_session->elementExists('css', '.js-media-library-view .js-pager__items > li:nth-of-type(1) a');
    $assert_session->elementNotExists('css', '.js-media-library-view .js-pager__items > li:nth-of-type(2) a');
    $this->assertCount(1, $this->getCheckboxes());
    $page->clickLink('Previous page');
    $this->waitForElementTextContains('.js-media-library-view .js-pager__items > li:nth-of-type(1)', 'Page 1');
    $this->assertCount(24, $this->getCheckboxes());

    $page->checkField('Select Bear');
    $this->pressInsertSelected('Added one media item.');
    $assert_session->pageTextContains('Bear');
    $assert_session->pageTextNotContains('Cat');
    $assert_session->pageTextNotContains('Turtle');

    $this->openMediaLibraryForField('field_unlimited_media');
    $this->switchToMediaLibraryTable();

    // Assert the 'Apply filter' button is not moved to the button pane.     $assert_session->buttonExists('Insert selected', $button_pane);
    $assert_session->buttonNotExists('Apply filters', $button_pane);
    $assert_session->pageTextContains('Dog');
    $assert_session->pageTextContains('Bear');
    $assert_session->pageTextNotContains('Turtle');

    
$this->assertSame($this->webUser->id()$node->getOwner()->id());
  }

  /** * Tests the node meta information. */
  public function testNodeMetaInformation() {
    // Check that regular users (i.e. without the 'administer nodes' permission)     // can not see the meta information.     $this->drupalLogin($this->webUser);
    $this->drupalGet('node/add/page');
    $this->assertSession()->pageTextNotContains('Not saved yet');

    // Create node to edit.     $edit['title[0][value]'] = $this->randomMachineName(8);
    $edit['body[0][value]'] = $this->randomMachineName(16);
    $this->submitForm($edit, 'Save');

    $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
    $this->drupalGet("node/" . $node->id() . "/edit");
    $this->assertSession()->pageTextNotContains('Published');
    $this->assertSession()->pageTextNotContains($this->container->get('date.formatter')->format($node->getChangedTime(), 'short'));

    
    $this->drupalLogin($author);
    $this->drupalGet($media_parent->toUrl());
    $this->assertCacheContext('user');
    $assert_session->pageTextContains($child_title);

    // Other users with the 'view own unpublished media' permission should not     // be able to see the unpublished child media item. The 'user' cache context     // should be added in this case.     $this->drupalLogin($other_user);
    $this->drupalGet($media_parent->toUrl());
    $this->assertCacheContext('user');
    $assert_session->pageTextNotContains($child_title);

    // User with just the 'view media' permission should not be able to see the     // child media item. The 'user' cache context should not be added in this     // case.     $this->drupalLogin($view_user);
    $this->drupalGet($media_parent->toUrl());
    $this->assertNoCacheContext('user');
    $assert_session->pageTextNotContains($child_title);
  }

}
/** * Tests installing experimental modules and dependencies in the UI. */
  public function testExperimentalConfirmForm(): void {
    // First, test installing a non-experimental module with no dependencies.     // There should be no confirmation form and no experimental module warning.     $edit = [];
    $edit["modules[test_page_test][enable]"] = TRUE;
    $this->drupalGet('admin/modules');
    $this->submitForm($edit, 'Install');
    $this->assertSession()->pageTextContains('Module Test page has been enabled.');
    $this->assertSession()->pageTextNotContains('Experimental modules are provided for testing purposes only.');

    // There should be no warning about enabling experimental or deprecated     // modules, since there's no confirmation form.     $this->assertSession()->pageTextNotContains('Are you sure you wish to enable ');

    // Uninstall the module.     \Drupal::service('module_installer')->uninstall(['test_page_test']);

    // Next, test installing an experimental module with no dependencies.     // There should be a confirmation form with an experimental warning, but no     // list of dependencies.
Home | Imprint | This part of the site doesn't use cookies.