BrowserKitDriver example

// Our stand-in for the Guzzle client object.     $expected = new \stdClass();

    $browserkit_client = $this->getMockBuilder(DrupalTestBrowser::class)
      ->onlyMethods(['getClient'])
      ->getMockForAbstractClass();
    $browserkit_client->expects($this->once())
      ->method('getClient')
      ->willReturn($expected);

    // Because the driver is a BrowserKitDriver, we'll get back a client.     $driver = new BrowserKitDriver($browserkit_client);
    $btb = $this->mockBrowserTestBaseWithDriver($driver);

    $ref_gethttpclient = new \ReflectionMethod($btb, 'getHttpClient');

    $this->assertSame(get_class($expected)get_class($ref_gethttpclient->invoke($btb)));
  }

  /** * @covers ::getHttpClient */
  public function testGetHttpClientException() {
    
return $full_path;
  }

  /** * Set up the Mink session manager. * * @return \Behat\Mink\Session */
  protected function initMink() {
    $client = new DrupalTestBrowser();
    $client->followMetaRefresh(TRUE);
    $driver = new BrowserKitDriver($client);
    $session = new Session($driver);
    $this->mink = new Mink();
    $this->mink->registerSession('default', $session);
    $this->mink->setDefaultSessionName('default');
    $session->start();
    return $session;
  }

  /** * Get the Mink instance. * * Use the Mink object to perform assertions against the content returned by a * request. * * @return \Behat\Mink\Mink * The Mink object. */
Home | Imprint | This part of the site doesn't use cookies.