addressEquals example

    // page).     $edit_href = 'admin/structure/views/view/glossary';
    $this->drupalGet('admin/structure/views');
    // @todo Disabled default views do now appear on the front page. Test this     // behavior with templates instead.     // $this->assertSession()->linkByHrefNotExists($edit_href);
    // Enable the view, and make sure it is now visible on the main listing     // page.     $this->drupalGet('admin/structure/views');
    $this->clickViewsOperationLink('Enable', '/glossary/');
    $this->assertSession()->addressEquals('admin/structure/views');
    $this->assertSession()->linkByHrefExists($edit_href);

    // It should not be possible to revert the view yet.     // @todo Figure out how to handle this with the new configuration system.     // $this->assertSession()->linkNotExists('Revert');     // $revert_href = 'admin/structure/views/view/glossary/revert';     // $this->assertSession()->linkByHrefNotExists($revert_href);
    // Edit the view and change the title. Make sure that the new title is     // displayed.     $new_title = $this->randomMachineName(16);
    
$message_insert = "$label1 configuration has been created.";
    $message_update = "$label2 configuration has been updated.";
    $message_delete = "The test configuration $label2 has been deleted.";

    // Create a configuration entity.     $edit = [
      'id' => $id,
      'label' => $label1,
    ];
    $this->drupalGet('admin/structure/config_test/add');
    $this->submitForm($edit, 'Save');
    $this->assertSession()->addressEquals('admin/structure/config_test');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSession()->pageTextContains($message_insert);
    $this->assertSession()->pageTextNotContains($message_update);
    $this->assertSession()->linkByHrefExists("admin/structure/config_test/manage/$id");

    // Update the configuration entity.     $edit = [
      'label' => $label2,
    ];
    $this->drupalGet("admin/structure/config_test/manage/{$id}");
    $this->submitForm($edit, 'Save');
    
'access toolbar',
    ]));

    $field_ui_prefix = 'admin/structure/types/manage/bundle_with_section_field';
    // From the manage display page, go to manage the layout.     $this->drupalGet("$field_ui_prefix/display/default");
    $this->submitForm(['layout[enabled]' => TRUE], 'Save');
    $assert_session->linkExists('Manage layout');
    $this->clickLink('Manage layout');
    // Save the defaults.     $page->pressButton('Save layout');
    $assert_session->addressEquals("$field_ui_prefix/display/default");

    // As the Layout Builder UI is typically displayed using the frontend theme,     // it is not marked as an administrative page at the route level even though     // it performs an administrative task, therefore, we need to verify that it     // behaves as such, redirecting out of the admin section.     // Clicking "Back to site" navigates to the homepage.     $this->drupalGet("$field_ui_prefix/display/default/layout");
    $this->clickLink('Back to site');
    $assert_session->addressEquals("/user/2");

    $this->drupalGet("$field_ui_prefix/display/default/layout/discard-changes");
    
$edit['info[0][value]'] = 'Test redirect destination';
    $edit['body[0][value]'] = $this->randomMachineName(16);
    $this->submitForm($edit, 'Save');

    // Check the block content is present in the view redirect destination.     $this->drupalGet('admin/content/redirect_destination');
    $this->assertSession()->pageTextContains('Test redirect destination');

    // Edit the created block and save.     $this->clickLink('Edit');
    $this->submitForm([], 'Save');
    $this->assertSession()->addressEquals('admin/content/redirect_destination');
  }

}
    $this->drupalLogin($this->drupalCreateUser());
    // After login, the client is redirected to /user.     $this->assertSession()->linkExists('My account', 0, "Page title of /user is 'My Account' in menus for registered users");
    $this->assertSession()->linkByHrefExists(\Drupal::urlGenerator()->generate('user.page'), 0);
  }

  /** * Ensures that logout URL redirects an anonymous user to the front page. */
  public function testAnonymousLogout() {
    $this->drupalGet('user/logout');
    $this->assertSession()->addressEquals('/');
    $this->assertSession()->statusCodeEquals(200);

    // The redirection shouldn't affect other pages.     $this->drupalGet('admin');
    $this->assertSession()->addressEquals('/admin');
    $this->assertSession()->statusCodeEquals(403);
  }

}
// Make sure the other revisions were not deleted.     foreach ($otherRevisionIds as $otherRevisionId) {
      $this->assertNotNull($storage->loadRevision($otherRevisionId));
    }

    // Destination.     if ($expectedDestination === 404) {
      $this->assertSession()->statusCodeEquals(404);
    }
    else {
      $this->assertSession()->statusCodeEquals(200);
      $this->assertSession()->addressEquals($expectedDestination);
    }

    // Logger log.     $logs = $this->getLogs($entity->getEntityType()->getProvider());
    $this->assertEquals([0 => $expectedLog]$logs);
    // Messenger message.     $this->assertSession()->pageTextContains($expectedMessage);
  }

  /** * Data provider for testSubmitForm. */
$this->assertFirstForm($session$expected);
      // Test that an undefined step to any form goes to the correct first form.       $store->delete('step');
      $this->assertFirstForm($session$expected);

      // For forms that require data from the private store, test that when that       // data is missing the correct first page is displayed.       // The Id conflict form requires the migrations array.       $store->delete('migrations');
      $store->set('step', 'idconflict');
      $this->drupalGet('/upgrade/idconflict');
      $session->addressEquals($expected);

      // The Review form requires version, migrations and system_data. Test       // three times with only one of the variables missing.       $store->delete('version');
      $store->set('migrations', ['foo', 'bar']);
      $store->set('system_data', ['bar', 'foo']);
      $store->set('step', 'review');
      $this->drupalGet('/upgrade/review');
      $session->addressEquals($expected);

      $store->set('version', '6');
      
$this->syncDirectory = $this->publicFilesDirectory . '/config_' . Crypt::randomBytesBase64() . '/sync';
    $this->settings['settings']['config_sync_directory'] = (object) [
      'value' => $this->syncDirectory,
      'required' => TRUE,
    ];
  }

  /** * Verifies that installation succeeded. */
  public function testInstaller() {
    $this->assertSession()->addressEquals('user/1');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertDirectoryExists($this->syncDirectory);
  }

}
    // alias.     $edit_new_translation = [
      'body[0][value]' => $this->randomMachineName(),
      'moderation_state[0][state]' => 'published',
      'path[0][alias]' => '/' . $this->randomMachineName(),
    ];
    $this->drupalGet('fr/node/' . $default_node->id() . '/edit');
    $this->submitForm($edit_new_translation, 'Save (this translation)');
    // Confirm that the new published revision was created.     $this->assertSession()->statusMessageNotContains('You can only change the URL alias for the published version of this content.');
    $this->assertSession()->pageTextContains($edit_new_translation['body[0][value]']);
    $this->assertSession()->addressEquals('fr' . $edit_new_translation['path[0][alias]']);
    $this->assertPathsAreAccessible([$default_path]);
  }

  /** * Helper callback to verify paths are responding with status 200. * * @param string[] $paths * An array of paths to check for. * * @internal */
  
/** * Tests the delete link on a views UI. */
  public function testDeleteLink() {
    $this->drupalGet('admin/structure/views/view/test_view');
    $this->assertSession()->linkExists('Delete view', 0, 'Ensure that the view delete link appears');

    $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view');
    $this->assertInstanceOf(View::class$view);
    $this->clickLink('Delete view');
    $this->assertSession()->addressEquals('admin/structure/views/view/test_view/delete');
    $this->submitForm([], 'Delete');
    $this->assertSession()->pageTextContains("The view {$view->label()} has been deleted.");

    $this->assertSession()->addressEquals('admin/structure/views');
    $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view');
    $this->assertNotInstanceOf(View::class$view);
  }

  /** * Tests the machine name and administrative comment forms. */
  
    $view = [];

    // Generate random label and id for new view.     $view['label'] = $this->randomMachineName(255);
    $view['id'] = strtolower($this->randomMachineName(128));

    // Duplicate view.     $this->drupalGet('admin/structure/views/view/' . $random_view['id'] . '/duplicate');
    $this->submitForm($view, 'Duplicate');

    // Assert that the page URL is correct.     $this->assertSession()->addressEquals('admin/structure/views/view/' . $view['id']);

    // Assert that the page title is correctly displayed.     $this->assertSession()->pageTextContains($view['label']);
  }

}
$session = $this->getSession();

    // The front page defaults to 'user/login', which redirects to 'user/{user}'     // for authenticated users. We cannot use '<front>', since this does not     // match the redirected URL.     $frontpage_url = 'user/' . $this->adminUser->id();

    $this->drupalGet('admin/compact/on');
    $this->assertSession()->statusCodeEquals(200);
    // Verify that the user is redirected to the front page after turning on     // compact mode.     $this->assertSession()->addressEquals($frontpage_url);
    $this->assertEquals('1', $session->getCookie('Drupal.visitor.admin_compact_mode'), 'Compact mode turns on.');
    $this->drupalGet('admin/compact/on');
    $this->assertEquals('1', $session->getCookie('Drupal.visitor.admin_compact_mode'), 'Compact mode remains on after a repeat call.');
    $this->drupalGet('');
    $this->assertEquals('1', $session->getCookie('Drupal.visitor.admin_compact_mode'), 'Compact mode persists on new requests.');

    $this->drupalGet('admin/compact/off');
    $this->assertSession()->statusCodeEquals(200);
    // Verify that the user is redirected to the front page after turning off     // compact mode.     $this->assertSession()->addressEquals($frontpage_url);
    
$this->drupalGet('admin/config/system/site-information');
    // Check translation tab exist.     $this->assertSession()->linkByHrefExists($translation_base_url);

    $this->drupalGet($translation_base_url);

    // Check that the 'Edit' link in the source language links back to the     // original form.     $this->clickLink('Edit');
    // Also check that saving the form leads back to the translation overview.     $this->submitForm([], 'Save configuration');
    $this->assertSession()->addressEquals($translation_base_url);

    // Check 'Add' link of French to visit add page.     $this->assertSession()->linkByHrefExists("$translation_base_url/fr/add");
    $this->clickLink('Add');

    // Make sure original text is present on this page.     $this->assertSession()->pageTextContains($site_name);
    $this->assertSession()->pageTextContains($site_slogan);

    // Update site name and slogan for French.     $edit = [
      
$this->assertSame($this->webUser->id()$comment->getOwnerId());

    $this->drupalLogout();

    // Reply to comment #2 creating comment #3 with optional preview and no     // subject though field enabled.     $this->drupalLogin($this->webUser);
    // Deliberately use the wrong URL to test     // \Drupal\comment\Controller\CommentController::redirectNode().     $this->drupalGet('comment/' . $this->node->id() . '/reply');
    // Verify we were correctly redirected.     $this->assertSession()->addressEquals(Url::fromRoute('comment.reply', ['entity_type' => 'node', 'entity' => $this->node->id(), 'field_name' => 'comment']));
    $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());
    $this->assertSession()->pageTextContains($subject_text);
    $this->assertSession()->pageTextContains($comment_text);
    $reply = $this->postComment(NULL, $this->randomMachineName(), '', TRUE);
    $reply_loaded = Comment::load($reply->id());
    $this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.');
    $this->assertEquals($comment->id()$reply_loaded->getParentComment()->id(), 'Pid of a reply to a comment is set correctly.');
    // Check the thread of reply grows correctly.     $this->assertEquals(rtrim($comment->getThread(), '/') . '.00/', $reply_loaded->getThread());

    // Second reply to comment #2 creating comment #4.
'access contextual links',
      'configure any layout',
      'administer node display',
      'administer node fields',
      'create and edit custom blocks',
    ]));

    // Enable layout builder.     $this->drupalGet(static::FIELD_UI_PREFIX . '/display/default');
    $this->submitForm(['layout[enabled]' => TRUE], 'Save');
    $this->clickLink('Manage layout');
    $assert_session->addressEquals(static::FIELD_UI_PREFIX . '/display/default/layout');
    // Add a basic block with the body field set.     $this->addInlineBlockToLayout('Block title', 'The DEFAULT block body');
    $this->assertSaveLayout();

    $this->drupalGet('node/1');
    $assert_session->pageTextContains('The DEFAULT block body');
    $this->drupalGet('node/2');
    $assert_session->pageTextContains('The DEFAULT block body');

    // Enable overrides.     $this->drupalGet(static::FIELD_UI_PREFIX . '/display/default');
    
Home | Imprint | This part of the site doesn't use cookies.