Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Added tests covering the 2 ways to instantiate the driver #40

Merged
merged 1 commit into from
May 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions tests/Behat/Mink/Driver/ExtraDriverTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Tests\Behat\Mink\Driver;

use Behat\Mink\Driver\GoutteDriver;

/**
* @group unit
*/
class ExtraDriverTest extends \PHPUnit_Framework_TestCase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should test that too into the MinkBrowserKitDriver too (that returned client is of correct type + it's matching the one we've given in constructor).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some extra tests for MinkBrowserKitDriver locally too (failing for now because they are expecting the changes done in other pending PRs). I will submit them as soon as the other PRs are merged

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
public function testInstantiateWithClient()
{
$client = $this->getMockBuilder('Behat\Mink\Driver\Goutte\Client')->disableOriginalConstructor()->getMock();
$client->expects($this->once())
->method('followRedirects')
->with(true);

$driver = new GoutteDriver($client);

$this->assertSame($client, $driver->getClient());
}

public function testInstantiateWithoutClient()
{
$driver = new GoutteDriver();

$this->assertInstanceOf('Behat\Mink\Driver\Goutte\Client', $driver->getClient());
}
}
2 changes: 1 addition & 1 deletion tests/Behat/Mink/Driver/GoutteDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Behat\Mink\Driver\GoutteDriver;

/**
* @group gouttedriver
* @group functional
*/
class GoutteDriverTest extends GeneralDriverTest
{
Expand Down