getMink example


  public function formLogin($username$password$working_dir = NULL) {
    $this->visit('/user/login', $working_dir);
    $assert = $this->getMink()->assertSession();
    $assert->statusCodeEquals(200);
    $assert->fieldExists('edit-name')->setValue($username);
    $assert->fieldExists('edit-pass')->setValue($password);
    $session = $this->getMink()->getSession();
    $session->getPage()->findButton('Log in')->submit();
  }

}
if (version_compare($sqlite, Tasks::SQLITE_MINIMUM_VERSION) < 0) {
      $this->markTestSkipped();
    }

    $this->copyCodebase();
    $this->executeCommand('COMPOSER_DISCARD_CHANGES=true composer install --no-dev --no-interaction');
    $this->assertErrorOutputContains('Generating autoload files');
    $this->installQuickStart('minimal');
    $this->formLogin($this->adminUsername, $this->adminPassword);
    $this->visit('/.well-known/change-password');
    $this->assertDrupalVisit();
    $url = $this->getMink()->getSession()->getCurrentUrl();
    $this->assertEquals('http://localhost:' . $this->getPortNumber() . '/user/1/edit', $url);
  }

}
self::assertArrayHasKey('generator', $info);
    self::assertEquals('starterkit_theme:9.4.0', $info['generator']);

    // Confirm readme is rewritten.     $readme_file = $this->getWorkspaceDirectory() . "/$theme_path_relative/README.md";
    $this->assertSame('test_custom_theme theme, generated from starterkit_theme. Additional information on generating themes can be found in the [Starterkit documentation](https://www.drupal.org/docs/core-modules-and-themes/core-themes/starterkit-theme).', file_get_contents($readme_file));

    // Ensure that the generated theme can be installed.     $this->installQuickStart('minimal');
    $this->formLogin($this->adminUsername, $this->adminPassword);
    $this->visit('/admin/appearance');
    $this->getMink()->assertSession()->pageTextContains('Test custom starterkit');
    $this->getMink()->assertSession()->pageTextContains('Custom theme generated from a starterkit theme');
    $this->getMink()->getSession()->getPage()->clickLink('Install "Test custom starterkit theme" theme');
    $this->getMink()->assertSession()->pageTextContains('The "Test custom starterkit theme" theme has been installed.');

    // Ensure that a new theme cannot be generated when the destination     // directory already exists.     $theme_path_absolute = $this->getWorkspaceDirectory() . "/$theme_path_relative";
    $this->assertFileExists($theme_path_absolute . '/test_custom_theme.theme');
    unlink($theme_path_absolute . '/test_custom_theme.theme');
    $process = $this->generateThemeFromStarterkit();
    $result = $process->run();
    
$this->commandProcess->run();
    return $this->commandProcess;
  }

  /** * Helper function to assert that the last visit was a Drupal site. * * This method asserts that the X-Generator header shows that the site is a * Drupal site. */
  public function assertDrupalVisit() {
    $this->getMink()->assertSession()->responseHeaderMatches('X-Generator', '/Drupal \d+ \(https:\/\/www.drupal.org\)/');
  }

  /** * Visit a URI on the HTTP server. * * The concept here is that there could be multiple potential docroots in the * workspace, so you can use whichever ones you want. * * @param string $request_uri * (optional) The non-host part of the URL. Example: /some/path?foo=bar. * Defaults to visiting the homepage. * @param string $working_dir * (optional) Relative path within the test workspace file system that will * be the docroot for the request. Defaults to the workspace directory. * * @return \Behat\Mink\Mink * The Mink object. Perform assertions against this. * * @throws \InvalidArgumentException * Thrown when $request_uri does not start with a slash. */
Home | Imprint | This part of the site doesn't use cookies.