diff --git a/composer.lock b/composer.lock index d87cede4171a5437cfbe8f75fe826481d828bc35..d668c1e71449bc16e57eedaa8e53a153df1cce58 100644 --- a/composer.lock +++ b/composer.lock @@ -5,7 +5,6 @@ "This file is @generated automatically" ], "hash": "8c9fdf621ce53640f24b24749e59717c", - "content-hash": "f38613812a285c03a1a18458384fe0b1", "packages": [ { "name": "composer/installers", @@ -2196,21 +2195,24 @@ "packages-dev": [ { "name": "behat/mink", - "version": "v1.6.1", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/minkphp/Mink.git", - "reference": "8b68523a339ec991bcd638b39dc8f04f808da88a" + "reference": "6c129030ec2cc029905cf969a56ca8f087b2dfdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/Mink/zipball/8b68523a339ec991bcd638b39dc8f04f808da88a", - "reference": "8b68523a339ec991bcd638b39dc8f04f808da88a", + "url": "https://api.github.com/repos/minkphp/Mink/zipball/6c129030ec2cc029905cf969a56ca8f087b2dfdf", + "reference": "6c129030ec2cc029905cf969a56ca8f087b2dfdf", "shasum": "" }, "require": { "php": ">=5.3.1", - "symfony/css-selector": "~2.0" + "symfony/css-selector": "~2.1" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "suggest": { "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", @@ -2221,7 +2223,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -2247,40 +2249,41 @@ "testing", "web" ], - "time": "2015-02-04 17:02:06" + "time": "2015-09-20 20:24:03" }, { "name": "behat/mink-browserkit-driver", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/minkphp/MinkBrowserKitDriver.git", - "reference": "aed8f4a596b79014a75254c3e337511c33e38cbd" + "reference": "da47df1593dac132f04d24e7277ef40d33d9f201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/aed8f4a596b79014a75254c3e337511c33e38cbd", - "reference": "aed8f4a596b79014a75254c3e337511c33e38cbd", + "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/da47df1593dac132f04d24e7277ef40d33d9f201", + "reference": "da47df1593dac132f04d24e7277ef40d33d9f201", "shasum": "" }, "require": { - "behat/mink": "~1.6@dev", - "php": ">=5.3.1", - "symfony/browser-kit": "~2.0", - "symfony/dom-crawler": "~2.0" + "behat/mink": "~1.7@dev", + "php": ">=5.3.6", + "symfony/browser-kit": "~2.3", + "symfony/dom-crawler": "~2.3" }, "require-dev": { - "silex/silex": "~1.2" + "silex/silex": "~1.2", + "symfony/phpunit-bridge": "~2.7" }, "type": "mink-driver", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { - "psr-0": { - "Behat\\Mink\\Driver": "src/" + "psr-4": { + "Behat\\Mink\\Driver\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2302,20 +2305,20 @@ "browser", "testing" ], - "time": "2014-09-26 11:35:19" + "time": "2015-09-21 20:56:13" }, { "name": "behat/mink-goutte-driver", - "version": "dev-master", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/minkphp/MinkGoutteDriver.git", - "reference": "cc5ce119b5a8e06662f634b35967aff0b0c7dfdd" + "reference": "c8e254f127d6f2242b994afd4339fb62d471df3f" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/c8e254f127d6f2242b994afd4339fb62d471df3f", - "reference": "cc5ce119b5a8e06662f634b35967aff0b0c7dfdd", + "reference": "c8e254f127d6f2242b994afd4339fb62d471df3f", "shasum": "" }, "require": { @@ -2324,10 +2327,13 @@ "fabpot/goutte": "~1.0.4|~2.0|~3.1", "php": ">=5.3.1" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "mink-driver", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -2354,7 +2360,7 @@ "headless", "testing" ], - "time": "2015-06-27 00:15:11" + "time": "2015-09-21 21:31:11" }, { "name": "doctrine/instantiator", @@ -3544,7 +3550,7 @@ "symfony/psr-http-message-bridge": 0, "zendframework/zend-diactoros": 0, "behat/mink": 0, - "behat/mink-goutte-driver": 20, + "behat/mink-goutte-driver": 0, "mikey179/vfsstream": 0, "phpunit/phpunit": 0, "symfony/css-selector": 0 diff --git a/core/composer.json b/core/composer.json index 78ef4f7e050a1747c0960cfe4427440275c68aa6..0b832c27076e4a9d4fc43d96a1c3784a9899a843 100644 --- a/core/composer.json +++ b/core/composer.json @@ -32,7 +32,7 @@ }, "require-dev": { "behat/mink": "~1.6", - "behat/mink-goutte-driver": "dev-master#cc5ce119b5a8e06662f634b35967aff0b0c7dfdd", + "behat/mink-goutte-driver": "~1.2", "mikey179/vfsStream": "~1.2", "phpunit/phpunit": "4.8.*", "symfony/css-selector": "2.7.*" diff --git a/vendor/behat/mink-browserkit-driver/.travis.yml b/vendor/behat/mink-browserkit-driver/.travis.yml index 838fc4ed068ca3b9351e8f316763c1e46c92a0ad..9c08e641acc5f71262ce999c3c6ac9b06fe8586a 100644 --- a/vendor/behat/mink-browserkit-driver/.travis.yml +++ b/vendor/behat/mink-browserkit-driver/.travis.yml @@ -1,5 +1,7 @@ language: php +sudo: false + php: [5.3, 5.4, 5.5, 5.6, hhvm] matrix: @@ -9,12 +11,17 @@ matrix: - php: 5.5 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;' - - composer install -n --prefer-source + +install: + - composer install -n script: phpunit -v --coverage-clover=coverage.clover after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover coverage.clover + - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover diff --git a/vendor/behat/mink-browserkit-driver/CHANGELOG.md b/vendor/behat/mink-browserkit-driver/CHANGELOG.md index 774663f8c5d135acb6c158d3d4f859d31b1b7d97..1b8e790935e60bffd9f3f7b06b47372ae1d990f4 100644 --- a/vendor/behat/mink-browserkit-driver/CHANGELOG.md +++ b/vendor/behat/mink-browserkit-driver/CHANGELOG.md @@ -1,3 +1,24 @@ +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 ================== diff --git a/vendor/behat/mink-browserkit-driver/README.md b/vendor/behat/mink-browserkit-driver/README.md index fc36e41f5a6eca74bf50fc8d678547ccb051967a..1903a5fc8f8be9bc160913ccf5822a7d3b9ffa64 100755 --- a/vendor/behat/mink-browserkit-driver/README.md +++ b/vendor/behat/mink-browserkit-driver/README.md @@ -4,9 +4,9 @@ Mink BrowserKit Driver [](https://packagist.org/packages/behat/mink-browserkit-driver) [](https://packagist.org/packages/behat/mink-browserkit-driver) [](https://packagist.org/packages/behat/mink-browserkit-driver) -[](https://travis-ci.org/Behat/MinkBrowserKitDriver) -[](https://scrutinizer-ci.com/g/Behat/MinkBrowserKitDriver/) -[](https://scrutinizer-ci.com/g/Behat/MinkBrowserKitDriver/) +[](https://travis-ci.org/minkphp/MinkBrowserKitDriver) +[](https://scrutinizer-ci.com/g/minkphp/MinkBrowserKitDriver/) +[](https://scrutinizer-ci.com/g/minkphp/MinkBrowserKitDriver/) [](https://packagist.org/packages/behat/mink-browserkit-driver) Usage Example @@ -50,5 +50,5 @@ $> php composer.phar install Maintainers ----------- -* Konstantin Kudryashov [everzet](http://github.com/everzet) -* Other [awesome developers](https://github.com/Behat/MinkBrowserKitDriver/graphs/contributors) +* Christophe Coevoet [stof](https://github.com/stof) +* Other [awesome developers](https://github.com/minkphp/MinkBrowserKitDriver/graphs/contributors) diff --git a/vendor/behat/mink-browserkit-driver/composer.json b/vendor/behat/mink-browserkit-driver/composer.json index c0c5df9939e255b4baf4e033ad1dc96ee2136045..7d12bbcf08e36d9513dc6bf22efec761348aeb69 100644 --- a/vendor/behat/mink-browserkit-driver/composer.json +++ b/vendor/behat/mink-browserkit-driver/composer.json @@ -15,19 +15,20 @@ ], "require": { - "php": ">=5.3.1", - "behat/mink": "~1.6@dev", - "symfony/browser-kit": "~2.0", - "symfony/dom-crawler": "~2.0" + "php": ">=5.3.6", + "behat/mink": "~1.7@dev", + "symfony/browser-kit": "~2.3", + "symfony/dom-crawler": "~2.3" }, "require-dev": { + "symfony/phpunit-bridge": "~2.7", "silex/silex": "~1.2" }, "autoload": { - "psr-0": { - "Behat\\Mink\\Driver": "src/" + "psr-4": { + "Behat\\Mink\\Driver\\": "src/" } }, @@ -39,7 +40,7 @@ "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } } } diff --git a/vendor/behat/mink-browserkit-driver/phpunit.xml.dist b/vendor/behat/mink-browserkit-driver/phpunit.xml.dist index 4f9b932ba930c056858a7d499522cb1849dbc947..d91581c24eedbe476bac0cb7af42b66c9ecd6275 100644 --- a/vendor/behat/mink-browserkit-driver/phpunit.xml.dist +++ b/vendor/behat/mink-browserkit-driver/phpunit.xml.dist @@ -15,7 +15,7 @@ <filter> <whitelist> - <directory>./src/Behat/Mink/Driver</directory> + <directory>./src</directory> </whitelist> </filter> </phpunit> diff --git a/vendor/behat/mink-browserkit-driver/src/Behat/Mink/Driver/BrowserKitDriver.php b/vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php similarity index 81% rename from vendor/behat/mink-browserkit-driver/src/Behat/Mink/Driver/BrowserKitDriver.php rename to vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php index 28b99dc1ee27a013fca660f718061c0e1da4836b..70682e70bb68263f39bc2d04e16c674dded27c6d 100644 --- a/vendor/behat/mink-browserkit-driver/src/Behat/Mink/Driver/BrowserKitDriver.php +++ b/vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php @@ -10,13 +10,10 @@ namespace Behat\Mink\Driver; -use Behat\Mink\Element\NodeElement; use Behat\Mink\Exception\DriverException; use Behat\Mink\Exception\UnsupportedDriverActionException; -use Behat\Mink\Session; use Symfony\Component\BrowserKit\Client; use Symfony\Component\BrowserKit\Cookie; -use Symfony\Component\BrowserKit\Request; use Symfony\Component\BrowserKit\Response; use Symfony\Component\DomCrawler\Crawler; use Symfony\Component\DomCrawler\Field\ChoiceFormField; @@ -25,8 +22,6 @@ use Symfony\Component\DomCrawler\Field\InputFormField; use Symfony\Component\DomCrawler\Field\TextareaFormField; 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; /** @@ -36,7 +31,6 @@ */ class BrowserKitDriver extends CoreDriver { - private $session; private $client; /** @@ -74,14 +68,6 @@ public function getClient() return $this->client; } - /** - * {@inheritdoc} - */ - public function setSession(Session $session) - { - $this->session = $session; - } - /** * Tells driver to remove hostname from URL. * @@ -164,19 +150,7 @@ public function visit($url) */ public function getCurrentUrl() { - if (method_exists($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) - )); - } - } + $request = $this->client->getInternalRequest(); if ($request === null) { throw new DriverException('Unable to access the request before visiting a page'); @@ -345,13 +319,13 @@ public function getContent() /** * {@inheritdoc} */ - public function find($xpath) + public function findElementXpaths($xpath) { $nodes = $this->getCrawler()->filterXPath($xpath); $elements = array(); 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; @@ -393,7 +367,7 @@ public function getOuterHtml($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) */ 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'); } @@ -487,7 +461,7 @@ public function isSelected($xpath) $selectField = $this->getFormField('(' . $xpath . ')/ancestor-or-self::*[local-name()="select"]'); $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) */ public function click($xpath) { - $node = $this->getFilteredCrawler($xpath); - $crawlerNode = $this->getCrawlerNode($node); - $tagName = $crawlerNode->nodeName; + $crawler = $this->getFilteredCrawler($xpath); + $node = $this->getCrawlerNode($crawler); + $tagName = $node->nodeName; if ('a' === $tagName) { - $this->client->click($node->link()); + $this->client->click($crawler->link()); $this->forms = array(); - } elseif ($this->canSubmitForm($crawlerNode)) { - $this->submit($node->form()); - } elseif ($this->canResetForm($crawlerNode)) { - $this->resetForm($crawlerNode); + } elseif ($this->canSubmitForm($node)) { + $this->submit($crawler->form()); + } elseif ($this->canResetForm($node)) { + $this->resetForm($node); } 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); } @@ -564,16 +538,6 @@ public function submitForm($xpath) */ 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(); if (null === $response) { @@ -583,64 +547,6 @@ protected function getResponse() return $response; } - /** - * Gets the BrowserKit Response for legacy BrowserKit versions. - * - * Before 2.3.0, there was no Client::getInternalResponse method, and the - * return value of Client::getResponse can be anything when the implementation - * uses Client::filterResponse because of a bad choice done in BrowserKit and - * kept for BC reasons (the Client::getInternalResponse method has been added - * to solve it). - * - * This implementation supports client which don't rely Client::filterResponse - * and clients which use an HttpFoundation Response (like the HttpKernel client). - * - * @param object $response the response specific to the BrowserKit implementation - * - * @return Response - * - * @throws DriverException If the response cannot be converted to a BrowserKit response - */ - private function convertImplementationResponse($response) - { - if ($response instanceof Response) { - return $response; - } - - // due to a bug, the HttpKernel client implementation returns the HttpFoundation response - // The conversion logic is copied from Symfony\Component\HttpKernel\Client::filterResponse - if ($response instanceof HttpFoundationResponse) { - $headers = $response->headers->all(); - if ($response->headers->getCookies()) { - $cookies = array(); - foreach ($response->headers->getCookies() as $cookie) { - $cookies[] = new Cookie( - $cookie->getName(), - $cookie->getValue(), - $cookie->getExpiresTime(), - $cookie->getPath(), - $cookie->getDomain(), - $cookie->isSecure(), - $cookie->isHttpOnly() - ); - } - $headers['Set-Cookie'] = $cookies; - } - - // this is needed to support StreamedResponse - ob_start(); - $response->sendContent(); - $content = ob_get_clean(); - - return new Response($content, $response->getStatusCode(), $headers); - } - - throw new DriverException(sprintf( - 'The BrowserKit client returned an unsupported response implementation: %s. Please upgrade your BrowserKit package to 2.3 or newer.', - get_class($response) - )); - } - /** * Prepares URL for visiting. * Removes "*.php/" from urls and then passes it to BrowserKitDriver::visit(). @@ -810,11 +716,11 @@ private function canSubmitForm(\DOMElement $node) { $type = $node->hasAttribute('type') ? $node->getAttribute('type') : null; - if ('input' == $node->nodeName && in_array($type, array('submit', 'image'))) { + if ('input' === $node->nodeName && in_array($type, array('submit', 'image'), true)) { return true; } - return 'button' == $node->nodeName && (null === $type || 'submit' == $type); + return 'button' === $node->nodeName && (null === $type || 'submit' === $type); } /** @@ -828,7 +734,7 @@ private function canResetForm(\DOMElement $node) { $type = $node->hasAttribute('type') ? $node->getAttribute('type') : null; - return in_array($node->nodeName, array('input', 'button')) && 'reset' == $type; + return in_array($node->nodeName, array('input', 'button'), true) && 'reset' === $type; } /** @@ -881,10 +787,10 @@ private function mergeForms(Form $to, Form $from) $nodeReflection->setAccessible(true); $valueReflection->setAccessible(true); - if (!($field instanceof InputFormField && in_array( - $nodeReflection->getValue($field)->getAttribute('type'), - array('submit', 'button', 'image') - ))) { + $isIgnoredField = $field instanceof InputFormField && + in_array($nodeReflection->getValue($field)->getAttribute('type'), array('submit', 'button', 'image'), true); + + if (!$isIgnoredField) { $valueReflection->setValue($to[$name], $valueReflection->getValue($field)); } } diff --git a/vendor/behat/mink-browserkit-driver/tests/Custom/ErrorHandlingTest.php b/vendor/behat/mink-browserkit-driver/tests/Custom/ErrorHandlingTest.php index 32335c5554ba089e264cdbdfd0e533e479928dcd..9e2643c143d90b6c201ac04d93a53ecb5c12b3bf 100644 --- a/vendor/behat/mink-browserkit-driver/tests/Custom/ErrorHandlingTest.php +++ b/vendor/behat/mink-browserkit-driver/tests/Custom/ErrorHandlingTest.php @@ -127,7 +127,7 @@ public function testManipulateInputWithoutForm() /** * @expectedException \Behat\Mink\Exception\DriverException - * @expectedExceptionMessage Behat\Mink\Driver\BrowserKitDriver supports clicking on links and buttons only. But "div" provided + * @expectedExceptionMessage Behat\Mink\Driver\BrowserKitDriver supports clicking on links and submit or reset buttons only. But "div" provided */ public function testClickOnUnsupportedElement() { diff --git a/vendor/behat/mink-goutte-driver/.travis.yml b/vendor/behat/mink-goutte-driver/.travis.yml index d21d960c9e0d953fb6c8880c3d85f43051acbbdd..5b865317dd76d4e431756074fed712b7c3ef03aa 100644 --- a/vendor/behat/mink-goutte-driver/.travis.yml +++ b/vendor/behat/mink-goutte-driver/.travis.yml @@ -1,23 +1,27 @@ language: php +sudo: false + +cache: + directories: + - $HOME/.composer/cache/files + php: [5.3, 5.4, 5.5, 5.6, hhvm] before_install: # Force using Goutte 2 on HHVM for now because Guzzle 6 is broken there - if [ "hhvm" = "$TRAVIS_PHP_VERSION" ]; then composer require fabpot/goutte '~2' --no-update; fi -before_script: - - export WEB_FIXTURES_HOST=http://localhost +install: + - composer install - - composer install --dev --prefer-source +before_script: + - export WEB_FIXTURES_HOST=http://localhost:8000 - - sudo apt-get update - - sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 - - sudo sed -i -e "s,/var/www,$(pwd)/vendor/behat/mink/driver-testsuite/web-fixtures,g" /etc/apache2/sites-available/default - - sudo /etc/init.d/apache2 restart + # Start a webserver for web fixtures. Force using PHP 5.6 to be able to run it on PHP 5.3 and HHVM jobs too + - ~/.phpenv/versions/5.6/bin/php -S localhost:8000 -t vendor/behat/mink/driver-testsuite/web-fixtures > /dev/null 2>&1 & script: phpunit -v --coverage-clover=coverage.clover after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover coverage.clover + - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover diff --git a/vendor/behat/mink-goutte-driver/CHANGELOG.md b/vendor/behat/mink-goutte-driver/CHANGELOG.md index fcaa7f0a460c162f394831c23afb9cd19c1699e2..581eb5ec6ef5432c472b6e6cc4bceb57422ba0ef 100644 --- a/vendor/behat/mink-goutte-driver/CHANGELOG.md +++ b/vendor/behat/mink-goutte-driver/CHANGELOG.md @@ -1,3 +1,14 @@ +1.2.0 / 2015-09-21 +================== + +New features: + +* Added support for Goutte 3.1+ + +Misc: + +* Updated the repository structure to PSR-4 + 1.1.0 / 2014-10-09 ================== diff --git a/vendor/behat/mink-goutte-driver/composer.json b/vendor/behat/mink-goutte-driver/composer.json index f103906ec14ea371140e1e7ea59b2afe83987915..80d6ecf23ed2e38fa92272f03c0c7f6fabe05e87 100644 --- a/vendor/behat/mink-goutte-driver/composer.json +++ b/vendor/behat/mink-goutte-driver/composer.json @@ -21,6 +21,10 @@ "fabpot/goutte": "~1.0.4|~2.0|~3.1" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "autoload": { "psr-4": { "Behat\\Mink\\Driver\\": "src/" @@ -35,7 +39,7 @@ "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } } } diff --git a/vendor/behat/mink/.travis.yml b/vendor/behat/mink/.travis.yml index 4c0c786d4047c78aa7e09da898c7530aa4f34fee..677ee0ecfd4c18037e453f0903ed39a0dda153a0 100644 --- a/vendor/behat/mink/.travis.yml +++ b/vendor/behat/mink/.travis.yml @@ -2,16 +2,27 @@ language: php sudo: false -php: [5.3, 5.4, 5.5, 5.6, hhvm] +php: [5.3, 5.4, 5.5, 5.6, 7.0, hhvm] + +matrix: + fast_finish: true + include: + - php: 5.3 + env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable' SYMFONY_DEPRECATIONS_HELPER=weak + allow_failures: + - php: 7.0 cache: directories: - - $HOME/.composer/cache + - $HOME/.composer/cache/files + +before_install: + - composer self-update install: - - composer install + - composer update $COMPOSER_FLAGS script: phpunit -v --coverage-clover=coverage.clover after_script: - - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover + - if [[ "7.0" != "$TRAVIS_PHP_VERSION" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi diff --git a/vendor/behat/mink/CHANGES.md b/vendor/behat/mink/CHANGES.md index e21d5aff6f439db8aedb99c24c15dbcdeba4051d..4ef4ecb28fe095bf76ad4f058d839d34d8ff6a4e 100644 --- a/vendor/behat/mink/CHANGES.md +++ b/vendor/behat/mink/CHANGES.md @@ -1,3 +1,45 @@ +1.7.0 / 2015-09-20 +================== + +New features: + +* Added `Session::getResponseHeader` to access a response header easily +* Added support for header assertions +* Added a forward compatibility layer for drivers to allow them to prepare + for Mink 2.0 (they won't require any change if they use it). They should + now overwrite `CoreDriver::findElementXpaths` instead of implementing `find` + and `setSession` themselves. +* Added escaping of the locator in the NamedSelector rather than expecting + the caller to perform the escaping. Passing an escaped locator is still + supported but deprecated. +* Remove the dependency on the Session in expectation exceptions. Passing + the session in the exception constructor is now deprecated. The driver + should be passed instead. + +Bug fixes: + +* Fixed the URL assertions when comparing paths ending in ``.php`` +* Silenced deprecation warnings (following the Symfony convention) to make + them less invasive. Use the `symfony/phpunit-bridge` to get them reported + when using Mink in your PHPUnit tests. +* Fixed `NodeElement::hasClass` in case the class attribute contains newlines + +Testsuite: + +* Made the testsuite compatible with PHPUnit strict timing mode (only the library testsuite, not the driver one) +* Added testing against PHP 7 +* Added testing against lowest version of dependencies to ensure we got the lower bounds right + +Driver testsuite: + +* Added an extra test to ensure the right behavior when getting the HTML with empty elements +* Added a few more safeguards to ensure test failures rather than fatal errors for misbehaving drivers +* Added a test ensuring that drivers follow recommended practices + +Misc: + +* Added a few missing deprecation warnings for deprecated APIs or classes. + 1.6.1 / 2015-02-04 ================== diff --git a/vendor/behat/mink/LICENSE b/vendor/behat/mink/LICENSE index 14f15e8b483f1e3d5d1a65486cf4e47ba558de78..854754b796cf09ef0f1e3100a761ab48ee40f76d 100644 --- a/vendor/behat/mink/LICENSE +++ b/vendor/behat/mink/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2011-2013 Konstantin Kudryashov <ever.zet@gmail.com> +Copyright (c) 2011-2015 Konstantin Kudryashov <ever.zet@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/vendor/behat/mink/composer.json b/vendor/behat/mink/composer.json index 7a8723f072241fa62dad4be6303698df45dd43f6..0193f434fa148120480ccd4c0abf19b600361144 100644 --- a/vendor/behat/mink/composer.json +++ b/vendor/behat/mink/composer.json @@ -16,7 +16,11 @@ "require": { "php": ">=5.3.1", - "symfony/css-selector": "~2.0" + "symfony/css-selector": "~2.1" + }, + + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "suggest": { @@ -40,7 +44,7 @@ "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } } } diff --git a/vendor/behat/mink/driver-testsuite/tests/AbstractConfig.php b/vendor/behat/mink/driver-testsuite/tests/AbstractConfig.php index f654297561f223aac4871e750df3de97a015f627..057e6fd481a42f294774c79d120c81bc1e1cbba8 100644 --- a/vendor/behat/mink/driver-testsuite/tests/AbstractConfig.php +++ b/vendor/behat/mink/driver-testsuite/tests/AbstractConfig.php @@ -33,7 +33,7 @@ public function mapRemoteFilePath($file) } /** - * Gets the base url to the fixture folder + * Gets the base url to the fixture folder. * * @return string */ diff --git a/vendor/behat/mink/driver-testsuite/tests/Basic/BestPracticesTest.php b/vendor/behat/mink/driver-testsuite/tests/Basic/BestPracticesTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d6cda7db6aaa7abb920267ce0fd8999f063675ed --- /dev/null +++ b/vendor/behat/mink/driver-testsuite/tests/Basic/BestPracticesTest.php @@ -0,0 +1,84 @@ +<?php + +namespace Behat\Mink\Tests\Driver\Basic; + +use Behat\Mink\Tests\Driver\TestCase; + +/** + * This testcase ensures that the driver implementation follows recommended practices for drivers. + */ +class BestPracticesTest extends TestCase +{ + public function testExtendsCoreDriver() + { + $driver = $this->createDriver(); + + $this->assertInstanceOf('Behat\Mink\Driver\CoreDriver', $driver); + + return $driver; + } + + /** + * @depends testExtendsCoreDriver + */ + public function testImplementFindXpath() + { + $driver = $this->createDriver(); + + $this->assertNotImplementMethod('find', $driver, 'The driver should overwrite `findElementXpaths` rather than `find` for forward compatibility with Mink 2.'); + $this->assertImplementMethod('findElementXpaths', $driver, 'The driver must be able to find elements.'); + $this->assertNotImplementMethod('setSession', $driver, 'The driver should not deal with the Session directly for forward compatibility with Mink 2.'); + } + + /** + * @dataProvider provideRequiredMethods + */ + public function testImplementBasicApi($method) + { + $driver = $this->createDriver(); + + $this->assertImplementMethod($method, $driver, 'The driver is unusable when this method is not implemented.'); + } + + public function provideRequiredMethods() + { + return array( + array('start'), + array('isStarted'), + array('stop'), + array('reset'), + array('visit'), + array('getCurrentUrl'), + array('getContent'), + array('click'), + ); + } + + private function assertImplementMethod($method, $object, $reason = '') + { + $ref = new \ReflectionClass(get_class($object)); + $refMethod = $ref->getMethod($method); + + $message = sprintf('The driver should implement the `%s` method.', $method); + + if ('' !== $reason) { + $message .= ' '.$reason; + } + + $this->assertSame($ref->name, $refMethod->getDeclaringClass()->name, $message); + } + + private function assertNotImplementMethod($method, $object, $reason = '') + { + $ref = new \ReflectionClass(get_class($object)); + $refMethod = $ref->getMethod($method); + + $message = sprintf('The driver should not implement the `%s` method.', $method); + + if ('' !== $reason) { + $message .= ' '.$reason; + } + + $this->assertNotSame($ref->name, $refMethod->getDeclaringClass()->name, $message); + } +} diff --git a/vendor/behat/mink/driver-testsuite/tests/Basic/ContentTest.php b/vendor/behat/mink/driver-testsuite/tests/Basic/ContentTest.php index 6f516e814ae6147f231165c7fb7f3bffe0ca8ec5..fdd0ffacd26eb999ae259e992cace9e9035fc5b1 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Basic/ContentTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Basic/ContentTest.php @@ -21,6 +21,18 @@ public function testOuterHtml() ); } + public function testDumpingEmptyElements() + { + $this->getSession()->visit($this->pathTo('/index.html')); + + $element = $this->getAssertSession()->elementExists('css', '#empty'); + + $this->assertEquals( + 'An empty <em></em> tag should be rendered with both open and close tags.', + trim($element->getHtml()) + ); + } + /** * @dataProvider getAttributeDataProvider */ diff --git a/vendor/behat/mink/driver-testsuite/tests/Basic/CookieTest.php b/vendor/behat/mink/driver-testsuite/tests/Basic/CookieTest.php index 355dd717af30c5e65b13477fb37a4e03ce5a24a4..5636c1194eaab7c7f0b0bde00845501a9ac940e5 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Basic/CookieTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Basic/CookieTest.php @@ -7,7 +7,8 @@ class CookieTest extends TestCase { /** - * test cookie decoding + * test cookie decoding. + * * @group issue140 */ public function testIssue140() diff --git a/vendor/behat/mink/driver-testsuite/tests/Basic/ErrorHandlingTest.php b/vendor/behat/mink/driver-testsuite/tests/Basic/ErrorHandlingTest.php index 440585ac12dd2a6b32f81ef29dbc02357cf0dc69..bb4bb2dbee472401a894bc1cf38f8ff4cf6bd6ed 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Basic/ErrorHandlingTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Basic/ErrorHandlingTest.php @@ -4,6 +4,9 @@ use Behat\Mink\Tests\Driver\TestCase; +/** + * @group slow + */ class ErrorHandlingTest extends TestCase { const NOT_FOUND_XPATH = '//html/./invalid'; diff --git a/vendor/behat/mink/driver-testsuite/tests/Basic/HeaderTest.php b/vendor/behat/mink/driver-testsuite/tests/Basic/HeaderTest.php index 0288ff14ac00ea0158e3ff8ecd0efec3a94e57be..072ceb4180d0a8d693d2a278221b4e08e396ad92 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Basic/HeaderTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Basic/HeaderTest.php @@ -7,7 +7,8 @@ class HeaderTest extends TestCase { /** - * test referrer + * test referrer. + * * @group issue130 */ public function testIssue130() diff --git a/vendor/behat/mink/driver-testsuite/tests/Basic/NavigationTest.php b/vendor/behat/mink/driver-testsuite/tests/Basic/NavigationTest.php index 8ecb1395a4b08070ae7475e3fc72b3a89afd8edf..7056316a4a876a2373685b0f345d4f80acc805e9 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Basic/NavigationTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Basic/NavigationTest.php @@ -12,13 +12,13 @@ public function testRedirect() $this->assertEquals($this->pathTo('/redirect_destination.html'), $this->getSession()->getCurrentUrl()); } - public function testPageControlls() + public function testPageControls() { $this->getSession()->visit($this->pathTo('/randomizer.php')); - $number1 = $this->getSession()->getPage()->find('css', '#number')->getText(); + $number1 = $this->getAssertSession()->elementExists('css', '#number')->getText(); $this->getSession()->reload(); - $number2 = $this->getSession()->getPage()->find('css', '#number')->getText(); + $number2 = $this->getAssertSession()->elementExists('css', '#number')->getText(); $this->assertNotEquals($number1, $number2); @@ -58,7 +58,7 @@ public function testLinks() $this->getSession()->visit($this->pathTo('/links.html')); $page = $this->getSession()->getPage(); - $link = $page->findLink("Link with a "); + $link = $page->findLink('Link with a '); $this->assertNotNull($link); $this->assertRegExp('/links\.html\?quoted$/', $link->getAttribute('href')); diff --git a/vendor/behat/mink/driver-testsuite/tests/Basic/TraversingTest.php b/vendor/behat/mink/driver-testsuite/tests/Basic/TraversingTest.php index 3bcb7ac01a635e92af4563683e4f6bc04d8d089f..6f1ebcbca1514bcdc00164b04aee0b1e67d6dc73 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Basic/TraversingTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Basic/TraversingTest.php @@ -7,7 +7,8 @@ class TraversingTest extends TestCase { /** - * find by label + * find by label. + * * @group issue211 */ public function testIssue211() @@ -24,20 +25,23 @@ public function testElementsTraversing() $page = $this->getSession()->getPage(); - $this->assertNotNull($page->find('css', 'h1')); - $this->assertEquals('Extremely useless page', $page->find('css', 'h1')->getText()); - $this->assertEquals('h1', $page->find('css', 'h1')->getTagName()); + $title = $page->find('css', 'h1'); + $this->assertNotNull($title); + $this->assertEquals('Extremely useless page', $title->getText()); + $this->assertEquals('h1', $title->getTagName()); - $this->assertNotNull($page->find('xpath', '//div/strong[3]')); - $this->assertEquals('pariatur', $page->find('xpath', '//div/strong[3]')->getText()); - $this->assertEquals('super-duper', $page->find('xpath', '//div/strong[3]')->getAttribute('class')); - $this->assertTrue($page->find('xpath', '//div/strong[3]')->hasAttribute('class')); + $strong = $page->find('xpath', '//div/strong[3]'); + $this->assertNotNull($strong); + $this->assertEquals('pariatur', $strong->getText()); + $this->assertEquals('super-duper', $strong->getAttribute('class')); + $this->assertTrue($strong->hasAttribute('class')); - $this->assertNotNull($page->find('xpath', '//div/strong[2]')); - $this->assertEquals('veniam', $page->find('xpath', '//div/strong[2]')->getText()); - $this->assertEquals('strong', $page->find('xpath', '//div/strong[2]')->getTagName()); - $this->assertNull($page->find('xpath', '//div/strong[2]')->getAttribute('class')); - $this->assertFalse($page->find('xpath', '//div/strong[2]')->hasAttribute('class')); + $strong2 = $page->find('xpath', '//div/strong[2]'); + $this->assertNotNull($strong2); + $this->assertEquals('veniam', $strong2->getText()); + $this->assertEquals('strong', $strong2->getTagName()); + $this->assertNull($strong2->getAttribute('class')); + $this->assertFalse($strong2->hasAttribute('class')); $strongs = $page->findAll('css', 'div#core > strong'); $this->assertCount(3, $strongs); @@ -46,6 +50,7 @@ public function testElementsTraversing() $element = $page->find('css', '#some-element'); + $this->assertNotNull($element); $this->assertEquals('some very interesting text', $element->getText()); $this->assertEquals( "\n some <div>very\n </div>\n". @@ -105,12 +110,11 @@ public function testDeepTraversing() { $this->getSession()->visit($this->pathTo('/index.html')); - $traversDiv = $this->getSession()->getPage()->findAll('css', 'div.travers'); + $traversDivs = $this->getSession()->getPage()->findAll('css', 'div.travers'); - $this->assertCount(1, $traversDiv); - $traversDiv = $traversDiv[0]; + $this->assertCount(1, $traversDivs); - $subDivs = $traversDiv->findAll('css', 'div.sub'); + $subDivs = $traversDivs[0]->findAll('css', 'div.sub'); $this->assertCount(3, $subDivs); $this->assertTrue($subDivs[2]->hasLink('some deep url')); diff --git a/vendor/behat/mink/driver-testsuite/tests/Basic/VisibilityTest.php b/vendor/behat/mink/driver-testsuite/tests/Basic/VisibilityTest.php index b3daf316a3836d61d127aa4b8a0bcdf6d3b7a404..bb5634e2e6acbd54f14bd387fc99e7d88c883419 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Basic/VisibilityTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Basic/VisibilityTest.php @@ -11,7 +11,7 @@ public function testVisibility() $this->getSession()->visit($this->pathTo('/js_test.html')); $webAssert = $this->getAssertSession(); - $clicker = $webAssert->elementExists('css', '.elements div#clicker'); + $clicker = $webAssert->elementExists('css', '.elements div#clicker'); $invisible = $webAssert->elementExists('css', '#invisible'); $this->assertFalse($invisible->isVisible()); diff --git a/vendor/behat/mink/driver-testsuite/tests/Form/CheckboxTest.php b/vendor/behat/mink/driver-testsuite/tests/Form/CheckboxTest.php index e1ce4ab16faa01526a8c4f7c83b5be0fa87e22ef..18c4088cdda044f40044984a503751cfee5a4647 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Form/CheckboxTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Form/CheckboxTest.php @@ -53,8 +53,8 @@ public function testCheckboxMultiple() $this->assertEquals('Multicheckbox Test', $webAssert->elementExists('css', 'h1')->getText()); - $updateMail = $webAssert->elementExists('css', '[name="mail_types[]"][value="update"]'); - $spamMail = $webAssert->elementExists('css', '[name="mail_types[]"][value="spam"]'); + $updateMail = $webAssert->elementExists('css', '[name="mail_types[]"][value="update"]'); + $spamMail = $webAssert->elementExists('css', '[name="mail_types[]"][value="spam"]'); $this->assertEquals('update', $updateMail->getValue()); $this->assertNull($spamMail->getValue()); diff --git a/vendor/behat/mink/driver-testsuite/tests/Form/GeneralTest.php b/vendor/behat/mink/driver-testsuite/tests/Form/GeneralTest.php index f15f266e0151ba6c8722db64bb25b1320f3a10ad..0e08d34ebaa5167c4c691674452e553925e7c564 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Form/GeneralTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Form/GeneralTest.php @@ -25,8 +25,8 @@ public function testBasicForm() $page = $this->getSession()->getPage(); $this->assertEquals('Basic Form Page', $webAssert->elementExists('css', 'h1')->getText()); - $firstname = $webAssert->fieldExists('first_name'); - $lastname = $webAssert->fieldExists('lastn'); + $firstname = $webAssert->fieldExists('first_name'); + $lastname = $webAssert->fieldExists('lastn'); $this->assertEquals('Firstname', $firstname->getValue()); $this->assertEquals('Lastname', $lastname->getValue()); @@ -150,15 +150,15 @@ public function testAdvancedForm() $page = $this->getSession()->getPage(); $this->assertEquals('ADvanced Form Page', $webAssert->elementExists('css', 'h1')->getText()); - $firstname = $webAssert->fieldExists('first_name'); - $lastname = $webAssert->fieldExists('lastn'); - $email = $webAssert->fieldExists('Your email:'); - $select = $webAssert->fieldExists('select_number'); - $sex = $webAssert->fieldExists('sex'); - $maillist = $webAssert->fieldExists('mail_list'); - $agreement = $webAssert->fieldExists('agreement'); - $notes = $webAssert->fieldExists('notes'); - $about = $webAssert->fieldExists('about'); + $firstname = $webAssert->fieldExists('first_name'); + $lastname = $webAssert->fieldExists('lastn'); + $email = $webAssert->fieldExists('Your email:'); + $select = $webAssert->fieldExists('select_number'); + $sex = $webAssert->fieldExists('sex'); + $maillist = $webAssert->fieldExists('mail_list'); + $agreement = $webAssert->fieldExists('agreement'); + $notes = $webAssert->fieldExists('notes'); + $about = $webAssert->fieldExists('about'); $this->assertEquals('Firstname', $firstname->getValue()); $this->assertEquals('Lastname', $lastname->getValue()); diff --git a/vendor/behat/mink/driver-testsuite/tests/Form/SelectTest.php b/vendor/behat/mink/driver-testsuite/tests/Form/SelectTest.php index 492625a9566fb39d525953ca4fe7f20eb8b4d22f..f06d5f02f717035e85ca77604c079f33cf5f1a14 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Form/SelectTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Form/SelectTest.php @@ -13,7 +13,7 @@ public function testMultiselect() $page = $this->getSession()->getPage(); $this->assertEquals('Multiselect Test', $webAssert->elementExists('css', 'h1')->getText()); - $select = $webAssert->fieldExists('select_number'); + $select = $webAssert->fieldExists('select_number'); $multiSelect = $webAssert->fieldExists('select_multiple_numbers[]'); $secondMultiSelect = $webAssert->fieldExists('select_multiple_values[]'); @@ -66,8 +66,7 @@ public function testElementSelectedStateCheck($selectName, $optionValue, $option $session->visit($this->pathTo('/multiselect_form.html')); $select = $webAssert->fieldExists($selectName); - $optionValueEscaped = $session->getSelectorsHandler()->xpathLiteral($optionValue); - $option = $webAssert->elementExists('named', array('option', $optionValueEscaped)); + $option = $webAssert->elementExists('named', array('option', $optionValue)); $this->assertFalse($option->isSelected()); $select->selectOption($optionText); diff --git a/vendor/behat/mink/driver-testsuite/tests/Js/ChangeEventTest.php b/vendor/behat/mink/driver-testsuite/tests/Js/ChangeEventTest.php index d1fd3f1676206c124a2f6edc48cf8a7efc2cca1f..4c8a30fcf3158fa927806ae79476a421b9ed6ad8 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Js/ChangeEventTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Js/ChangeEventTest.php @@ -4,10 +4,13 @@ use Behat\Mink\Tests\Driver\TestCase; +/** + * @group slow + */ class ChangeEventTest extends TestCase { /** - * 'change' event should be fired after selecting an <option> in a <select> + * 'change' event should be fired after selecting an <option> in a <select>. * * TODO check whether this test is redundant with other change event tests. */ @@ -19,7 +22,7 @@ public function testIssue255() $session->getPage()->selectFieldOption('foo_select', 'Option 3'); $session->wait(2000, '$("#output_foo_select").text() != ""'); - $this->assertEquals('onChangeSelect', $session->getPage()->find('css', '#output_foo_select')->getText()); + $this->assertEquals('onChangeSelect', $this->getAssertSession()->elementExists('css', '#output_foo_select')->getText()); } public function testIssue178() diff --git a/vendor/behat/mink/driver-testsuite/tests/Js/EventsTest.php b/vendor/behat/mink/driver-testsuite/tests/Js/EventsTest.php index e49d83715fac60ab24d17a6872c1491701f8d5c7..f06999bf41fc493a652af9b50b89ef8c9d715cac 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Js/EventsTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Js/EventsTest.php @@ -96,7 +96,7 @@ public function testKeyboardEvents($modifier, $eventProperties) $input1 = $webAssert->elementExists('css', '.elements input.input.first'); $input2 = $webAssert->elementExists('css', '.elements input.input.second'); $input3 = $webAssert->elementExists('css', '.elements input.input.third'); - $event = $webAssert->elementExists('css', '.elements .text-event'); + $event = $webAssert->elementExists('css', '.elements .text-event'); $input1->keyDown('u', $modifier); $this->assertEquals('key downed:'.$eventProperties, $event->getText()); diff --git a/vendor/behat/mink/driver-testsuite/tests/Js/JavascriptEvaluationTest.php b/vendor/behat/mink/driver-testsuite/tests/Js/JavascriptEvaluationTest.php index 00235d11078a27e9f24b7717c4704248177a97b5..ab6ab27f36d3c4fa43967cf593ec6b77306d8ac5 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Js/JavascriptEvaluationTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Js/JavascriptEvaluationTest.php @@ -25,11 +25,11 @@ public function testWait() $waitable->click(); $this->getSession()->wait(3000, '$("#waitable").has("div").length > 0'); - $this->assertEquals('arrived', $this->getSession()->getPage()->find('css', '#waitable > div')->getText()); + $this->assertEquals('arrived', $this->getAssertSession()->elementExists('css', '#waitable > div')->getText()); $waitable->click(); $this->getSession()->wait(3000, 'false'); - $this->assertEquals('timeout', $this->getSession()->getPage()->find('css', '#waitable > div')->getText()); + $this->assertEquals('timeout', $this->getAssertSession()->elementExists('css', '#waitable > div')->getText()); } /** diff --git a/vendor/behat/mink/driver-testsuite/tests/Js/JavascriptTest.php b/vendor/behat/mink/driver-testsuite/tests/Js/JavascriptTest.php index 86cfa65ba6701bf7752f0810f8385774dab93fdb..ea6d77ae7e8e2d635fced35fb26ecdda5862d746 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Js/JavascriptTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Js/JavascriptTest.php @@ -27,7 +27,7 @@ public function testDragDrop() $droppable = $webAssert->elementExists('css', '#droppable'); $draggable->dragTo($droppable); - $this->assertEquals('Dropped!', $droppable->find('css', 'p')->getText()); + $this->assertEquals('Dropped!', $this->getAssertSession()->elementExists('css', 'p', $droppable)->getText()); } // test accentuated char in button diff --git a/vendor/behat/mink/driver-testsuite/tests/Js/WindowTest.php b/vendor/behat/mink/driver-testsuite/tests/Js/WindowTest.php index 70b9ed96753dd7f6b1cd7ddea3ccf6dd392fdec5..ca4949113eb1430dcffe192376ce469c497c432d 100644 --- a/vendor/behat/mink/driver-testsuite/tests/Js/WindowTest.php +++ b/vendor/behat/mink/driver-testsuite/tests/Js/WindowTest.php @@ -10,7 +10,7 @@ public function testWindow() { $this->getSession()->visit($this->pathTo('/window.html')); $session = $this->getSession(); - $page = $session->getPage(); + $page = $session->getPage(); $webAssert = $this->getAssertSession(); $page->clickLink('Popup #1'); @@ -39,7 +39,7 @@ public function testGetWindowNames() { $this->getSession()->visit($this->pathTo('/window.html')); $session = $this->getSession(); - $page = $session->getPage(); + $page = $session->getPage(); $windowName = $this->getSession()->getWindowName(); @@ -63,7 +63,7 @@ public function testResizeWindow() $session->resizeWindow(400, 300); $session->wait(1000, 'false'); - $script = "return Math.abs(window.outerHeight - 300) <= 100 && Math.abs(window.outerWidth - 400) <= 100;"; + $script = 'return Math.abs(window.outerHeight - 300) <= 100 && Math.abs(window.outerWidth - 400) <= 100;'; $this->assertTrue($session->evaluateScript($script)); } @@ -76,7 +76,7 @@ public function testWindowMaximize() $session->maximizeWindow(); $session->wait(1000, 'false'); - $script = "return Math.abs(screen.availHeight - window.outerHeight) <= 100;"; + $script = 'return Math.abs(screen.availHeight - window.outerHeight) <= 100;'; $this->assertTrue($session->evaluateScript($script)); } diff --git a/vendor/behat/mink/driver-testsuite/tests/TestCase.php b/vendor/behat/mink/driver-testsuite/tests/TestCase.php index ea003ce5c47557b67c0b55af7f831cdb3b255fc0..964a71f87864f71cfbd2a1abb236c8f9f5a240d3 100644 --- a/vendor/behat/mink/driver-testsuite/tests/TestCase.php +++ b/vendor/behat/mink/driver-testsuite/tests/TestCase.php @@ -22,7 +22,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase private static $config; /** - * Initializes the test case + * Initializes the test case. */ public static function setUpBeforeClass() { @@ -102,11 +102,22 @@ protected function getAssertSession() */ protected function findById($id) { - $id = $this->getSession()->getSelectorsHandler()->xpathLiteral($id); - return $this->getAssertSession()->elementExists('named', array('id', $id)); } + /** + * Creates a new driver instance. + * + * This driver is not associated to a session. It is meant to be used for tests on the driver + * implementation itself rather than test using the Mink API. + * + * @return \Behat\Mink\Driver\DriverInterface + */ + protected function createDriver() + { + return self::getConfig()->createDriver(); + } + /** * Map remote file path. * @@ -136,7 +147,7 @@ protected function pathTo($path) } /** - * Waits for a condition to be true, considering than it is successful for drivers not supporting wait() + * Waits for a condition to be true, considering than it is successful for drivers not supporting wait(). * * @param int $time * @param string $condition A JS condition to evaluate diff --git a/vendor/behat/mink/driver-testsuite/web-fixtures/element_change_detector.html b/vendor/behat/mink/driver-testsuite/web-fixtures/element_change_detector.html index af3032a4610e79ffcce418f08dd3b5a1711c89b2..c309baefadd2c35006ceadd19765c2da974a3587 100644 --- a/vendor/behat/mink/driver-testsuite/web-fixtures/element_change_detector.html +++ b/vendor/behat/mink/driver-testsuite/web-fixtures/element_change_detector.html @@ -41,7 +41,7 @@ <h1>ADvanced Form Page</h1> var $change_registry = {}, $results = $('#results'); - $(':input').change(function ($e) { + $(':input').change(function () { var $result_id = this.id + '-result'; if (!$change_registry[this.id]) { diff --git a/vendor/behat/mink/driver-testsuite/web-fixtures/index.html b/vendor/behat/mink/driver-testsuite/web-fixtures/index.html index 6bb379c1285f828c74a9f77d00651f477a4815d2..cc8c821ced141e93444778b4ee5a4e82830874ec 100644 --- a/vendor/behat/mink/driver-testsuite/web-fixtures/index.html +++ b/vendor/behat/mink/driver-testsuite/web-fixtures/index.html @@ -9,6 +9,10 @@ <h1>Extremely useless page</h1> <div id="core"> <strong>Lorem</strong> ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim <strong>veniam</strong>, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla <strong class="super-duper">pariatur</strong>. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + <div id="empty"> + An empty <em></em> tag should be rendered with both open and close tags. + </div> + <div id="some-element" data-href="http://mink.behat.org"> some <div>very </div> diff --git a/vendor/behat/mink/driver-testsuite/web-fixtures/issue225.html b/vendor/behat/mink/driver-testsuite/web-fixtures/issue225.html index 2178bba9eac72743950fd2377e085998ceb210f0..13214631fab60a25c6a60ba5330f2db55ab9c2d7 100644 --- a/vendor/behat/mink/driver-testsuite/web-fixtures/issue225.html +++ b/vendor/behat/mink/driver-testsuite/web-fixtures/issue225.html @@ -12,7 +12,7 @@ <div id="panel"></div> <script type="text/javascript"> - $('#btn').click(function (event) { + $('#btn').click(function () { $('#panel').text('OH ' + 'AIH!'); }); </script> diff --git a/vendor/behat/mink/driver-testsuite/web-fixtures/js_test.html b/vendor/behat/mink/driver-testsuite/web-fixtures/js_test.html index e965a40881eb5897fdc802c6a0535df14cf648a7..6285455e9d0d8e8a572d8c2ce3716d25e682a430 100644 --- a/vendor/behat/mink/driver-testsuite/web-fixtures/js_test.html +++ b/vendor/behat/mink/driver-testsuite/web-fixtures/js_test.html @@ -44,23 +44,27 @@ <script src="js/jquery-ui-1.8.14.custom.min.js"></script> <script> $(document).ready(function() { - $('#clicker').click(function() { + var $clicker = $('#clicker'); + + $clicker.click(function() { $(this).text('single clicked'); }); - $('#clicker').dblclick(function() { + $clicker.dblclick(function() { $(this).text('double clicked'); }); - $('#clicker').bind('contextmenu', function() { + $clicker.bind('contextmenu', function() { $(this).text('right clicked'); }); - $('#focus-blur-detector').focus(function() { + var $focusDetector = $('#focus-blur-detector'); + + $focusDetector.focus(function() { $(this).val('focused'); }); - $('#focus-blur-detector').blur(function() { + $focusDetector.blur(function() { $(this).val('blured'); }); diff --git a/vendor/behat/mink/src/Driver/CoreDriver.php b/vendor/behat/mink/src/Driver/CoreDriver.php index 248f291ea681291a2b9e54faf068339dedf9c4dd..9b4c04e43208234ed3b6ff5ab6ac42959d6cedd9 100644 --- a/vendor/behat/mink/src/Driver/CoreDriver.php +++ b/vendor/behat/mink/src/Driver/CoreDriver.php @@ -10,6 +10,7 @@ namespace Behat\Mink\Driver; +use Behat\Mink\Element\NodeElement; use Behat\Mink\Exception\UnsupportedDriverActionException; use Behat\Mink\Session; @@ -21,12 +22,17 @@ */ abstract class CoreDriver implements DriverInterface { + /** + * @var Session + */ + private $session; + /** * {@inheritdoc} */ public function setSession(Session $session) { - throw new UnsupportedDriverActionException('Setting the session is not supported by %s', $this); + $this->session = $session; } /** @@ -89,6 +95,28 @@ public function getContent() * {@inheritdoc} */ public function find($xpath) + { + $elements = array(); + + foreach ($this->findElementXpaths($xpath) as $xpath) { + $elements[] = new NodeElement($xpath, $this->session); + } + + return $elements; + } + + /** + * Finds elements with specified XPath query. + * + * @see find() + * + * @param string $xpath + * + * @return string[] The XPath of the matched elements + * + * @throws UnsupportedDriverActionException When operation not supported by the driver + */ + protected function findElementXpaths($xpath) { throw new UnsupportedDriverActionException('Finding elements is not supported by %s', $this); } diff --git a/vendor/behat/mink/src/Driver/DriverInterface.php b/vendor/behat/mink/src/Driver/DriverInterface.php index 8357caa8b905bd38249de468562fa6d3f2c26a1c..0880960c779d8757d4b29e66a3bca317c0546d28 100644 --- a/vendor/behat/mink/src/Driver/DriverInterface.php +++ b/vendor/behat/mink/src/Driver/DriverInterface.php @@ -140,7 +140,7 @@ public function forward(); public function back(); /** - * Sets HTTP Basic authentication parameters + * Sets HTTP Basic authentication parameters. * * @param string|Boolean $user user name or false to disable authentication * @param string $password password @@ -217,7 +217,7 @@ public function getCookie($name); /** * Returns last response status code. * - * @return integer + * @return int * * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done @@ -519,9 +519,9 @@ public function blur($xpath); /** * Presses specific keyboard key. * - * @param string $xpath - * @param string|integer $char could be either char ('b') or char-code (98) - * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') + * @param string $xpath + * @param string|int $char could be either char ('b') or char-code (98) + * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') * * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done @@ -531,9 +531,9 @@ public function keyPress($xpath, $char, $modifier = null); /** * Pressed down specific keyboard key. * - * @param string $xpath - * @param string|integer $char could be either char ('b') or char-code (98) - * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') + * @param string $xpath + * @param string|int $char could be either char ('b') or char-code (98) + * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') * * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done @@ -543,9 +543,9 @@ public function keyDown($xpath, $char, $modifier = null); /** * Pressed up specific keyboard key. * - * @param string $xpath - * @param string|integer $char could be either char ('b') or char-code (98) - * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') + * @param string $xpath + * @param string|int $char could be either char ('b') or char-code (98) + * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') * * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done @@ -591,10 +591,10 @@ public function evaluateScript($script); /** * Waits some time or until JS condition turns true. * - * @param integer $timeout timeout in milliseconds - * @param string $condition JS condition + * @param int $timeout timeout in milliseconds + * @param string $condition JS condition * - * @return boolean + * @return bool * * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done @@ -604,9 +604,9 @@ public function wait($timeout, $condition); /** * Set the dimensions of the window. * - * @param integer $width set the window width, measured in pixels - * @param integer $height set the window height, measured in pixels - * @param string $name window name (null for the main window) + * @param int $width set the window width, measured in pixels + * @param int $height set the window height, measured in pixels + * @param string $name window name (null for the main window) * * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done @@ -614,7 +614,7 @@ public function wait($timeout, $condition); public function resizeWindow($width, $height, $name = null); /** - * Maximize the window if it is not maximized already + * Maximizes the window if it is not maximized already. * * @param string $name window name (null for the main window) * diff --git a/vendor/behat/mink/src/Element/DocumentElement.php b/vendor/behat/mink/src/Element/DocumentElement.php index edde3c35392bd138520130faa0efeb22c77d6cb4..c2daf6601febdaab4d3a3ba6ad479bcf94f0c46d 100644 --- a/vendor/behat/mink/src/Element/DocumentElement.php +++ b/vendor/behat/mink/src/Element/DocumentElement.php @@ -46,8 +46,6 @@ public function getContent() */ public function hasContent($content) { - return $this->has('named', array( - 'content', $this->getSelectorsHandler()->xpathLiteral($content), - )); + return $this->has('named', array('content', $content)); } } diff --git a/vendor/behat/mink/src/Element/Element.php b/vendor/behat/mink/src/Element/Element.php index 07e1e119efd5098a7bc9e800ff3d9a30bae796c8..a2b6c0ef33f236a053748aca67492a0308f97a62 100644 --- a/vendor/behat/mink/src/Element/Element.php +++ b/vendor/behat/mink/src/Element/Element.php @@ -68,6 +68,8 @@ public function __construct(Session $session) */ public function getSession() { + @trigger_error(sprintf('The method %s is deprecated as of 1.6 and will be removed in 2.0', __METHOD__), E_USER_DEPRECATED); + return $this->session; } @@ -85,9 +87,13 @@ protected function getDriver() * Returns selectors handler. * * @return SelectorsHandler + * + * @deprecated Accessing the selectors handler in the element is deprecated as of 1.7 and will be impossible in 2.0. */ protected function getSelectorsHandler() { + @trigger_error(sprintf('The method %s is deprecated as of 1.7 and will be removed in 2.0', __METHOD__), E_USER_DEPRECATED); + return $this->selectorsHandler; } @@ -156,7 +162,7 @@ public function findAll($selector, $locator) return $items; } - $xpath = $this->getSelectorsHandler()->selectorToXpath($selector, $locator); + $xpath = $this->selectorsHandler->selectorToXpath($selector, $locator); $xpath = $this->xpathManipulator->prepend($xpath, $this->getXpath()); return $this->getDriver()->find($xpath); @@ -189,19 +195,20 @@ public function getOuterHtml() } /** - * Builds an ElementNotFoundException - * - * This is an helper to build the ElementNotFoundException without - * needing to use the deprecated getSession accessor in child classes. + * Builds an ElementNotFoundException. * * @param string $type * @param string|null $selector * @param string|null $locator * * @return ElementNotFoundException + * + * @deprecated as of 1.7, to be removed in 2.0 */ protected function elementNotFound($type, $selector = null, $locator = null) { - return new ElementNotFoundException($this->session, $type, $selector, $locator); + @trigger_error(sprintf('The method %s is deprecated as of 1.7 and will be removed in 2.0', __METHOD__), E_USER_DEPRECATED); + + return new ElementNotFoundException($this->driver, $type, $selector, $locator); } } diff --git a/vendor/behat/mink/src/Element/ElementInterface.php b/vendor/behat/mink/src/Element/ElementInterface.php index 8c134b96fcd5da1c94bd3bcb93e99af5084d0cb1..1d9cc4f9ec0a1fa059040290298b6d3a4c10b136 100644 --- a/vendor/behat/mink/src/Element/ElementInterface.php +++ b/vendor/behat/mink/src/Element/ElementInterface.php @@ -50,7 +50,7 @@ public function has($selector, $locator); /** * Checks if an element still exists in the DOM. * - * @return boolean + * @return bool */ public function isValid(); @@ -62,6 +62,7 @@ public function isValid(); * Will receive reference to `this element` as first argument. * * @return mixed + * * @throws \InvalidArgumentException When invalid callback given. */ public function waitFor($timeout, $callback); diff --git a/vendor/behat/mink/src/Element/NodeElement.php b/vendor/behat/mink/src/Element/NodeElement.php index 8e43546267a0bdbb217782954f99c984688656cb..bbb857332ca0703934bff830c182aec1ca5bf38b 100644 --- a/vendor/behat/mink/src/Element/NodeElement.php +++ b/vendor/behat/mink/src/Element/NodeElement.php @@ -130,16 +130,16 @@ public function getAttribute($name) } /** - * Checks whether an element has a named CSS class + * Checks whether an element has a named CSS class. * * @param string $className Name of the class * - * @return boolean + * @return bool */ public function hasClass($className) { if ($this->hasAttribute('class')) { - return in_array($className, explode(' ', $this->getAttribute('class'))); + return in_array($className, preg_split('/\s+/', $this->getAttribute('class'))); } return false; @@ -206,7 +206,7 @@ public function isChecked() } /** - * Selects specified option for select field or specified radio button in the group + * Selects specified option for select field or specified radio button in the group. * * If the current node is a select box, this selects the option found by its value or * its text. @@ -228,12 +228,10 @@ public function selectOption($option, $multiple = false) return; } - $opt = $this->find('named', array( - 'option', $this->getSelectorsHandler()->xpathLiteral($option), - )); + $opt = $this->find('named', array('option', $option)); if (null === $opt) { - throw $this->elementNotFound('select option', 'value|text', $option); + throw new ElementNotFoundException($this->getDriver(), 'select option', 'value|text', $option); } $this->getDriver()->selectOption($this->getXpath(), $opt->getValue(), $multiple); @@ -310,8 +308,8 @@ public function blur() /** * Presses specific keyboard key. * - * @param string|integer $char could be either char ('b') or char-code (98) - * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') + * @param string|int $char could be either char ('b') or char-code (98) + * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') */ public function keyPress($char, $modifier = null) { @@ -321,8 +319,8 @@ public function keyPress($char, $modifier = null) /** * Pressed down specific keyboard key. * - * @param string|integer $char could be either char ('b') or char-code (98) - * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') + * @param string|int $char could be either char ('b') or char-code (98) + * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') */ public function keyDown($char, $modifier = null) { @@ -332,8 +330,8 @@ public function keyDown($char, $modifier = null) /** * Pressed up specific keyboard key. * - * @param string|integer $char could be either char ('b') or char-code (98) - * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') + * @param string|int $char could be either char ('b') or char-code (98) + * @param string $modifier keyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta') */ public function keyUp($char, $modifier = null) { diff --git a/vendor/behat/mink/src/Element/TraversableElement.php b/vendor/behat/mink/src/Element/TraversableElement.php index 0621af3e55d99609577713c18084b8a12e5e9625..a5e05b9991ba81e197502ec9ae71912a4eeb6317 100644 --- a/vendor/behat/mink/src/Element/TraversableElement.php +++ b/vendor/behat/mink/src/Element/TraversableElement.php @@ -28,8 +28,6 @@ abstract class TraversableElement extends Element */ public function findById($id) { - $id = $this->getSelectorsHandler()->xpathLiteral($id); - return $this->find('named', array('id', $id)); } @@ -54,9 +52,7 @@ public function hasLink($locator) */ public function findLink($locator) { - return $this->find('named', array( - 'link', $this->getSelectorsHandler()->xpathLiteral($locator), - )); + return $this->find('named', array('link', $locator)); } /** @@ -71,7 +67,7 @@ public function clickLink($locator) $link = $this->findLink($locator); if (null === $link) { - throw $this->elementNotFound('link', 'id|title|alt|text', $locator); + throw new ElementNotFoundException($this->getDriver(), 'link', 'id|title|alt|text', $locator); } $link->click(); @@ -98,9 +94,7 @@ public function hasButton($locator) */ public function findButton($locator) { - return $this->find('named', array( - 'button', $this->getSelectorsHandler()->xpathLiteral($locator), - )); + return $this->find('named', array('button', $locator)); } /** @@ -115,7 +109,7 @@ public function pressButton($locator) $button = $this->findButton($locator); if (null === $button) { - throw $this->elementNotFound('button', 'id|name|title|alt|value', $locator); + throw new ElementNotFoundException($this->getDriver(), 'button', 'id|name|title|alt|value', $locator); } $button->press(); @@ -142,9 +136,7 @@ public function hasField($locator) */ public function findField($locator) { - return $this->find('named', array( - 'field', $this->getSelectorsHandler()->xpathLiteral($locator), - )); + return $this->find('named', array('field', $locator)); } /** @@ -162,7 +154,7 @@ public function fillField($locator, $value) $field = $this->findField($locator); if (null === $field) { - throw $this->elementNotFound('form field', 'id|name|label|value', $locator); + throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value|placeholder', $locator); } $field->setValue($value); @@ -212,7 +204,7 @@ public function checkField($locator) $field = $this->findField($locator); if (null === $field) { - throw $this->elementNotFound('form field', 'id|name|label|value', $locator); + throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->check(); @@ -230,7 +222,7 @@ public function uncheckField($locator) $field = $this->findField($locator); if (null === $field) { - throw $this->elementNotFound('form field', 'id|name|label|value', $locator); + throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->uncheck(); @@ -245,9 +237,7 @@ public function uncheckField($locator) */ public function hasSelect($locator) { - return $this->has('named', array( - 'select', $this->getSelectorsHandler()->xpathLiteral($locator), - )); + return $this->has('named', array('select', $locator)); } /** @@ -266,7 +256,7 @@ public function selectFieldOption($locator, $value, $multiple = false) $field = $this->findField($locator); if (null === $field) { - throw $this->elementNotFound('form field', 'id|name|label|value', $locator); + throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->selectOption($value, $multiple); @@ -281,9 +271,7 @@ public function selectFieldOption($locator, $value, $multiple = false) */ public function hasTable($locator) { - return $this->has('named', array( - 'table', $this->getSelectorsHandler()->xpathLiteral($locator), - )); + return $this->has('named', array('table', $locator)); } /** @@ -301,7 +289,7 @@ public function attachFileToField($locator, $path) $field = $this->findField($locator); if (null === $field) { - throw $this->elementNotFound('form field', 'id|name|label|value', $locator); + throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator); } $field->attachFile($path); diff --git a/vendor/behat/mink/src/Exception/ElementException.php b/vendor/behat/mink/src/Exception/ElementException.php index 49d5c6c9d59d7be20990875766101d9d7fd0827d..16ebdc9813c98a3aeb15cb1613e9dd8625b66070 100644 --- a/vendor/behat/mink/src/Exception/ElementException.php +++ b/vendor/behat/mink/src/Exception/ElementException.php @@ -10,10 +10,12 @@ namespace Behat\Mink\Exception; +@trigger_error('The class '.__NAMESPACE__.'\ElementException is deprecated as of Mink 1.6 and will be removed in 2.0', E_USER_DEPRECATED); + use Behat\Mink\Element\Element; /** - * A standard way for elements to re-throw exceptions + * A standard way for elements to re-throw exceptions. * * @deprecated This exception class is not used anymore in Mink 1.6 and will be removed in 2.0 * @@ -47,7 +49,7 @@ public function __toString() } /** - * Get the element that caused the exception + * Get the element that caused the exception. * * @return Element */ diff --git a/vendor/behat/mink/src/Exception/ElementHtmlException.php b/vendor/behat/mink/src/Exception/ElementHtmlException.php index 99e2ea601dabb4549b7fa3b044e1ccd9a2060794..fb2fed68ef82354ac72452b7cdb858bc0f807d36 100644 --- a/vendor/behat/mink/src/Exception/ElementHtmlException.php +++ b/vendor/behat/mink/src/Exception/ElementHtmlException.php @@ -10,8 +10,9 @@ namespace Behat\Mink\Exception; -use Behat\Mink\Session; +use Behat\Mink\Driver\DriverInterface; use Behat\Mink\Element\Element; +use Behat\Mink\Session; /** * Exception thrown when an expectation on the HTML of an element fails. @@ -30,16 +31,16 @@ class ElementHtmlException extends ExpectationException /** * Initializes exception. * - * @param string $message optional message - * @param Session $session session instance - * @param Element $element element - * @param \Exception $exception expectation exception + * @param string $message optional message + * @param DriverInterface|Session $driver driver instance + * @param Element $element element + * @param \Exception $exception expectation exception */ - public function __construct($message, Session $session, Element $element, \Exception $exception = null) + public function __construct($message, $driver, Element $element, \Exception $exception = null) { $this->element = $element; - parent::__construct($message, $session, $exception); + parent::__construct($message, $driver, $exception); } protected function getContext() diff --git a/vendor/behat/mink/src/Exception/ElementNotFoundException.php b/vendor/behat/mink/src/Exception/ElementNotFoundException.php index 95fd5f0b8739a1e8d11de245b4dcbe36fb4b9ae2..6716ab3ff70b252614f01cfadaa434707806e0b2 100644 --- a/vendor/behat/mink/src/Exception/ElementNotFoundException.php +++ b/vendor/behat/mink/src/Exception/ElementNotFoundException.php @@ -10,6 +10,7 @@ namespace Behat\Mink\Exception; +use Behat\Mink\Driver\DriverInterface; use Behat\Mink\Session; /** @@ -22,12 +23,12 @@ class ElementNotFoundException extends ExpectationException /** * Initializes exception. * - * @param Session $session session instance - * @param string $type element type - * @param string $selector element selector type - * @param string $locator element locator + * @param DriverInterface|Session $driver driver instance + * @param string $type element type + * @param string $selector element selector type + * @param string $locator element locator */ - public function __construct(Session $session, $type = null, $selector = null, $locator = null) + public function __construct($driver, $type = null, $selector = null, $locator = null) { $message = ''; @@ -48,6 +49,6 @@ public function __construct(Session $session, $type = null, $selector = null, $l $message .= ' not found.'; - parent::__construct($message, $session); + parent::__construct($message, $driver); } } diff --git a/vendor/behat/mink/src/Exception/ExpectationException.php b/vendor/behat/mink/src/Exception/ExpectationException.php index 25034d1e73e6f8e96f3a7fe3a54bcdf94d12361d..35f7150a29896c7b1cb7b3a2feab7442e860a5cd 100644 --- a/vendor/behat/mink/src/Exception/ExpectationException.php +++ b/vendor/behat/mink/src/Exception/ExpectationException.php @@ -10,6 +10,7 @@ namespace Behat\Mink\Exception; +use Behat\Mink\Driver\DriverInterface; use Behat\Mink\Session; /** @@ -22,17 +23,28 @@ class ExpectationException extends Exception { private $session; + private $driver; /** * Initializes exception. * - * @param string $message optional message - * @param Session $session session instance - * @param \Exception $exception expectation exception + * @param string $message optional message + * @param DriverInterface|Session $driver driver instance (or session for BC) + * @param \Exception|null $exception expectation exception */ - public function __construct($message, Session $session, \Exception $exception = null) + public function __construct($message, $driver, \Exception $exception = null) { - $this->session = $session; + if ($driver instanceof Session) { + @trigger_error('Passing a Session object to the ExpectationException constructor is deprecated as of Mink 1.7. Pass the driver instead.', E_USER_DEPRECATED); + + $this->session = $driver; + $this->driver = $driver->getDriver(); + } elseif (!$driver instanceof DriverInterface) { + // Trigger an exception as we cannot typehint a disjunction + throw new \InvalidArgumentException('The ExpectationException constructor expects a DriverInterface or a Session.'); + } else { + $this->driver = $driver; + } if (!$message && null !== $exception) { $message = $exception->getMessage(); @@ -50,7 +62,7 @@ public function __toString() { try { $pageText = $this->pipeString($this->trimString($this->getContext())."\n"); - $string = sprintf("%s\n\n%s%s", $this->getMessage(), $this->getResponseInfo(), $pageText); + $string = sprintf("%s\n\n%s%s", $this->getMessage(), $this->getResponseInfo(), $pageText); } catch (\Exception $e) { return $this->getMessage(); } @@ -59,22 +71,40 @@ public function __toString() } /** - * Gets the context rendered for this exception + * Gets the context rendered for this exception. * * @return string */ protected function getContext() { - return $this->trimBody($this->getSession()->getPage()->getContent()); + return $this->trimBody($this->driver->getContent()); + } + + /** + * Returns driver. + * + * @return DriverInterface + */ + protected function getDriver() + { + return $this->driver; } /** * Returns exception session. * * @return Session + * + * @deprecated since 1.7, to be removed in 2.0. Use getDriver and the driver API instead. */ protected function getSession() { + if (null === $this->session) { + throw new \LogicException(sprintf('The deprecated method %s cannot be used when passing a driver in the constructor', __METHOD__)); + } + + @trigger_error(sprintf('The method %s is deprecated as of Mink 1.7 and will be removed in 2.0. Use getDriver and the driver API instead.')); + return $this->session; } @@ -107,8 +137,8 @@ protected function trimBody($string) /** * Trims string to specified number of chars. * - * @param string $string response content - * @param integer $count trim count + * @param string $string response content + * @param int $count trim count * * @return string */ @@ -130,15 +160,15 @@ protected function trimString($string, $count = 1000) */ protected function getResponseInfo() { - $driver = basename(str_replace('\\', '/', get_class($this->session->getDriver()))); + $driver = basename(str_replace('\\', '/', get_class($this->driver))); $info = '+--[ '; try { - $info .= 'HTTP/1.1 '.$this->session->getStatusCode().' | '; + $info .= 'HTTP/1.1 '.$this->driver->getStatusCode().' | '; } catch (UnsupportedDriverActionException $e) { // Ignore the status code when not supported } - $info .= $this->session->getCurrentUrl().' | '.$driver." ]\n|\n"; + $info .= $this->driver->getCurrentUrl().' | '.$driver." ]\n|\n"; return $info; } diff --git a/vendor/behat/mink/src/Exception/ResponseTextException.php b/vendor/behat/mink/src/Exception/ResponseTextException.php index 145ed6da05b1f91025ed7a9ec92cd7d0d5670900..515c5694df5b22c70134c2568e623bed1f8b102e 100644 --- a/vendor/behat/mink/src/Exception/ResponseTextException.php +++ b/vendor/behat/mink/src/Exception/ResponseTextException.php @@ -19,6 +19,6 @@ class ResponseTextException extends ExpectationException { protected function getContext() { - return $this->getSession()->getPage()->getText(); + return $this->getDriver()->getText('//html'); } } diff --git a/vendor/behat/mink/src/Mink.php b/vendor/behat/mink/src/Mink.php index d1621b174438f87e6bd3fa25f1d3b73864f86b34..333bfbdecea1048e4d9ba9b02082a3526f08e82b 100644 --- a/vendor/behat/mink/src/Mink.php +++ b/vendor/behat/mink/src/Mink.php @@ -121,7 +121,7 @@ public function getSession($name = null) } /** - * Checks whether a named session (or the default session) has already been started + * Checks whether a named session (or the default session) has already been started. * * @param string $name session name - if null then the default session will be checked * diff --git a/vendor/behat/mink/src/Selector/NamedSelector.php b/vendor/behat/mink/src/Selector/NamedSelector.php index 4845f994f9e09368c95e1acfefecc874d3a156b8..d1936cc12ed78bea3c55f8bfcc45b34ab1ae960e 100644 --- a/vendor/behat/mink/src/Selector/NamedSelector.php +++ b/vendor/behat/mink/src/Selector/NamedSelector.php @@ -10,6 +10,8 @@ namespace Behat\Mink\Selector; +use Behat\Mink\Selector\Xpath\Escaper; + /** * Named selectors engine. Uses registered XPath selectors to create new expressions. * @@ -157,12 +159,15 @@ class NamedSelector implements SelectorInterface .//*[%idOrNameMatch%] XPATH ); + private $xpathEscaper; /** * Creates selector instance. */ public function __construct() { + $this->xpathEscaper = new Escaper(); + foreach ($this->replacements as $from => $to) { $this->replacements[$from] = strtr($to, $this->replacements); } @@ -199,11 +204,11 @@ public function translateToXPath($locator) } if (2 == count($locator)) { - $selector = $locator[0]; - $locator = $locator[1]; + $selector = $locator[0]; + $locator = $locator[1]; } else { - $selector = (string) $locator; - $locator = null; + $selector = (string) $locator; + $locator = null; } if (!isset($this->selectors[$selector])) { @@ -217,14 +222,14 @@ public function translateToXPath($locator) $xpath = $this->selectors[$selector]; if (null !== $locator) { - $xpath = strtr($xpath, array('%locator%' => $locator)); + $xpath = strtr($xpath, array('%locator%' => $this->escapeLocator($locator))); } return $xpath; } /** - * Registers a replacement in the list of replacements + * Registers a replacement in the list of replacements. * * This method must be called in the constructor before calling the parent constructor. * @@ -235,4 +240,24 @@ protected function registerReplacement($from, $to) { $this->replacements[$from] = $to; } + + private function escapeLocator($locator) + { + // If the locator looks like an escaped one, don't escape it again for BC reasons. + if ( + preg_match('/^\'[^\']*+\'$/', $locator) + || (false !== strpos($locator, '\'') && preg_match('/^"[^"]*+"$/', $locator)) + || ((8 < $length = strlen($locator)) && 'concat(' === substr($locator, 0, 7) && ')' === $locator[$length - 1]) + ) { + @trigger_error( + 'Passing an escaped locator to the named selector is deprecated as of 1.7 and will be removed in 2.0.' + .' Pass the raw value instead.', + E_USER_DEPRECATED + ); + + return $locator; + } + + return $this->xpathEscaper->escapeLiteral($locator); + } } diff --git a/vendor/behat/mink/src/Selector/SelectorsHandler.php b/vendor/behat/mink/src/Selector/SelectorsHandler.php index a19de675158a46af3e11d4839706b2e2dc5318f1..09b947ca5fe8d9ce3d33247b2069d4de5233acd5 100644 --- a/vendor/behat/mink/src/Selector/SelectorsHandler.php +++ b/vendor/behat/mink/src/Selector/SelectorsHandler.php @@ -75,7 +75,7 @@ public function isSelectorRegistered($name) public function getSelector($name) { if ('named' === $name) { - trigger_error( + @trigger_error( 'Using the "named" selector directly from the handler is deprecated as of 1.6 and will be removed in 2.0.' .' Use the "named_partial" or use the "named" selector through the Element API instead.', E_USER_DEPRECATED @@ -114,12 +114,22 @@ public function selectorToXpath($selector, $locator) /** * Translates string to XPath literal. * + * @deprecated since Mink 1.7. Use \Behat\Mink\Selector\Xpath\Escaper::escapeLiteral when building Xpath + * or pass the unescaped value when using the named selector. + * * @param string $s * * @return string */ public function xpathLiteral($s) { + @trigger_error( + 'The '.__METHOD__.' method is deprecated as of 1.7 and will be removed in 2.0.' + .' Use \Behat\Mink\Selector\Xpath\Escaper::escapeLiteral instead when building Xpath' + .' or pass the unescaped value when using the named selector.', + E_USER_DEPRECATED + ); + return $this->escaper->escapeLiteral($s); } } diff --git a/vendor/behat/mink/src/Selector/Xpath/Escaper.php b/vendor/behat/mink/src/Selector/Xpath/Escaper.php index be3500018dc97ed5dadcb54398b1f2a947c60a3a..c3aa7a3bab2b67f0f2071bfc4f9589109f17acb6 100644 --- a/vendor/behat/mink/src/Selector/Xpath/Escaper.php +++ b/vendor/behat/mink/src/Selector/Xpath/Escaper.php @@ -47,6 +47,6 @@ public function escapeLiteral($s) } } - return sprintf("concat(%s)", implode($parts, ',')); + return sprintf('concat(%s)', implode($parts, ',')); } } diff --git a/vendor/behat/mink/src/Session.php b/vendor/behat/mink/src/Session.php index c67f7f9b4e1865087cbb0bd85284d8f28c3291b3..c8815f9582ac790de778036324a5d42cf0efa4a7 100644 --- a/vendor/behat/mink/src/Session.php +++ b/vendor/behat/mink/src/Session.php @@ -39,9 +39,9 @@ public function __construct(DriverInterface $driver, SelectorsHandler $selectors $selectorsHandler = new SelectorsHandler(); } - $this->driver = $driver; + $this->driver = $driver; $this->selectorsHandler = $selectorsHandler; - $this->page = new DocumentElement($this); + $this->page = new DocumentElement($this); } /** @@ -144,7 +144,7 @@ public function visit($url) } /** - * Sets HTTP Basic authentication parameters + * Sets HTTP Basic authentication parameters. * * @param string|Boolean $user user name or false to disable authentication * @param string $password password @@ -175,6 +175,27 @@ public function getResponseHeaders() return $this->driver->getResponseHeaders(); } + /** + * Returns specific response header. + * + * @param string $name + * + * @return string|null + */ + public function getResponseHeader($name) + { + $headers = $this->driver->getResponseHeaders(); + + $name = strtolower($name); + $headers = array_change_key_case($headers, CASE_LOWER); + + if (!isset($headers[$name])) { + return null; + } + + return is_array($headers[$name]) ? $headers[$name][0] : $headers[$name]; + } + /** * Sets cookie. * @@ -201,7 +222,7 @@ public function getCookie($name) /** * Returns response status code. * - * @return integer + * @return int */ public function getStatusCode() { @@ -230,7 +251,7 @@ public function getScreenshot() } /** - * Return the names of all open windows + * Return the names of all open windows. * * @return array Array of all open window's names. */ @@ -240,7 +261,7 @@ public function getWindowNames() } /** - * Return the name of the currently active window + * Return the name of the currently active window. * * @return string The name of the current window. */ @@ -318,10 +339,10 @@ public function evaluateScript($script) /** * Waits some time or until JS condition turns true. * - * @param integer $time time in milliseconds - * @param string $condition JS condition + * @param int $time time in milliseconds + * @param string $condition JS condition * - * @return boolean + * @return bool */ public function wait($time, $condition = 'false') { @@ -331,9 +352,9 @@ public function wait($time, $condition = 'false') /** * Set the dimensions of the window. * - * @param integer $width set the window width, measured in pixels - * @param integer $height set the window height, measured in pixels - * @param string $name window name (null for the main window) + * @param int $width set the window width, measured in pixels + * @param int $height set the window height, measured in pixels + * @param string $name window name (null for the main window) */ public function resizeWindow($width, $height, $name = null) { @@ -341,7 +362,7 @@ public function resizeWindow($width, $height, $name = null) } /** - * Maximize the window if it is not maximized already + * Maximize the window if it is not maximized already. * * @param string $name window name (null for the main window) */ diff --git a/vendor/behat/mink/src/WebAssert.php b/vendor/behat/mink/src/WebAssert.php index 127c3c14b349e93acdba3719e4731c0aace6bf26..0f0e6fa71b93ef0a20b967fcb1cb9221b488e044 100644 --- a/vendor/behat/mink/src/WebAssert.php +++ b/vendor/behat/mink/src/WebAssert.php @@ -49,7 +49,7 @@ public function __construct(Session $session) public function addressEquals($page) { $expected = $this->cleanUrl($page); - $actual = $this->getCurrentUrlPath(); + $actual = $this->getCurrentUrlPath(); $this->assert($actual === $expected, sprintf('Current page is "%s", but "%s" expected.', $actual, $expected)); } @@ -64,7 +64,7 @@ public function addressEquals($page) public function addressNotEquals($page) { $expected = $this->cleanUrl($page); - $actual = $this->getCurrentUrlPath(); + $actual = $this->getCurrentUrlPath(); $this->assert($actual !== $expected, sprintf('Current page is "%s", but should not be.', $actual)); } @@ -85,7 +85,7 @@ public function addressMatches($regex) } /** - * Checks that specified cookie exists and its value equals to a given one + * Checks that specified cookie exists and its value equals to a given one. * * @param string $name cookie name * @param string $value cookie value @@ -103,7 +103,7 @@ public function cookieEquals($name, $value) } /** - * Checks that specified cookie exists + * Checks that specified cookie exists. * * @param string $name cookie name * @@ -118,7 +118,7 @@ public function cookieExists($name) /** * Checks that current response code equals to provided one. * - * @param integer $code + * @param int $code * * @throws ExpectationException */ @@ -133,7 +133,7 @@ public function statusCodeEquals($code) /** * Checks that current response code not equals to provided one. * - * @param integer $code + * @param int $code * * @throws ExpectationException */ @@ -145,6 +145,106 @@ public function statusCodeNotEquals($code) $this->assert(intval($code) !== intval($actual), $message); } + /** + * Checks that current response header equals value. + * + * @param string $name + * @param string $value + * + * @throws ExpectationException + */ + public function responseHeaderEquals($name, $value) + { + $actual = $this->session->getResponseHeader($name); + $message = sprintf('Current response header "%s" is "%s", but "%s" expected.', $name, $actual, $value); + + $this->assert($value === $actual, $message); + } + + /** + * Checks that current response header does not equal value. + * + * @param string $name + * @param string $value + * + * @throws ExpectationException + */ + public function responseHeaderNotEquals($name, $value) + { + $actual = $this->session->getResponseHeader($name); + $message = sprintf('Current response header "%s" is "%s", but should not be.', $name, $actual, $value); + + $this->assert($value !== $actual, $message); + } + + /** + * Checks that current response header contains value. + * + * @param string $name + * @param string $value + * + * @throws ExpectationException + */ + public function responseHeaderContains($name, $value) + { + $actual = $this->session->getResponseHeader($name); + $message = sprintf('The text "%s" was not found anywhere in the "%s" response header.', $value, $name); + + $this->assert(false !== stripos($actual, $value), $message); + } + + /** + * Checks that current response header does not contain value. + * + * @param string $name + * @param string $value + * + * @throws ExpectationException + */ + public function responseHeaderNotContains($name, $value) + { + $actual = $this->session->getResponseHeader($name); + $message = sprintf('The text "%s" was found in the "%s" response header, but it should not.', $value, $name); + + $this->assert(false === stripos($actual, $value), $message); + } + + /** + * Checks that current response header matches regex. + * + * @param string $name + * @param string $regex + * + * @throws ExpectationException + */ + public function responseHeaderMatches($name, $regex) + { + $actual = $this->session->getResponseHeader($name); + $message = sprintf('The pattern "%s" was not found anywhere in the "%s" response header.', $regex, $name); + + $this->assert((bool) preg_match($regex, $actual), $message); + } + + /** + * Checks that current response header does not match regex. + * + * @param string $name + * @param string $regex + * + * @throws ExpectationException + */ + public function responseHeaderNotMatches($name, $regex) + { + $actual = $this->session->getResponseHeader($name); + $message = sprintf( + 'The pattern "%s" was found in the text of the "%s" response header, but it should not.', + $regex, + $name + ); + + $this->assert(!preg_match($regex, $actual), $message); + } + /** * Checks that current page contains text. * @@ -156,7 +256,7 @@ public function pageTextContains($text) { $actual = $this->session->getPage()->getText(); $actual = preg_replace('/\s+/u', ' ', $actual); - $regex = '/'.preg_quote($text, '/').'/ui'; + $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf('The text "%s" was not found anywhere in the text of the current page.', $text); $this->assertResponseText((bool) preg_match($regex, $actual), $message); @@ -173,7 +273,7 @@ public function pageTextNotContains($text) { $actual = $this->session->getPage()->getText(); $actual = preg_replace('/\s+/u', ' ', $actual); - $regex = '/'.preg_quote($text, '/').'/ui'; + $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf('The text "%s" appears in the text of this page, but it should not.', $text); $this->assertResponseText(!preg_match($regex, $actual), $message); @@ -219,7 +319,7 @@ public function pageTextNotMatches($regex) public function responseContains($text) { $actual = $this->session->getPage()->getContent(); - $regex = '/'.preg_quote($text, '/').'/ui'; + $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf('The string "%s" was not found anywhere in the HTML response of the current page.', $text); $this->assert((bool) preg_match($regex, $actual), $message); @@ -235,7 +335,7 @@ public function responseContains($text) public function responseNotContains($text) { $actual = $this->session->getPage()->getContent(); - $regex = '/'.preg_quote($text, '/').'/ui'; + $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf('The string "%s" appears in the HTML response of this page, but it should not.', $text); $this->assert(!preg_match($regex, $actual), $message); @@ -276,7 +376,7 @@ public function responseNotMatches($regex) * * @param string $selectorType element selector type (css, xpath) * @param string|array $selector element selector - * @param integer $count expected count + * @param int $count expected count * @param ElementInterface $container document to check against * * @throws ExpectationException @@ -317,7 +417,7 @@ public function elementExists($selectorType, $selector, ElementInterface $contai $selector = implode(' ', $selector); } - throw new ElementNotFoundException($this->session, 'element', $selectorType, $selector); + throw new ElementNotFoundException($this->session->getDriver(), 'element', $selectorType, $selector); } return $node; @@ -357,8 +457,8 @@ public function elementNotExists($selectorType, $selector, ElementInterface $con public function elementTextContains($selectorType, $selector, $text) { $element = $this->elementExists($selectorType, $selector); - $actual = $element->getText(); - $regex = '/'.preg_quote($text, '/').'/ui'; + $actual = $element->getText(); + $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf( 'The text "%s" was not found in the text of the %s.', @@ -381,8 +481,8 @@ public function elementTextContains($selectorType, $selector, $text) public function elementTextNotContains($selectorType, $selector, $text) { $element = $this->elementExists($selectorType, $selector); - $actual = $element->getText(); - $regex = '/'.preg_quote($text, '/').'/ui'; + $actual = $element->getText(); + $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf( 'The text "%s" appears in the text of the %s, but it should not.', @@ -405,8 +505,8 @@ public function elementTextNotContains($selectorType, $selector, $text) public function elementContains($selectorType, $selector, $html) { $element = $this->elementExists($selectorType, $selector); - $actual = $element->getHtml(); - $regex = '/'.preg_quote($html, '/').'/ui'; + $actual = $element->getHtml(); + $regex = '/'.preg_quote($html, '/').'/ui'; $message = sprintf( 'The string "%s" was not found in the HTML of the %s.', @@ -429,8 +529,8 @@ public function elementContains($selectorType, $selector, $html) public function elementNotContains($selectorType, $selector, $html) { $element = $this->elementExists($selectorType, $selector); - $actual = $element->getHtml(); - $regex = '/'.preg_quote($html, '/').'/ui'; + $actual = $element->getHtml(); + $regex = '/'.preg_quote($html, '/').'/ui'; $message = sprintf( 'The string "%s" appears in the HTML of the %s, but it should not.', @@ -480,8 +580,8 @@ public function elementAttributeExists($selectorType, $selector, $attribute) public function elementAttributeContains($selectorType, $selector, $attribute, $text) { $element = $this->elementAttributeExists($selectorType, $selector, $attribute); - $actual = $element->getAttribute($attribute); - $regex = '/'.preg_quote($text, '/').'/ui'; + $actual = $element->getAttribute($attribute); + $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf( 'The text "%s" was not found in the attribute "%s" of the %s.', @@ -506,8 +606,8 @@ public function elementAttributeContains($selectorType, $selector, $attribute, $ public function elementAttributeNotContains($selectorType, $selector, $attribute, $text) { $element = $this->elementAttributeExists($selectorType, $selector, $attribute); - $actual = $element->getAttribute($attribute); - $regex = '/'.preg_quote($text, '/').'/ui'; + $actual = $element->getAttribute($attribute); + $regex = '/'.preg_quote($text, '/').'/ui'; $message = sprintf( 'The text "%s" was found in the attribute "%s" of the %s.', @@ -535,7 +635,7 @@ public function fieldExists($field, TraversableElement $container = null) $node = $container->findField($field); if (null === $node) { - throw new ElementNotFoundException($this->session, 'form field', 'id|name|label|value', $field); + throw new ElementNotFoundException($this->session->getDriver(), 'form field', 'id|name|label|value', $field); } return $node; @@ -568,9 +668,9 @@ public function fieldNotExists($field, TraversableElement $container = null) */ public function fieldValueEquals($field, $value, TraversableElement $container = null) { - $node = $this->fieldExists($field, $container); + $node = $this->fieldExists($field, $container); $actual = $node->getValue(); - $regex = '/^'.preg_quote($value, '/').'$/ui'; + $regex = '/^'.preg_quote($value, '/').'$/ui'; $message = sprintf('The field "%s" value is "%s", but "%s" expected.', $field, $actual, $value); @@ -588,9 +688,9 @@ public function fieldValueEquals($field, $value, TraversableElement $container = */ public function fieldValueNotEquals($field, $value, TraversableElement $container = null) { - $node = $this->fieldExists($field, $container); + $node = $this->fieldExists($field, $container); $actual = $node->getValue(); - $regex = '/^'.preg_quote($value, '/').'$/ui'; + $regex = '/^'.preg_quote($value, '/').'$/ui'; $message = sprintf('The field "%s" value is "%s", but it should not be.', $field, $actual); @@ -650,7 +750,7 @@ protected function cleanUrl($url) $fragment = empty($parts['fragment']) ? '' : '#'.$parts['fragment']; $path = empty($parts['path']) ? '/' : $parts['path']; - return preg_replace('/^\/[^\.\/]+\.php/', '', $path).$fragment; + return preg_replace('/^\/[^\.\/]+\.php\//', '/', $path).$fragment; } /** @@ -667,7 +767,7 @@ private function assert($condition, $message) return; } - throw new ExpectationException($message, $this->session); + throw new ExpectationException($message, $this->session->getDriver()); } /** @@ -684,7 +784,7 @@ private function assertResponseText($condition, $message) return; } - throw new ResponseTextException($message, $this->session); + throw new ResponseTextException($message, $this->session->getDriver()); } /** @@ -702,7 +802,7 @@ private function assertElement($condition, $message, Element $element) return; } - throw new ElementHtmlException($message, $this->session, $element); + throw new ElementHtmlException($message, $this->session->getDriver(), $element); } /** @@ -720,13 +820,13 @@ private function assertElementText($condition, $message, Element $element) return; } - throw new ElementTextException($message, $this->session, $element); + throw new ElementTextException($message, $this->session->getDriver(), $element); } /** * @param string $selectorType * @param string|array $selector - * @param boolean $plural + * @param bool $plural * * @return string */ diff --git a/vendor/behat/mink/tests/Driver/CoreDriverTest.php b/vendor/behat/mink/tests/Driver/CoreDriverTest.php index d99b17f6e9a8adf259e03d14c76bc2572dc35c5e..cd1fe6436ba5c4dfe0eca352ab22090fc6d62271 100644 --- a/vendor/behat/mink/tests/Driver/CoreDriverTest.php +++ b/vendor/behat/mink/tests/Driver/CoreDriverTest.php @@ -2,6 +2,8 @@ namespace Behat\Mink\Tests\Driver; +use Behat\Mink\Element\NodeElement; + class CoreDriverTest extends \PHPUnit_Framework_TestCase { public function testNoExtraMethods() @@ -17,6 +19,34 @@ public function testNoExtraMethods() } } + public function testCreateNodeElements() + { + $driver = $this->getMockBuilder('Behat\Mink\Driver\CoreDriver') + ->setMethods(array('findElementXpaths')) + ->getMockForAbstractClass(); + + $session = $this->getMockBuilder('Behat\Mink\Session') + ->disableOriginalConstructor() + ->getMock(); + + $driver->setSession($session); + + $driver->expects($this->once()) + ->method('findElementXpaths') + ->with('xpath') + ->willReturn(array('xpath1', 'xpath2')); + + /** @var NodeElement[] $elements */ + $elements = $driver->find('xpath'); + + $this->assertInternalType('array', $elements); + $this->assertCount(2, $elements); + $this->assertContainsOnlyInstancesOf('Behat\Mink\Element\NodeElement', $elements); + + $this->assertSame('xpath1', $elements[0]->getXpath()); + $this->assertSame('xpath2', $elements[1]->getXpath()); + } + /** * @dataProvider getDriverInterfaceMethods */ @@ -29,6 +59,10 @@ public function testInterfaceMethods(\ReflectionMethod $method) sprintf('CoreDriver should implement a dummy %s method', $method->getName()) ); + if ('setSession' === $method->getName()) { + return; // setSession is actually implemented, so we don't expect an exception here. + } + $driver = $this->getMockForAbstractClass('Behat\Mink\Driver\CoreDriver'); $this->setExpectedException('Behat\Mink\Exception\UnsupportedDriverActionException'); diff --git a/vendor/behat/mink/tests/Element/DocumentElementTest.php b/vendor/behat/mink/tests/Element/DocumentElementTest.php index bacd06d8d60baf29eeebdf688322e496c1c966da..2105ab785e8b8409a11ed8f825f04ee475462ab0 100644 --- a/vendor/behat/mink/tests/Element/DocumentElementTest.php +++ b/vendor/behat/mink/tests/Element/DocumentElementTest.php @@ -19,6 +19,9 @@ protected function setUp() $this->document = new DocumentElement($this->session); } + /** + * @group legacy + */ public function testGetSession() { $this->assertEquals($this->session, $this->document->getSession()); diff --git a/vendor/behat/mink/tests/Element/ElementTest.php b/vendor/behat/mink/tests/Element/ElementTest.php index a8c8a8ca90dfa8c1d8614b69721d08ea0cb26e0a..650284c870cce2eec1a6425ce98f886e106015bd 100644 --- a/vendor/behat/mink/tests/Element/ElementTest.php +++ b/vendor/behat/mink/tests/Element/ElementTest.php @@ -36,11 +36,6 @@ protected function setUp() $this->selectors = $this->getMockBuilder('Behat\Mink\Selector\SelectorsHandler')->getMock(); $this->session = new Session($this->driver, $this->selectors); - - $this->selectors - ->expects($this->any()) - ->method('xpathLiteral') - ->will($this->returnArgument(0)); } protected function mockNamedFinder($xpath, array $results, $locator, $times = 2) @@ -55,7 +50,7 @@ protected function mockNamedFinder($xpath, array $results, $locator, $times = 2) $processedResults[] = $result; if (empty($result)) { $processedResults[] = $result; - $times++; + ++$times; } } diff --git a/vendor/behat/mink/tests/Element/NodeElementTest.php b/vendor/behat/mink/tests/Element/NodeElementTest.php index b6a8bdeb0c9e5a927c177e7e6cad97a300de8b51..f769dddb939173a7dca28e816a6ee7de77e371e6 100644 --- a/vendor/behat/mink/tests/Element/NodeElementTest.php +++ b/vendor/behat/mink/tests/Element/NodeElementTest.php @@ -76,7 +76,7 @@ public function testWaitForSuccess() $node = new NodeElement('some xpath', $this->session); $result = $node->waitFor(5, function ($givenNode) use (&$callCounter) { - $callCounter++; + ++$callCounter; if (1 === $callCounter) { return null; @@ -93,6 +93,9 @@ public function testWaitForSuccess() $this->assertSame($node, $result, '->waitFor() returns node found in callback'); } + /** + * @medium + */ public function testWaitForTimeout() { $node = new NodeElement('some xpath', $this->session); @@ -153,11 +156,13 @@ public function testHasClass() ->expects($this->exactly(6)) ->method('getAttribute') ->with('input_tag', 'class') - ->will($this->returnValue('class1 class2')); + ->will($this->returnValue(' + class1 class2 + ')); - $this->assertTrue($node->hasClass('class1')); - $this->assertTrue($node->hasClass('class2')); - $this->assertFalse($node->hasClass('class3')); + $this->assertTrue($node->hasClass('class1'), 'The "class1" was found'); + $this->assertTrue($node->hasClass('class2'), 'The "class2" was found'); + $this->assertFalse($node->hasClass('class3'), 'The "class3" was not found'); } public function testHasClassWithoutArgument() @@ -571,8 +576,8 @@ public function testFindAllUnion() public function testFindAllParentUnion() { $node = new NodeElement('some_xpath | another_xpath', $this->session); - $xpath = "some_tag1 | some_tag2"; - $expectedPrefixed = "(some_xpath | another_xpath)/some_tag1 | (some_xpath | another_xpath)/some_tag2"; + $xpath = 'some_tag1 | some_tag2'; + $expectedPrefixed = '(some_xpath | another_xpath)/some_tag1 | (some_xpath | another_xpath)/some_tag2'; $this->driver ->expects($this->exactly(1)) diff --git a/vendor/behat/mink/tests/Exception/ElementExceptionTest.php b/vendor/behat/mink/tests/Exception/ElementExceptionTest.php index 021e8d58782eaa43b9c7585b74851934028c6d01..87bf2ca46cc63197bb85dc2e67d6c2782d554f20 100644 --- a/vendor/behat/mink/tests/Exception/ElementExceptionTest.php +++ b/vendor/behat/mink/tests/Exception/ElementExceptionTest.php @@ -4,6 +4,9 @@ use Behat\Mink\Exception\ElementException; +/** + * @group legacy + */ class ElementExceptionTest extends \PHPUnit_Framework_TestCase { public function testMessage() diff --git a/vendor/behat/mink/tests/Exception/ElementHtmlExceptionTest.php b/vendor/behat/mink/tests/Exception/ElementHtmlExceptionTest.php index 63d39dd0c4ced21e6f0918a1e1814b8dfb42d79b..7d6ea8252e3c115dab37c65b6022875c8cfe1e0d 100644 --- a/vendor/behat/mink/tests/Exception/ElementHtmlExceptionTest.php +++ b/vendor/behat/mink/tests/Exception/ElementHtmlExceptionTest.php @@ -11,14 +11,10 @@ public function testExceptionToString() $driver = $this->getMock('Behat\Mink\Driver\DriverInterface'); $element = $this->getElementMock(); - $session = $this->getSessionMock(); - $session->expects($this->any()) - ->method('getDriver') - ->will($this->returnValue($driver)); - $session->expects($this->any()) + $driver->expects($this->any()) ->method('getStatusCode') ->will($this->returnValue(200)); - $session->expects($this->any()) + $driver->expects($this->any()) ->method('getCurrentUrl') ->will($this->returnValue('http://localhost/test')); @@ -40,18 +36,11 @@ public function testExceptionToString() $expected = sprintf($expected.' ', get_class($driver)); - $exception = new ElementHtmlException('Html error', $session, $element); + $exception = new ElementHtmlException('Html error', $driver, $element); $this->assertEquals($expected, $exception->__toString()); } - private function getSessionMock() - { - return $this->getMockBuilder('Behat\Mink\Session') - ->disableOriginalConstructor() - ->getMock(); - } - private function getElementMock() { return $this->getMockBuilder('Behat\Mink\Element\NodeElement') diff --git a/vendor/behat/mink/tests/Exception/ElementNotFoundExceptionTest.php b/vendor/behat/mink/tests/Exception/ElementNotFoundExceptionTest.php index 8cb4e5d89228fff692689fd05f69a3a7ffa0b5dd..6faa55c53203e4d78376f33a104f0f5cf17eeafe 100644 --- a/vendor/behat/mink/tests/Exception/ElementNotFoundExceptionTest.php +++ b/vendor/behat/mink/tests/Exception/ElementNotFoundExceptionTest.php @@ -11,11 +11,9 @@ class ElementNotFoundExceptionTest extends \PHPUnit_Framework_TestCase */ public function testBuildMessage($message, $type, $selector = null, $locator = null) { - $session = $this->getMockBuilder('Behat\Mink\Session') - ->disableOriginalConstructor() - ->getMock(); + $driver = $this->getMock('Behat\Mink\Driver\DriverInterface'); - $exception = new ElementNotFoundException($session, $type, $selector, $locator); + $exception = new ElementNotFoundException($driver, $type, $selector, $locator); $this->assertEquals($message, $exception->getMessage()); } @@ -31,4 +29,22 @@ public function provideExceptionMessage() array('Tag with name "foobar" not found.', null, 'name', 'foobar'), ); } + + /** + * @group legacy + */ + public function testConstructWithSession() + { + $driver = $this->getMock('Behat\Mink\Driver\DriverInterface'); + $session = $this->getMockBuilder('Behat\Mink\Session') + ->disableOriginalConstructor() + ->getMock(); + $session->expects($this->any()) + ->method('getDriver') + ->will($this->returnValue($driver)); + + $exception = new ElementNotFoundException($session); + + $this->assertEquals('Tag not found.', $exception->getMessage()); + } } diff --git a/vendor/behat/mink/tests/Exception/ElementTextExceptionTest.php b/vendor/behat/mink/tests/Exception/ElementTextExceptionTest.php index 73cef5bc346edf512473a927b14026e70dac4f87..f8d5e4c8e49644044c2bac526fcf1885da8ea1bf 100644 --- a/vendor/behat/mink/tests/Exception/ElementTextExceptionTest.php +++ b/vendor/behat/mink/tests/Exception/ElementTextExceptionTest.php @@ -11,14 +11,10 @@ public function testExceptionToString() $driver = $this->getMock('Behat\Mink\Driver\DriverInterface'); $element = $this->getElementMock(); - $session = $this->getSessionMock(); - $session->expects($this->any()) - ->method('getDriver') - ->will($this->returnValue($driver)); - $session->expects($this->any()) + $driver->expects($this->any()) ->method('getStatusCode') ->will($this->returnValue(200)); - $session->expects($this->any()) + $driver->expects($this->any()) ->method('getCurrentUrl') ->will($this->returnValue('http://localhost/test')); @@ -38,18 +34,11 @@ public function testExceptionToString() $expected = sprintf($expected.' ', get_class($driver)); - $exception = new ElementTextException('Text error', $session, $element); + $exception = new ElementTextException('Text error', $driver, $element); $this->assertEquals($expected, $exception->__toString()); } - private function getSessionMock() - { - return $this->getMockBuilder('Behat\Mink\Session') - ->disableOriginalConstructor() - ->getMock(); - } - private function getElementMock() { return $this->getMockBuilder('Behat\Mink\Element\NodeElement') diff --git a/vendor/behat/mink/tests/Exception/ExpectationExceptionTest.php b/vendor/behat/mink/tests/Exception/ExpectationExceptionTest.php index 466bcca63eceee4e79432b849e025d63ebb68fd9..a327fcbd670ef0568aa56c2265985fd033ee9f4f 100644 --- a/vendor/behat/mink/tests/Exception/ExpectationExceptionTest.php +++ b/vendor/behat/mink/tests/Exception/ExpectationExceptionTest.php @@ -8,7 +8,7 @@ class ExpectationExceptionTest extends \PHPUnit_Framework_TestCase { public function testEmptyMessageAndPreviousException() { - $exception = new ExpectationException('', $this->getSessionMock(), new \Exception('Something failed')); + $exception = new ExpectationException('', $this->getMock('Behat\Mink\Driver\DriverInterface'), new \Exception('Something failed')); $this->assertEquals('Something failed', $exception->getMessage()); } @@ -16,24 +16,16 @@ public function testEmptyMessageAndPreviousException() public function testExceptionToString() { $driver = $this->getMock('Behat\Mink\Driver\DriverInterface'); - $page = $this->getPageMock(); - $session = $this->getSessionMock(); - $session->expects($this->any()) - ->method('getDriver') - ->will($this->returnValue($driver)); - $session->expects($this->any()) - ->method('getPage') - ->will($this->returnValue($page)); - $session->expects($this->any()) + $driver->expects($this->any()) ->method('getStatusCode') ->will($this->returnValue(200)); - $session->expects($this->any()) + $driver->expects($this->any()) ->method('getCurrentUrl') ->will($this->returnValue('http://localhost/test')); $html = "<html><head><title>Hello</title></head>\n<body>\n<h1>Hello world</h1>\n<p>Test</p>\n</body></html>"; - $page->expects($this->any()) + $driver->expects($this->any()) ->method('getContent') ->will($this->returnValue($html)); @@ -51,7 +43,7 @@ public function testExceptionToString() $expected = sprintf($expected.' ', get_class($driver)); - $exception = new ExpectationException('Expectation failure', $session); + $exception = new ExpectationException('Expectation failure', $driver); $this->assertEquals($expected, $exception->__toString()); } @@ -59,26 +51,18 @@ public function testExceptionToString() public function testBigContent() { $driver = $this->getMock('Behat\Mink\Driver\DriverInterface'); - $page = $this->getPageMock(); - $session = $this->getSessionMock(); - $session->expects($this->any()) - ->method('getDriver') - ->will($this->returnValue($driver)); - $session->expects($this->any()) - ->method('getPage') - ->will($this->returnValue($page)); - $session->expects($this->any()) + $driver->expects($this->any()) ->method('getStatusCode') ->will($this->returnValue(200)); - $session->expects($this->any()) + $driver->expects($this->any()) ->method('getCurrentUrl') ->will($this->returnValue('http://localhost/test')); $body = str_repeat('a', 1001 - strlen('<body></body>')); $html = sprintf("<html><head><title>Hello</title></head>\n<body>%s</body></html>", $body); - $page->expects($this->any()) + $driver->expects($this->any()) ->method('getContent') ->will($this->returnValue($html)); @@ -93,34 +77,38 @@ public function testBigContent() $expected = sprintf($expected.' ', get_class($driver), $body); - $exception = new ExpectationException('Expectation failure', $session); + $exception = new ExpectationException('Expectation failure', $driver); $this->assertEquals($expected, $exception->__toString()); } public function testExceptionWhileRenderingString() { - $session = $this->getSessionMock(); - $session->expects($this->any()) - ->method('getPage') + $driver = $this->getMock('Behat\Mink\Driver\DriverInterface'); + $driver->expects($this->any()) + ->method('getContent') ->will($this->throwException(new \Exception('Broken page'))); - $exception = new ExpectationException('Expectation failure', $session); + $exception = new ExpectationException('Expectation failure', $driver); $this->assertEquals('Expectation failure', $exception->__toString()); } - private function getSessionMock() + /** + * @group legacy + */ + public function testConstructWithSession() { - return $this->getMockBuilder('Behat\Mink\Session') + $driver = $this->getMock('Behat\Mink\Driver\DriverInterface'); + $session = $this->getMockBuilder('Behat\Mink\Session') ->disableOriginalConstructor() ->getMock(); - } + $session->expects($this->any()) + ->method('getDriver') + ->will($this->returnValue($driver)); - private function getPageMock() - { - return $this->getMockBuilder('Behat\Mink\Element\DocumentElement') - ->disableOriginalConstructor() - ->getMock(); + $exception = new ExpectationException('', $session, new \Exception('Something failed')); + + $this->assertEquals('Something failed', $exception->getMessage()); } } diff --git a/vendor/behat/mink/tests/Exception/ResponseTextExceptionTest.php b/vendor/behat/mink/tests/Exception/ResponseTextExceptionTest.php index 4651b7cd5aa1e537f20b7f57b84b7c051f816ef4..429721dd9df1abac07c439b3584ca96ea10530ff 100644 --- a/vendor/behat/mink/tests/Exception/ResponseTextExceptionTest.php +++ b/vendor/behat/mink/tests/Exception/ResponseTextExceptionTest.php @@ -9,24 +9,16 @@ class ResponseTextExceptionTest extends \PHPUnit_Framework_TestCase public function testExceptionToString() { $driver = $this->getMock('Behat\Mink\Driver\DriverInterface'); - $page = $this->getPageMock(); - - $session = $this->getSessionMock(); - $session->expects($this->any()) - ->method('getDriver') - ->will($this->returnValue($driver)); - $session->expects($this->any()) - ->method('getPage') - ->will($this->returnValue($page)); - $session->expects($this->any()) + + $driver->expects($this->any()) ->method('getStatusCode') ->will($this->returnValue(200)); - $session->expects($this->any()) + $driver->expects($this->any()) ->method('getCurrentUrl') ->will($this->returnValue('http://localhost/test')); - - $page->expects($this->any()) + $driver->expects($this->any()) ->method('getText') + ->with('//html') ->will($this->returnValue("Hello world\nTest\n")); $expected = <<<'TXT' @@ -41,22 +33,8 @@ public function testExceptionToString() $expected = sprintf($expected.' ', get_class($driver)); - $exception = new ResponseTextException('Text error', $session); + $exception = new ResponseTextException('Text error', $driver); $this->assertEquals($expected, $exception->__toString()); } - - private function getSessionMock() - { - return $this->getMockBuilder('Behat\Mink\Session') - ->disableOriginalConstructor() - ->getMock(); - } - - private function getPageMock() - { - return $this->getMockBuilder('Behat\Mink\Element\DocumentElement') - ->disableOriginalConstructor() - ->getMock(); - } } diff --git a/vendor/behat/mink/tests/Selector/NamedSelectorTest.php b/vendor/behat/mink/tests/Selector/NamedSelectorTest.php index e0de1bc226dc1d17366f737309f4c36e73cc6981..5124a4628cb2e854793fd9d68b52b3145ac432c8 100644 --- a/vendor/behat/mink/tests/Selector/NamedSelectorTest.php +++ b/vendor/behat/mink/tests/Selector/NamedSelectorTest.php @@ -3,7 +3,7 @@ namespace Behat\Mink\Tests\Selector; use Behat\Mink\Selector\NamedSelector; -use Behat\Mink\Selector\SelectorsHandler; +use Behat\Mink\Selector\Xpath\Escaper; abstract class NamedSelectorTest extends \PHPUnit_Framework_TestCase { @@ -42,10 +42,6 @@ public function testSelectors($fixtureFile, $selector, $locator, $expectedExactC $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->loadHTML(file_get_contents(__DIR__.'/fixtures/'.$fixtureFile)); - // Escape the locator as Mink 1.x expects the caller of the NamedSelector to handle it - $selectorsHandler = new SelectorsHandler(); - $locator = $selectorsHandler->xpathLiteral($locator); - $namedSelector = $this->getSelector(); $xpath = $namedSelector->translateToXPath(array($selector, $locator)); @@ -56,6 +52,19 @@ public function testSelectors($fixtureFile, $selector, $locator, $expectedExactC $this->assertEquals($expectedCount, $nodeList->length); } + /** + * @dataProvider getSelectorTests + * @group legacy + */ + public function testEscapedSelectors($fixtureFile, $selector, $locator, $expectedExactCount, $expectedPartialCount = null) + { + // Escape the locator as Mink 1.x expects the caller of the NamedSelector to handle it + $escaper = new Escaper(); + $locator = $escaper->escapeLiteral($locator); + + $this->testSelectors($fixtureFile, $selector, $locator, $expectedExactCount, $expectedPartialCount); + } + public function getSelectorTests() { $fieldCount = 8; // fields without `type` attribute @@ -122,6 +131,7 @@ public function getSelectorTests() // 3 matches, because matches every HTML node in path: html > body > div 'content' => array('test.html', 'content', 'content-text', 1, 4), + 'content with quotes' => array('test.html', 'content', 'some "quoted" content', 1, 3), 'select (name/label)' => array('test.html', 'select', 'the-field', 3), 'select (with-id)' => array('test.html', 'select', 'the-field-select', 1), @@ -152,7 +162,7 @@ public function getSelectorTests() abstract protected function getSelector(); /** - * @return boolean + * @return bool */ abstract protected function allowPartialMatch(); } diff --git a/vendor/behat/mink/tests/Selector/SelectorsHandlerTest.php b/vendor/behat/mink/tests/Selector/SelectorsHandlerTest.php index a20d3d9db7f5019e01f0b389e3060d2516c424a8..fb63b329dcd763258349f98edad9848336294946 100644 --- a/vendor/behat/mink/tests/Selector/SelectorsHandlerTest.php +++ b/vendor/behat/mink/tests/Selector/SelectorsHandlerTest.php @@ -71,6 +71,9 @@ public function testSelectorToXpath() $handler->selectorToXpath('undefined', 'asd'); } + /** + * @group legacy + */ public function testXpathLiteral() { $handler = new SelectorsHandler(); @@ -78,6 +81,9 @@ public function testXpathLiteral() $this->assertEquals("'some simple string'", $handler->xpathLiteral('some simple string')); } + /** + * @group legacy + */ public function testBcLayer() { $selector = $this->getMockBuilder('Behat\Mink\Selector\SelectorInterface')->getMock(); @@ -85,8 +91,6 @@ public function testBcLayer() $handler->registerSelector('named_partial', $selector); - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - $this->assertSame($selector, $handler->getSelector('named')); } } diff --git a/vendor/behat/mink/tests/Selector/fixtures/test.html b/vendor/behat/mink/tests/Selector/fixtures/test.html index c64ae103292fb468345bcd2912c45fbd9d9f5522..1190e9ea60051c91c5fdcbdf9518d9b5618172b0 100644 --- a/vendor/behat/mink/tests/Selector/fixtures/test.html +++ b/vendor/behat/mink/tests/Selector/fixtures/test.html @@ -66,6 +66,8 @@ some content-text </div> + <div>some "quoted" content</div> + <form> <div id="test-for-field-selector"> <!-- match fields by `id` attribute --> diff --git a/vendor/behat/mink/tests/SessionTest.php b/vendor/behat/mink/tests/SessionTest.php index 9e6796db993a4d0f09638abe319dfa86e139675d..3e0104a71c57c3d784bc86c6230b9185ff7715c3 100644 --- a/vendor/behat/mink/tests/SessionTest.php +++ b/vendor/behat/mink/tests/SessionTest.php @@ -130,6 +130,29 @@ public function testGetResponseHeaders() $this->assertEquals($ret, $this->session->getResponseHeaders()); } + /** + * @dataProvider provideResponseHeader + */ + public function testGetResponseHeader($expected, $name, array $headers) + { + $this->driver->expects($this->once()) + ->method('getResponseHeaders') + ->willReturn($headers); + + $this->assertSame($expected, $this->session->getResponseHeader($name)); + } + + public function provideResponseHeader() + { + return array( + array('test', 'Mink', array('Mink' => 'test')), + array('test', 'mink', array('Mink' => 'test')), + array('test', 'Mink', array('mink' => 'test')), + array('test', 'Mink', array('Mink' => array('test', 'test2'))), + array(null, 'other', array('Mink' => 'test')), + ); + } + public function testSetCookie() { $this->driver->expects($this->once()) diff --git a/vendor/behat/mink/tests/WebAssertTest.php b/vendor/behat/mink/tests/WebAssertTest.php index c3bd3cf11c1f66116487218b41f8b09193a043b9..ef55d2d2ee293edfbe4288567fbd2d424b7fda19 100644 --- a/vendor/behat/mink/tests/WebAssertTest.php +++ b/vendor/behat/mink/tests/WebAssertTest.php @@ -21,6 +21,10 @@ public function setUp() $this->session = $this->getMockBuilder('Behat\\Mink\\Session') ->disableOriginalConstructor() ->getMock(); + $this->session->expects($this->any()) + ->method('getDriver') + ->will($this->returnValue($this->getMock('Behat\Mink\Driver\DriverInterface'))); + $this->assert = new WebAssert($this->session); } @@ -52,6 +56,23 @@ public function testAddressEqualsEmptyPath() $this->assertCorrectAssertion('addressEquals', array('/')); } + public function testAddressEqualsEndingInScript() + { + $this->session + ->expects($this->exactly(2)) + ->method('getCurrentUrl') + ->will($this->returnValue('http://example.com/script.php')) + ; + + $this->assertCorrectAssertion('addressEquals', array('/script.php')); + $this->assertWrongAssertion( + 'addressEquals', + array('/'), + 'Behat\\Mink\\Exception\\ExpectationException', + 'Current page is "/script.php", but "/" expected.' + ); + } + public function testAddressNotEquals() { $this->session @@ -69,6 +90,23 @@ public function testAddressNotEquals() ); } + public function testAddressNotEqualsEndingInScript() + { + $this->session + ->expects($this->exactly(2)) + ->method('getCurrentUrl') + ->will($this->returnValue('http://example.com/script.php')) + ; + + $this->assertCorrectAssertion('addressNotEquals', array('/')); + $this->assertWrongAssertion( + 'addressNotEquals', + array('/script.php'), + 'Behat\\Mink\\Exception\\ExpectationException', + 'Current page is "/script.php", but should not be.' + ); + } + public function testAddressMatches() { $this->session @@ -162,6 +200,132 @@ public function testStatusCodeNotEquals() ); } + public function testResponseHeaderEquals() + { + $this->session + ->expects($this->any()) + ->method('getResponseHeader') + ->will($this->returnValueMap( + array( + array('foo', 'bar'), + array('bar', 'baz'), + ) + )); + + $this->assertCorrectAssertion('responseHeaderEquals', array('foo', 'bar')); + $this->assertWrongAssertion( + 'responseHeaderEquals', + array('bar', 'foo'), + 'Behat\\Mink\\Exception\\ExpectationException', + 'Current response header "bar" is "baz", but "foo" expected.' + ); + } + + public function testResponseHeaderNotEquals() + { + $this->session + ->expects($this->any()) + ->method('getResponseHeader') + ->will($this->returnValueMap( + array( + array('foo', 'bar'), + array('bar', 'baz'), + ) + )); + + $this->assertCorrectAssertion('responseHeaderNotEquals', array('foo', 'baz')); + $this->assertWrongAssertion( + 'responseHeaderNotEquals', + array('bar', 'baz'), + 'Behat\\Mink\\Exception\\ExpectationException', + 'Current response header "bar" is "baz", but should not be.' + ); + } + + public function testResponseHeaderContains() + { + $this->session + ->expects($this->any()) + ->method('getResponseHeader') + ->will($this->returnValueMap( + array( + array('foo', 'bar'), + array('bar', 'baz'), + ) + )); + + $this->assertCorrectAssertion('responseHeaderContains', array('foo', 'ba')); + $this->assertWrongAssertion( + 'responseHeaderContains', + array('bar', 'bz'), + 'Behat\\Mink\\Exception\\ExpectationException', + 'The text "bz" was not found anywhere in the "bar" response header.' + ); + } + + public function testResponseHeaderNotContains() + { + $this->session + ->expects($this->any()) + ->method('getResponseHeader') + ->will($this->returnValueMap( + array( + array('foo', 'bar'), + array('bar', 'baz'), + ) + )); + + $this->assertCorrectAssertion('responseHeaderNotContains', array('foo', 'bz')); + $this->assertWrongAssertion( + 'responseHeaderNotContains', + array('bar', 'ba'), + 'Behat\\Mink\\Exception\\ExpectationException', + 'The text "ba" was found in the "bar" response header, but it should not.' + ); + } + + public function testResponseHeaderMatches() + { + $this->session + ->expects($this->any()) + ->method('getResponseHeader') + ->will($this->returnValueMap( + array( + array('foo', 'bar'), + array('bar', 'baz'), + ) + )); + + $this->assertCorrectAssertion('responseHeaderMatches', array('foo', '/ba(.*)/')); + $this->assertWrongAssertion( + 'responseHeaderMatches', + array('bar', '/b[^a]/'), + 'Behat\\Mink\\Exception\\ExpectationException', + 'The pattern "/b[^a]/" was not found anywhere in the "bar" response header.' + ); + } + + public function testResponseHeaderNotMatches() + { + $this->session + ->expects($this->any()) + ->method('getResponseHeader') + ->will($this->returnValueMap( + array( + array('foo', 'bar'), + array('bar', 'baz'), + ) + )); + + $this->assertCorrectAssertion('responseHeaderNotMatches', array('foo', '/bz/')); + $this->assertWrongAssertion( + 'responseHeaderNotMatches', + array('bar', '/b[ab]z/'), + 'Behat\\Mink\\Exception\\ExpectationException', + 'The pattern "/b[ab]z/" was found in the text of the "bar" response header, but it should not.' + ); + } + public function testPageTextContains() { $page = $this->getMockBuilder('Behat\\Mink\\Element\\DocumentElement') diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index 8963b7ef17bebf01487544c871b2ca69b702869d..bb43043a3119e862075754500aaeaa2c7ad34efc 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -21,5 +21,4 @@ 'Doctrine\\Common\\Annotations\\' => array($vendorDir . '/doctrine/annotations/lib'), 'Doctrine\\Common\\' => array($vendorDir . '/doctrine/common/lib'), 'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src'), - 'Behat\\Mink\\Driver' => array($vendorDir . '/behat/mink-browserkit-driver/src'), ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 534894cd4fcf644646e5ea1d356e7430d8d28769..e360efb7a97d20e6d81a73bfbb913c44e346d51a 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -40,6 +40,6 @@ 'Drupal\\Core\\' => array($baseDir . '/core/lib/Drupal/Core'), 'Drupal\\Component\\' => array($baseDir . '/core/lib/Drupal/Component'), 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), - 'Behat\\Mink\\Driver\\' => array($vendorDir . '/behat/mink-goutte-driver/src'), + 'Behat\\Mink\\Driver\\' => array($vendorDir . '/behat/mink-browserkit-driver/src', $vendorDir . '/behat/mink-goutte-driver/src'), 'Behat\\Mink\\' => array($vendorDir . '/behat/mink/src'), ); diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 4b00b65866cc4b7af1dd799f37bf8a49681142a4..2b795e527db359ac4470956cf87633904851a40b 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -151,120 +151,6 @@ "global state" ] }, - { - "name": "behat/mink", - "version": "v1.6.1", - "version_normalized": "1.6.1.0", - "source": { - "type": "git", - "url": "https://github.com/minkphp/Mink.git", - "reference": "8b68523a339ec991bcd638b39dc8f04f808da88a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/minkphp/Mink/zipball/8b68523a339ec991bcd638b39dc8f04f808da88a", - "reference": "8b68523a339ec991bcd638b39dc8f04f808da88a", - "shasum": "" - }, - "require": { - "php": ">=5.3.1", - "symfony/css-selector": "~2.0" - }, - "suggest": { - "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", - "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", - "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", - "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" - }, - "time": "2015-02-04 17:02:06", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Behat\\Mink\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Browser controller/emulator abstraction for PHP", - "homepage": "http://mink.behat.org/", - "keywords": [ - "browser", - "testing", - "web" - ] - }, - { - "name": "behat/mink-browserkit-driver", - "version": "v1.2.0", - "version_normalized": "1.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/minkphp/MinkBrowserKitDriver.git", - "reference": "aed8f4a596b79014a75254c3e337511c33e38cbd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/aed8f4a596b79014a75254c3e337511c33e38cbd", - "reference": "aed8f4a596b79014a75254c3e337511c33e38cbd", - "shasum": "" - }, - "require": { - "behat/mink": "~1.6@dev", - "php": ">=5.3.1", - "symfony/browser-kit": "~2.0", - "symfony/dom-crawler": "~2.0" - }, - "require-dev": { - "silex/silex": "~1.2" - }, - "time": "2014-09-26 11:35:19", - "type": "mink-driver", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Behat\\Mink\\Driver": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Symfony2 BrowserKit driver for Mink framework", - "homepage": "http://mink.behat.org/", - "keywords": [ - "Mink", - "Symfony2", - "browser", - "testing" - ] - }, { "name": "sebastian/diff", "version": "1.3.0", @@ -581,60 +467,6 @@ "psr-7" ] }, - { - "name": "behat/mink-goutte-driver", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/minkphp/MinkGoutteDriver.git", - "reference": "cc5ce119b5a8e06662f634b35967aff0b0c7dfdd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/c8e254f127d6f2242b994afd4339fb62d471df3f", - "reference": "cc5ce119b5a8e06662f634b35967aff0b0c7dfdd", - "shasum": "" - }, - "require": { - "behat/mink": "~1.6@dev", - "behat/mink-browserkit-driver": "~1.2@dev", - "fabpot/goutte": "~1.0.4|~2.0|~3.1", - "php": ">=5.3.1" - }, - "time": "2015-06-27 00:15:11", - "type": "mink-driver", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Behat\\Mink\\Driver\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Goutte driver for Mink framework", - "homepage": "http://mink.behat.org/", - "keywords": [ - "browser", - "goutte", - "headless", - "testing" - ] - }, { "name": "egulias/email-validator", "version": "1.2.9", @@ -3627,5 +3459,180 @@ "zend", "zikula" ] + }, + { + "name": "behat/mink", + "version": "v1.7.0", + "version_normalized": "1.7.0.0", + "source": { + "type": "git", + "url": "https://github.com/minkphp/Mink.git", + "reference": "6c129030ec2cc029905cf969a56ca8f087b2dfdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/minkphp/Mink/zipball/6c129030ec2cc029905cf969a56ca8f087b2dfdf", + "reference": "6c129030ec2cc029905cf969a56ca8f087b2dfdf", + "shasum": "" + }, + "require": { + "php": ">=5.3.1", + "symfony/css-selector": "~2.1" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "suggest": { + "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", + "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", + "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", + "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" + }, + "time": "2015-09-20 20:24:03", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Behat\\Mink\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Browser controller/emulator abstraction for PHP", + "homepage": "http://mink.behat.org/", + "keywords": [ + "browser", + "testing", + "web" + ] + }, + { + "name": "behat/mink-browserkit-driver", + "version": "v1.3.0", + "version_normalized": "1.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/minkphp/MinkBrowserKitDriver.git", + "reference": "da47df1593dac132f04d24e7277ef40d33d9f201" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/da47df1593dac132f04d24e7277ef40d33d9f201", + "reference": "da47df1593dac132f04d24e7277ef40d33d9f201", + "shasum": "" + }, + "require": { + "behat/mink": "~1.7@dev", + "php": ">=5.3.6", + "symfony/browser-kit": "~2.3", + "symfony/dom-crawler": "~2.3" + }, + "require-dev": { + "silex/silex": "~1.2", + "symfony/phpunit-bridge": "~2.7" + }, + "time": "2015-09-21 20:56:13", + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Behat\\Mink\\Driver\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Symfony2 BrowserKit driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "Mink", + "Symfony2", + "browser", + "testing" + ] + }, + { + "name": "behat/mink-goutte-driver", + "version": "v1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/minkphp/MinkGoutteDriver.git", + "reference": "c8e254f127d6f2242b994afd4339fb62d471df3f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/c8e254f127d6f2242b994afd4339fb62d471df3f", + "reference": "c8e254f127d6f2242b994afd4339fb62d471df3f", + "shasum": "" + }, + "require": { + "behat/mink": "~1.6@dev", + "behat/mink-browserkit-driver": "~1.2@dev", + "fabpot/goutte": "~1.0.4|~2.0|~3.1", + "php": ">=5.3.1" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "time": "2015-09-21 21:31:11", + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Behat\\Mink\\Driver\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Goutte driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "browser", + "goutte", + "headless", + "testing" + ] } ]