Commit 74a8fc83 authored by webchick's avatar webchick
Browse files

Issue #2578815 by hussainweb: Upgrade behat/mink and behat/mink-goutte-driver

parent 5b5d4035
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "8c9fdf621ce53640f24b24749e59717c", "hash": "8c9fdf621ce53640f24b24749e59717c",
"content-hash": "f38613812a285c03a1a18458384fe0b1",
"packages": [ "packages": [
{ {
"name": "composer/installers", "name": "composer/installers",
...@@ -2196,21 +2195,24 @@ ...@@ -2196,21 +2195,24 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "behat/mink", "name": "behat/mink",
"version": "v1.6.1", "version": "v1.7.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/minkphp/Mink.git", "url": "https://github.com/minkphp/Mink.git",
"reference": "8b68523a339ec991bcd638b39dc8f04f808da88a" "reference": "6c129030ec2cc029905cf969a56ca8f087b2dfdf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/minkphp/Mink/zipball/8b68523a339ec991bcd638b39dc8f04f808da88a", "url": "https://api.github.com/repos/minkphp/Mink/zipball/6c129030ec2cc029905cf969a56ca8f087b2dfdf",
"reference": "8b68523a339ec991bcd638b39dc8f04f808da88a", "reference": "6c129030ec2cc029905cf969a56ca8f087b2dfdf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.1", "php": ">=5.3.1",
"symfony/css-selector": "~2.0" "symfony/css-selector": "~2.1"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
}, },
"suggest": { "suggest": {
"behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)",
...@@ -2221,7 +2223,7 @@ ...@@ -2221,7 +2223,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.6.x-dev" "dev-master": "1.7.x-dev"
} }
}, },
"autoload": { "autoload": {
...@@ -2247,40 +2249,41 @@ ...@@ -2247,40 +2249,41 @@
"testing", "testing",
"web" "web"
], ],
"time": "2015-02-04 17:02:06" "time": "2015-09-20 20:24:03"
}, },
{ {
"name": "behat/mink-browserkit-driver", "name": "behat/mink-browserkit-driver",
"version": "v1.2.0", "version": "v1.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/minkphp/MinkBrowserKitDriver.git", "url": "https://github.com/minkphp/MinkBrowserKitDriver.git",
"reference": "aed8f4a596b79014a75254c3e337511c33e38cbd" "reference": "da47df1593dac132f04d24e7277ef40d33d9f201"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/aed8f4a596b79014a75254c3e337511c33e38cbd", "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/da47df1593dac132f04d24e7277ef40d33d9f201",
"reference": "aed8f4a596b79014a75254c3e337511c33e38cbd", "reference": "da47df1593dac132f04d24e7277ef40d33d9f201",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"behat/mink": "~1.6@dev", "behat/mink": "~1.7@dev",
"php": ">=5.3.1", "php": ">=5.3.6",
"symfony/browser-kit": "~2.0", "symfony/browser-kit": "~2.3",
"symfony/dom-crawler": "~2.0" "symfony/dom-crawler": "~2.3"
}, },
"require-dev": { "require-dev": {
"silex/silex": "~1.2" "silex/silex": "~1.2",
"symfony/phpunit-bridge": "~2.7"
}, },
"type": "mink-driver", "type": "mink-driver",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.2.x-dev" "dev-master": "1.3.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"Behat\\Mink\\Driver": "src/" "Behat\\Mink\\Driver\\": "src/"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
...@@ -2302,20 +2305,20 @@ ...@@ -2302,20 +2305,20 @@
"browser", "browser",
"testing" "testing"
], ],
"time": "2014-09-26 11:35:19" "time": "2015-09-21 20:56:13"
}, },
{ {
"name": "behat/mink-goutte-driver", "name": "behat/mink-goutte-driver",
"version": "dev-master", "version": "v1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/minkphp/MinkGoutteDriver.git", "url": "https://github.com/minkphp/MinkGoutteDriver.git",
"reference": "cc5ce119b5a8e06662f634b35967aff0b0c7dfdd" "reference": "c8e254f127d6f2242b994afd4339fb62d471df3f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/c8e254f127d6f2242b994afd4339fb62d471df3f", "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/c8e254f127d6f2242b994afd4339fb62d471df3f",
"reference": "cc5ce119b5a8e06662f634b35967aff0b0c7dfdd", "reference": "c8e254f127d6f2242b994afd4339fb62d471df3f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -2324,10 +2327,13 @@ ...@@ -2324,10 +2327,13 @@
"fabpot/goutte": "~1.0.4|~2.0|~3.1", "fabpot/goutte": "~1.0.4|~2.0|~3.1",
"php": ">=5.3.1" "php": ">=5.3.1"
}, },
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "mink-driver", "type": "mink-driver",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.1.x-dev" "dev-master": "1.2.x-dev"
} }
}, },
"autoload": { "autoload": {
...@@ -2354,7 +2360,7 @@ ...@@ -2354,7 +2360,7 @@
"headless", "headless",
"testing" "testing"
], ],
"time": "2015-06-27 00:15:11" "time": "2015-09-21 21:31:11"
}, },
{ {
"name": "doctrine/instantiator", "name": "doctrine/instantiator",
...@@ -3544,7 +3550,7 @@ ...@@ -3544,7 +3550,7 @@
"symfony/psr-http-message-bridge": 0, "symfony/psr-http-message-bridge": 0,
"zendframework/zend-diactoros": 0, "zendframework/zend-diactoros": 0,
"behat/mink": 0, "behat/mink": 0,
"behat/mink-goutte-driver": 20, "behat/mink-goutte-driver": 0,
"mikey179/vfsstream": 0, "mikey179/vfsstream": 0,
"phpunit/phpunit": 0, "phpunit/phpunit": 0,
"symfony/css-selector": 0 "symfony/css-selector": 0
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
}, },
"require-dev": { "require-dev": {
"behat/mink": "~1.6", "behat/mink": "~1.6",
"behat/mink-goutte-driver": "dev-master#cc5ce119b5a8e06662f634b35967aff0b0c7dfdd", "behat/mink-goutte-driver": "~1.2",
"mikey179/vfsStream": "~1.2", "mikey179/vfsStream": "~1.2",
"phpunit/phpunit": "4.8.*", "phpunit/phpunit": "4.8.*",
"symfony/css-selector": "2.7.*" "symfony/css-selector": "2.7.*"
......
language: php language: php
sudo: false
php: [5.3, 5.4, 5.5, 5.6, hhvm] php: [5.3, 5.4, 5.5, 5.6, hhvm]
matrix: matrix:
...@@ -9,12 +11,17 @@ matrix: ...@@ -9,12 +11,17 @@ matrix:
- php: 5.5 - php: 5.5
env: SYMFONY_VERSION='2.5.*@dev' env: SYMFONY_VERSION='2.5.*@dev'
before_script: cache:
directories:
- $HOME/.composer/cache/files
before_install:
- sh -c 'if [ "$SYMFONY_VERSION" != "" ]; then composer require -n --no-update symfony/symfony=$SYMFONY_VERSION; fi;' - sh -c 'if [ "$SYMFONY_VERSION" != "" ]; then composer require -n --no-update symfony/symfony=$SYMFONY_VERSION; fi;'
- composer install -n --prefer-source
install:
- composer install -n
script: phpunit -v --coverage-clover=coverage.clover script: phpunit -v --coverage-clover=coverage.clover
after_script: after_script:
- wget https://scrutinizer-ci.com/ocular.phar - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
1.3.0 / 2015-09-21
==================
BC break:
* Dropped support for Symfony 2.2 and older
* Bumped required PHP version to 5.3.6
New features:
* Updated the driver to use findElementsXpaths for Mink 1.7 and forward compatibility with Mink 2
Bug fixes:
* Improved the exception message when clicking on an invalid element
* Use `saveHTML` to get correct HTML code back
Misc:
* Updated the repository structure to PSR-4
1.2.0 / 2014-09-26 1.2.0 / 2014-09-26
================== ==================
......
...@@ -4,9 +4,9 @@ Mink BrowserKit Driver ...@@ -4,9 +4,9 @@ Mink BrowserKit Driver
[![Latest Stable Version](https://poser.pugx.org/behat/mink-browserkit-driver/v/stable.png)](https://packagist.org/packages/behat/mink-browserkit-driver) [![Latest Stable Version](https://poser.pugx.org/behat/mink-browserkit-driver/v/stable.png)](https://packagist.org/packages/behat/mink-browserkit-driver)
[![Latest Unstable Version](https://poser.pugx.org/behat/mink-browserkit-driver/v/unstable.svg)](https://packagist.org/packages/behat/mink-browserkit-driver) [![Latest Unstable Version](https://poser.pugx.org/behat/mink-browserkit-driver/v/unstable.svg)](https://packagist.org/packages/behat/mink-browserkit-driver)
[![Total Downloads](https://poser.pugx.org/behat/mink-browserkit-driver/downloads.png)](https://packagist.org/packages/behat/mink-browserkit-driver) [![Total Downloads](https://poser.pugx.org/behat/mink-browserkit-driver/downloads.png)](https://packagist.org/packages/behat/mink-browserkit-driver)
[![Build Status](https://travis-ci.org/Behat/MinkBrowserKitDriver.svg?branch=master)](https://travis-ci.org/Behat/MinkBrowserKitDriver) [![Build Status](https://travis-ci.org/minkphp/MinkBrowserKitDriver.svg?branch=master)](https://travis-ci.org/minkphp/MinkBrowserKitDriver)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/Behat/MinkBrowserKitDriver/badges/quality-score.png?s=0443d284940e099ea560eb39b6b2fcdc5d4e7f29)](https://scrutinizer-ci.com/g/Behat/MinkBrowserKitDriver/) [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/minkphp/MinkBrowserKitDriver/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/minkphp/MinkBrowserKitDriver/)
[![Code Coverage](https://scrutinizer-ci.com/g/Behat/MinkBrowserKitDriver/badges/coverage.png?s=48960c4495488ab0b7d310b62322f017497f5bfa)](https://scrutinizer-ci.com/g/Behat/MinkBrowserKitDriver/) [![Code Coverage](https://scrutinizer-ci.com/g/minkphp/MinkBrowserKitDriver/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/minkphp/MinkBrowserKitDriver/)
[![License](https://poser.pugx.org/behat/mink-browserkit-driver/license.svg)](https://packagist.org/packages/behat/mink-browserkit-driver) [![License](https://poser.pugx.org/behat/mink-browserkit-driver/license.svg)](https://packagist.org/packages/behat/mink-browserkit-driver)
Usage Example Usage Example
...@@ -50,5 +50,5 @@ $> php composer.phar install ...@@ -50,5 +50,5 @@ $> php composer.phar install
Maintainers Maintainers
----------- -----------
* Konstantin Kudryashov [everzet](http://github.com/everzet) * Christophe Coevoet [stof](https://github.com/stof)
* Other [awesome developers](https://github.com/Behat/MinkBrowserKitDriver/graphs/contributors) * Other [awesome developers](https://github.com/minkphp/MinkBrowserKitDriver/graphs/contributors)
...@@ -15,19 +15,20 @@ ...@@ -15,19 +15,20 @@
], ],
"require": { "require": {
"php": ">=5.3.1", "php": ">=5.3.6",
"behat/mink": "~1.6@dev", "behat/mink": "~1.7@dev",
"symfony/browser-kit": "~2.0", "symfony/browser-kit": "~2.3",
"symfony/dom-crawler": "~2.0" "symfony/dom-crawler": "~2.3"
}, },
"require-dev": { "require-dev": {
"symfony/phpunit-bridge": "~2.7",
"silex/silex": "~1.2" "silex/silex": "~1.2"
}, },
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"Behat\\Mink\\Driver": "src/" "Behat\\Mink\\Driver\\": "src/"
} }
}, },
...@@ -39,7 +40,7 @@ ...@@ -39,7 +40,7 @@
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.2.x-dev" "dev-master": "1.3.x-dev"
} }
} }
} }
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<filter> <filter>
<whitelist> <whitelist>
<directory>./src/Behat/Mink/Driver</directory> <directory>./src</directory>
</whitelist> </whitelist>
</filter> </filter>
</phpunit> </phpunit>
...@@ -10,13 +10,10 @@ ...@@ -10,13 +10,10 @@
namespace Behat\Mink\Driver; namespace Behat\Mink\Driver;
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\DriverException; use Behat\Mink\Exception\DriverException;
use Behat\Mink\Exception\UnsupportedDriverActionException; use Behat\Mink\Exception\UnsupportedDriverActionException;
use Behat\Mink\Session;
use Symfony\Component\BrowserKit\Client; use Symfony\Component\BrowserKit\Client;
use Symfony\Component\BrowserKit\Cookie; use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\BrowserKit\Request;
use Symfony\Component\BrowserKit\Response; use Symfony\Component\BrowserKit\Response;
use Symfony\Component\DomCrawler\Crawler; use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\DomCrawler\Field\ChoiceFormField; use Symfony\Component\DomCrawler\Field\ChoiceFormField;
...@@ -25,8 +22,6 @@ ...@@ -25,8 +22,6 @@
use Symfony\Component\DomCrawler\Field\InputFormField; use Symfony\Component\DomCrawler\Field\InputFormField;
use Symfony\Component\DomCrawler\Field\TextareaFormField; use Symfony\Component\DomCrawler\Field\TextareaFormField;
use Symfony\Component\DomCrawler\Form; use Symfony\Component\DomCrawler\Form;
use Symfony\Component\HttpFoundation\Request as HttpFoundationRequest;
use Symfony\Component\HttpFoundation\Response as HttpFoundationResponse;
use Symfony\Component\HttpKernel\Client as HttpKernelClient; use Symfony\Component\HttpKernel\Client as HttpKernelClient;
/** /**
...@@ -36,7 +31,6 @@ ...@@ -36,7 +31,6 @@
*/ */
class BrowserKitDriver extends CoreDriver class BrowserKitDriver extends CoreDriver
{ {
private $session;
private $client; private $client;
/** /**
...@@ -74,14 +68,6 @@ public function getClient() ...@@ -74,14 +68,6 @@ public function getClient()
return $this->client; return $this->client;
} }
/**
* {@inheritdoc}
*/
public function setSession(Session $session)
{
$this->session = $session;
}
/** /**
* Tells driver to remove hostname from URL. * Tells driver to remove hostname from URL.
* *
...@@ -164,19 +150,7 @@ public function visit($url) ...@@ -164,19 +150,7 @@ public function visit($url)
*/ */
public function getCurrentUrl() public function getCurrentUrl()
{ {
if (method_exists($this->client, 'getInternalRequest')) { $request = $this->client->getInternalRequest();
$request = $this->client->getInternalRequest();
} else {
// BC layer for BrowserKit 2.2.x and older
$request = $this->client->getRequest();
if (null !== $request && !$request instanceof Request && !$request instanceof HttpFoundationRequest) {
throw new DriverException(sprintf(
'The BrowserKit client returned an unsupported request implementation: %s. Please upgrade your BrowserKit package to 2.3 or newer.',
get_class($request)
));
}
}
if ($request === null) { if ($request === null) {
throw new DriverException('Unable to access the request before visiting a page'); throw new DriverException('Unable to access the request before visiting a page');
...@@ -345,13 +319,13 @@ public function getContent() ...@@ -345,13 +319,13 @@ public function getContent()
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function find($xpath) public function findElementXpaths($xpath)
{ {
$nodes = $this->getCrawler()->filterXPath($xpath); $nodes = $this->getCrawler()->filterXPath($xpath);
$elements = array(); $elements = array();
foreach ($nodes as $i => $node) { foreach ($nodes as $i => $node) {
$elements[] = new NodeElement(sprintf('(%s)[%d]', $xpath, $i + 1), $this->session); $elements[] = sprintf('(%s)[%d]', $xpath, $i + 1);
} }
return $elements; return $elements;
...@@ -393,7 +367,7 @@ public function getOuterHtml($xpath) ...@@ -393,7 +367,7 @@ public function getOuterHtml($xpath)
{ {
$node = $this->getCrawlerNode($this->getFilteredCrawler($xpath)); $node = $this->getCrawlerNode($this->getFilteredCrawler($xpath));
return $node->ownerDocument->saveXML($node); return $node->ownerDocument->saveHTML($node);
} }
/** /**
...@@ -415,7 +389,7 @@ public function getAttribute($xpath, $name) ...@@ -415,7 +389,7 @@ public function getAttribute($xpath, $name)
*/ */
public function getValue($xpath) public function getValue($xpath)
{ {
if (in_array($this->getAttribute($xpath, 'type'), array('submit', 'image', 'button'))) { if (in_array($this->getAttribute($xpath, 'type'), array('submit', 'image', 'button'), true)) {
return $this->getAttribute($xpath, 'value'); return $this->getAttribute($xpath, 'value');
} }
...@@ -487,7 +461,7 @@ public function isSelected($xpath) ...@@ -487,7 +461,7 @@ public function isSelected($xpath)
$selectField = $this->getFormField('(' . $xpath . ')/ancestor-or-self::*[local-name()="select"]'); $selectField = $this->getFormField('(' . $xpath . ')/ancestor-or-self::*[local-name()="select"]');
$selectValue = $selectField->getValue(); $selectValue = $selectField->getValue();
return is_array($selectValue) ? in_array($optionValue, $selectValue) : $optionValue == $selectValue; return is_array($selectValue) ? in_array($optionValue, $selectValue, true) : $optionValue === $selectValue;
} }
/** /**
...@@ -495,19 +469,19 @@ public function isSelected($xpath) ...@@ -495,19 +469,19 @@ public function isSelected($xpath)
*/ */
public function click($xpath) public function click($xpath)
{ {
$node = $this->getFilteredCrawler($xpath); $crawler = $this->getFilteredCrawler($xpath);
$crawlerNode = $this->getCrawlerNode($node); $node = $this->getCrawlerNode($crawler);
$tagName = $crawlerNode->nodeName; $tagName = $node->nodeName;
if ('a' === $tagName) { if ('a' === $tagName) {
$this->client->click($node->link()); $this->client->click($crawler->link());
$this->forms = array(); $this->forms = array();
} elseif ($this->canSubmitForm($crawlerNode)) { } elseif ($this->canSubmitForm($node)) {
$this->submit($node->form()); $this->submit($crawler->form());
} elseif ($this->canResetForm($crawlerNode)) { } elseif ($this->canResetForm($node)) {
$this->resetForm($crawlerNode); $this->resetForm($node);
} else { } else {
$message = sprintf('%%s supports clicking on links and buttons only. But "%s" provided', $tagName); $message = sprintf('%%s supports clicking on links and submit or reset buttons only. But "%s" provided', $tagName);
throw new UnsupportedDriverActionException($message, $this); throw new UnsupportedDriverActionException($message, $this);
} }
...@@ -564,16 +538,6 @@ public function submitForm($xpath) ...@@ -564,16 +538,6 @@ public function submitForm($xpath)
*/ */
protected function getResponse() protected function getResponse()
{ {
if (!method_exists($this->client, 'getInternalResponse')) {
$implementationResponse = $this->client->getResponse();
if (null === $implementationResponse) {
throw new DriverException('Unable to access the response before visiting a page');
}
return $this->convertImplementationResponse($implementationResponse);
}
$response = $this->client->getInternalResponse(); $response = $this->client->getInternalResponse();
if (null === $response) { if (null === $response) {
...@@ -583,64 +547,6 @@ protected function getResponse() ...@@ -583,64 +547,6 @@ protected function getResponse()
return $response; return $response;
}