Issue #1475510 by timmillwood, hussainweb, davidwbarratt, alexpott, Mile23, pfrenssen, claudiu.cristea, webchick, catch, Crell, patcon, RobLoach, kim.pepper, dawehner, neclimdul, Mixologic, gagarine, sun, nod_, effulgentsia, drumm, Sylvain Lecoy, jhedstrom, katbailey, xjm, klausi, Seldaek, Barryvdh: Remove external dependencies from the core repo and let Composer manage the dependencies instead

8.2.x
Nathaniel Catchpole 2016-03-14 08:10:45 +09:00
parent 7e01fa5342
commit 2971d9c0f9
2920 changed files with 15 additions and 334907 deletions

View File

@ -1,3 +1,13 @@
Drupal 8.1.0, xxxx-xx-xx (development version)
------------------------
- Removed Composer-managed vendor from the git repository:
* Drupal.org packager adds dependencies to zip and tar package. This can be
used without any further steps.
* When not using zip / tar files, e.g. when using a git clone, run composer
install to get dependencies.
* See https://www.drupal.org/documentation/install/download#git
for instructions.
Drupal 8.0.0, 2015-11-19
------------------------
- Significantly improved the front end:

View File

@ -7,9 +7,12 @@
# Because .gitignore can be specific to your site, this file has a different
# name; updating Drupal core will not override your custom .gitignore file.
# Ignore core and vendor when managing dependencies with Composer.
# Ignore core when managing all of a project's dependencies with Composer
# including Drupal core.
# core
# vendor
# Core's dependencies are managed with Composer.
vendor
# Ignore configuration files that may contain sensitive information.
sites/*/settings*.php

23
vendor/.htaccess vendored
View File

@ -1,23 +0,0 @@
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews
# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>
# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
php_flag engine off
</IfModule>

7
vendor/autoload.php vendored
View File

@ -1,7 +0,0 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitDrupal8::getLoader();

View File

@ -1,3 +0,0 @@
vendor
composer.lock
/phpunit.xml

View File

@ -1,27 +0,0 @@
language: php
sudo: false
php: [5.3, 5.4, 5.5, 5.6, hhvm]
matrix:
include:
- php: 5.5
env: SYMFONY_VERSION='2.3.*'
- php: 5.5
env: SYMFONY_VERSION='2.5.*@dev'
cache:
directories:
- $HOME/.composer/cache/files
before_install:
- sh -c 'if [ "$SYMFONY_VERSION" != "" ]; then composer require -n --no-update symfony/symfony=$SYMFONY_VERSION; fi;'
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

View File

@ -1,54 +0,0 @@
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
==================
BC break:
* Changed the behavior of `getValue` for checkboxes according to the BC break in Mink 1.6
New features:
* Implemented `getOuterHtml`
* Added the support of manipulating forms without submit buttons
* Added support of any request headers instead of supporting only a few hardcoded ones
* Added support of any BrowserKit client using `filterResponse` when using BrowserKit 2.3+
* Added the support of reset buttons
* Implemented `submitForm`
* Implemented `isSelected`
Bug fixes:
* Fixed the support of options without value attribute in `isSelected` and `getValue`
* Added the support of radio buttons in `isChecked`
* Fixed the submission of empty textarea fields
* Refactored the handling of request headers to ensure they are reset when resetting the driver
* Fixed the handling of buttons to submit only for submit buttons rather than all buttons
* Fixed the code to throw exceptions rather than triggering a fatal error for invalid usages of the driver
* Fixed the removal of cookies
* Fixed the submission of form fields with same name and without id
* Fixed `getAttribute` to return `null` for missing attributes rather than an empty string
Testing:
* Updated the testsuite to use the new Mink 1.6 driver testsuite
* Added testing on HHVM

View File

@ -1,22 +0,0 @@
Copyright (c) 2012-2013 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
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,54 +0,0 @@
Mink BrowserKit Driver
======================
[![Latest Stable Version](https://poser.pugx.org/behat/mink-browserkit-driver/v/stable.png)](https://packagist.org/packages/behat/mink-browserkit-driver)
[![Latest Unstable Version](https://poser.pugx.org/behat/mink-browserkit-driver/v/unstable.svg)](https://packagist.org/packages/behat/mink-browserkit-driver)
[![Total Downloads](https://poser.pugx.org/behat/mink-browserkit-driver/downloads.png)](https://packagist.org/packages/behat/mink-browserkit-driver)
[![Build Status](https://travis-ci.org/minkphp/MinkBrowserKitDriver.svg?branch=master)](https://travis-ci.org/minkphp/MinkBrowserKitDriver)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/minkphp/MinkBrowserKitDriver/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/minkphp/MinkBrowserKitDriver/)
[![Code Coverage](https://scrutinizer-ci.com/g/minkphp/MinkBrowserKitDriver/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/minkphp/MinkBrowserKitDriver/)
[![License](https://poser.pugx.org/behat/mink-browserkit-driver/license.svg)](https://packagist.org/packages/behat/mink-browserkit-driver)
Usage Example
-------------
``` php
<?php
use Behat\Mink\Mink,
Behat\Mink\Session,
Behat\Mink\Driver\BrowserKitDriver;
use Symfony\Component\HttpKernel\Client;
$app = require_once(__DIR__.'/app.php'); // Silex app
$mink = new Mink(array(
'silex' => new Session(new BrowserKitDriver(new Client($app))),
));
$mink->getSession('silex')->getPage()->findLink('Chat')->click();
```
Installation
------------
``` json
{
"require": {
"behat/mink": "~1.5",
"behat/mink-browserkit-driver": "~1.1"
}
}
```
``` bash
$> curl -sS https://getcomposer.org/installer | php
$> php composer.phar install
```
Maintainers
-----------
* Christophe Coevoet [stof](https://github.com/stof)
* Other [awesome developers](https://github.com/minkphp/MinkBrowserKitDriver/graphs/contributors)

View File

@ -1,46 +0,0 @@
{
"name": "behat/mink-browserkit-driver",
"description": "Symfony2 BrowserKit driver for Mink framework",
"keywords": ["Symfony2", "Mink", "testing", "browser"],
"homepage": "http://mink.behat.org/",
"type": "mink-driver",
"license": "MIT",
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
}
],
"require": {
"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-4": {
"Behat\\Mink\\Driver\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Behat\\Mink\\Tests\\Driver\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
}
}

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="vendor/behat/mink/driver-testsuite/bootstrap.php">
<php>
<var name="driver_config_factory" value="Behat\Mink\Tests\Driver\BrowserKitConfig::getInstance" />
</php>
<testsuites>
<testsuite name="Driver test suite">
<directory>tests</directory>
<directory>vendor/behat/mink/driver-testsuite/tests/Basic</directory>
<directory>vendor/behat/mink/driver-testsuite/tests/Form</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
</phpunit>

View File

@ -1,855 +0,0 @@
<?php
/*
* This file is part of the Behat\Mink.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Driver;
use Behat\Mink\Exception\DriverException;
use Behat\Mink\Exception\UnsupportedDriverActionException;
use Symfony\Component\BrowserKit\Client;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\BrowserKit\Response;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\DomCrawler\Field\ChoiceFormField;
use Symfony\Component\DomCrawler\Field\FileFormField;
use Symfony\Component\DomCrawler\Field\FormField;
use Symfony\Component\DomCrawler\Field\InputFormField;
use Symfony\Component\DomCrawler\Field\TextareaFormField;
use Symfony\Component\DomCrawler\Form;
use Symfony\Component\HttpKernel\Client as HttpKernelClient;
/**
* Symfony2 BrowserKit driver.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class BrowserKitDriver extends CoreDriver
{
private $client;
/**
* @var Form[]
*/
private $forms = array();
private $serverParameters = array();
private $started = false;
private $removeScriptFromUrl = false;
private $removeHostFromUrl = false;
/**
* Initializes BrowserKit driver.
*
* @param Client $client BrowserKit client instance
* @param string|null $baseUrl Base URL for HttpKernel clients
*/
public function __construct(Client $client, $baseUrl = null)
{
$this->client = $client;
$this->client->followRedirects(true);
if ($baseUrl !== null && $client instanceof HttpKernelClient) {
$client->setServerParameter('SCRIPT_FILENAME', parse_url($baseUrl, PHP_URL_PATH));
}
}
/**
* Returns BrowserKit HTTP client instance.
*
* @return Client
*/
public function getClient()
{
return $this->client;
}
/**
* Tells driver to remove hostname from URL.
*
* @param Boolean $remove
*
* @deprecated Deprecated as of 1.2, to be removed in 2.0. Pass the base url in the constructor instead.
*/
public function setRemoveHostFromUrl($remove = true)
{
trigger_error(
'setRemoveHostFromUrl() is deprecated as of 1.2 and will be removed in 2.0. Pass the base url in the constructor instead.',
E_USER_DEPRECATED
);
$this->removeHostFromUrl = (bool) $remove;
}
/**
* Tells driver to remove script name from URL.
*
* @param Boolean $remove
*
* @deprecated Deprecated as of 1.2, to be removed in 2.0. Pass the base url in the constructor instead.
*/
public function setRemoveScriptFromUrl($remove = true)
{
trigger_error(
'setRemoveScriptFromUrl() is deprecated as of 1.2 and will be removed in 2.0. Pass the base url in the constructor instead.',
E_USER_DEPRECATED
);
$this->removeScriptFromUrl = (bool) $remove;
}
/**
* {@inheritdoc}
*/
public function start()
{
$this->started = true;
}
/**
* {@inheritdoc}
*/
public function isStarted()
{
return $this->started;
}
/**
* {@inheritdoc}
*/
public function stop()
{
$this->reset();
$this->started = false;
}
/**
* {@inheritdoc}
*/
public function reset()
{
// Restarting the client resets the cookies and the history
$this->client->restart();
$this->forms = array();
$this->serverParameters = array();
}
/**
* {@inheritdoc}
*/
public function visit($url)
{
$this->client->request('GET', $this->prepareUrl($url), array(), array(), $this->serverParameters);
$this->forms = array();
}
/**
* {@inheritdoc}
*/
public function getCurrentUrl()
{
$request = $this->client->getInternalRequest();
if ($request === null) {
throw new DriverException('Unable to access the request before visiting a page');
}
return $request->getUri();
}
/**
* {@inheritdoc}
*/
public function reload()
{
$this->client->reload();
$this->forms = array();
}
/**
* {@inheritdoc}
*/
public function forward()
{
$this->client->forward();
$this->forms = array();
}
/**
* {@inheritdoc}
*/
public function back()
{
$this->client->back();
$this->forms = array();
}
/**
* {@inheritdoc}
*/
public function setBasicAuth($user, $password)
{
if (false === $user) {
unset($this->serverParameters['PHP_AUTH_USER'], $this->serverParameters['PHP_AUTH_PW']);
return;
}
$this->serverParameters['PHP_AUTH_USER'] = $user;
$this->serverParameters['PHP_AUTH_PW'] = $password;
}
/**
* {@inheritdoc}
*/
public function setRequestHeader($name, $value)
{
$contentHeaders = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true);
$name = str_replace('-', '_', strtoupper($name));
// CONTENT_* are not prefixed with HTTP_ in PHP when building $_SERVER
if (!isset($contentHeaders[$name])) {
$name = 'HTTP_' . $name;
}
$this->serverParameters[$name] = $value;
}
/**
* {@inheritdoc}
*/
public function getResponseHeaders()
{
return $this->getResponse()->getHeaders();
}
/**
* {@inheritdoc}
*/
public function setCookie($name, $value = null)
{
if (null === $value) {
$this->deleteCookie($name);
return;
}
$jar = $this->client->getCookieJar();
$jar->set(new Cookie($name, $value));
}
/**
* Deletes a cookie by name.
*
* @param string $name Cookie name.
*/
private function deleteCookie($name)
{
$path = $this->getCookiePath();
$jar = $this->client->getCookieJar();
do {
if (null !== $jar->get($name, $path)) {
$jar->expire($name, $path);
}
$path = preg_replace('/.$/', '', $path);
} while ($path);
}
/**
* Returns current cookie path.
*
* @return string
*/
private function getCookiePath()
{
$path = dirname(parse_url($this->getCurrentUrl(), PHP_URL_PATH));
if ('\\' === DIRECTORY_SEPARATOR) {
$path = str_replace('\\', '/', $path);
}
return $path;
}
/**
* {@inheritdoc}
*/
public function getCookie($name)
{
// Note that the following doesn't work well because
// Symfony\Component\BrowserKit\CookieJar stores cookies by name,
// path, AND domain and if you don't fill them all in correctly then
// you won't get the value that you're expecting.
//
// $jar = $this->client->getCookieJar();
//
// if (null !== $cookie = $jar->get($name)) {
// return $cookie->getValue();
// }
$allValues = $this->client->getCookieJar()->allValues($this->getCurrentUrl());
if (isset($allValues[$name])) {
return $allValues[$name];
}
return null;
}
/**
* {@inheritdoc}
*/
public function getStatusCode()
{
return $this->getResponse()->getStatus();
}
/**
* {@inheritdoc}
*/
public function getContent()
{
return $this->getResponse()->getContent();
}
/**
* {@inheritdoc}
*/
public function findElementXpaths($xpath)
{
$nodes = $this->getCrawler()->filterXPath($xpath);
$elements = array();
foreach ($nodes as $i => $node) {
$elements[] = sprintf('(%s)[%d]', $xpath, $i + 1);
}
return $elements;
}
/**
* {@inheritdoc}
*/
public function getTagName($xpath)
{
return $this->getCrawlerNode($this->getFilteredCrawler($xpath))->nodeName;
}
/**
* {@inheritdoc}
*/
public function getText($xpath)
{
$text = $this->getFilteredCrawler($xpath)->text();
$text = str_replace("\n", ' ', $text);
$text = preg_replace('/ {2,}/', ' ', $text);
return trim($text);
}
/**
* {@inheritdoc}
*/
public function getHtml($xpath)
{
// cut the tag itself (making innerHTML out of outerHTML)
return preg_replace('/^\<[^\>]+\>|\<[^\>]+\>$/', '', $this->getOuterHtml($xpath));
}
/**
* {@inheritdoc}
*/
public function getOuterHtml($xpath)
{
$node = $this->getCrawlerNode($this->getFilteredCrawler($xpath));
return $node->ownerDocument->saveHTML($node);
}
/**
* {@inheritdoc}
*/
public function getAttribute($xpath, $name)
{
$node = $this->getFilteredCrawler($xpath);
if ($this->getCrawlerNode($node)->hasAttribute($name)) {
return $node->attr($name);
}
return null;
}
/**
* {@inheritdoc}
*/
public function getValue($xpath)
{
if (in_array($this->getAttribute($xpath, 'type'), array('submit', 'image', 'button'), true)) {
return $this->getAttribute($xpath, 'value');
}
$node = $this->getCrawlerNode($this->getFilteredCrawler($xpath));
if ('option' === $node->tagName) {
return $this->getOptionValue($node);
}
try {
$field = $this->getFormField($xpath);
} catch (\InvalidArgumentException $e) {
return $this->getAttribute($xpath, 'value');
}
return $field->getValue();
}
/**
* {@inheritdoc}
*/
public function setValue($xpath, $value)
{
$this->getFormField($xpath)->setValue($value);
}
/**
* {@inheritdoc}
*/
public function check($xpath)
{
$this->getCheckboxField($xpath)->tick();
}
/**
* {@inheritdoc}
*/
public function uncheck($xpath)
{
$this->getCheckboxField($xpath)->untick();
}
/**
* {@inheritdoc}
*/
public function selectOption($xpath, $value, $multiple = false)
{
$field = $this->getFormField($xpath);
if (!$field instanceof ChoiceFormField) {
throw new DriverException(sprintf('Impossible to select an option on the element with XPath "%s" as it is not a select or radio input', $xpath));
}
if ($multiple) {
$oldValue = (array) $field->getValue();
$oldValue[] = $value;
$value = $oldValue;
}
$field->select($value);
}
/**
* {@inheritdoc}
*/
public function isSelected($xpath)
{
$optionValue = $this->getOptionValue($this->getCrawlerNode($this->getFilteredCrawler($xpath)));
$selectField = $this->getFormField('(' . $xpath . ')/ancestor-or-self::*[local-name()="select"]');
$selectValue = $selectField->getValue();
return is_array($selectValue) ? in_array($optionValue, $selectValue, true) : $optionValue === $selectValue;
}
/**
* {@inheritdoc}
*/
public function click($xpath)
{
$crawler = $this->getFilteredCrawler($xpath);
$node = $this->getCrawlerNode($crawler);
$tagName = $node->nodeName;
if ('a' === $tagName) {
$this->client->click($crawler->link());
$this->forms = array();
} elseif ($this->canSubmitForm($node)) {
$this->submit($crawler->form());
} elseif ($this->canResetForm($node)) {
$this->resetForm($node);
} else {
$message = sprintf('%%s supports clicking on links and submit or reset buttons only. But "%s" provided', $tagName);
throw new UnsupportedDriverActionException($message, $this);
}
}
/**
* {@inheritdoc}
*/
public function isChecked($xpath)
{
$field = $this->getFormField($xpath);
if (!$field instanceof ChoiceFormField || 'select' === $field->getType()) {
throw new DriverException(sprintf('Impossible to get the checked state of the element with XPath "%s" as it is not a checkbox or radio input', $xpath));
}
if ('checkbox' === $field->getType()) {
return $field->hasValue();
}
$radio = $this->getCrawlerNode($this->getFilteredCrawler($xpath));
return $radio->getAttribute('value') === $field->getValue();
}
/**
* {@inheritdoc}
*/
public function attachFile($xpath, $path)
{
$field = $this->getFormField($xpath);
if (!$field instanceof FileFormField) {
throw new DriverException(sprintf('Impossible to attach a file on the element with XPath "%s" as it is not a file input', $xpath));
}
$field->upload($path);
}
/**
* {@inheritdoc}
*/
public function submitForm($xpath)
{
$crawler = $this->getFilteredCrawler($xpath);
$this->submit($crawler->form());
}
/**
* @return Response
*
* @throws DriverException If there is not response yet
*/
protected function getResponse()
{
$response = $this->client->getInternalResponse();
if (null === $response) {
throw new DriverException('Unable to access the response before visiting a page');
}
return $response;
}
/**
* Prepares URL for visiting.
* Removes "*.php/" from urls and then passes it to BrowserKitDriver::visit().
*
* @param string $url
*
* @return string
*/
protected function prepareUrl($url)
{
$replacement = ($this->removeHostFromUrl ? '' : '$1') . ($this->removeScriptFromUrl ? '' : '$2');
return preg_replace('#(https?\://[^/]+)(/[^/\.]+\.php)?#', $replacement, $url);
}
/**
* Returns form field from XPath query.
*
* @param string $xpath
*
* @return FormField
*
* @throws DriverException
*/
protected function getFormField($xpath)
{
$fieldNode = $this->getCrawlerNode($this->getFilteredCrawler($xpath));
$fieldName = str_replace('[]', '', $fieldNode->getAttribute('name'));
$formNode = $this->getFormNode($fieldNode);
$formId = $this->getFormNodeId($formNode);
if (!isset($this->forms[$formId])) {
$this->forms[$formId] = new Form($formNode, $this->getCurrentUrl());
}
if (is_array($this->forms[$formId][$fieldName])) {
return $this->forms[$formId][$fieldName][$this->getFieldPosition($fieldNode)];
}
return $this->forms[$formId][$fieldName];
}
/**
* Returns the checkbox field from xpath query, ensuring it is valid.
*
* @param string $xpath
*
* @return ChoiceFormField
*
* @throws DriverException when the field is not a checkbox
*/
private function getCheckboxField($xpath)
{
$field = $this->getFormField($xpath);
if (!$field instanceof ChoiceFormField) {
throw new DriverException(sprintf('Impossible to check the element with XPath "%s" as it is not a checkbox', $xpath));
}
return $field;
}
/**
* @param \DOMElement $element
*
* @return \DOMElement
*
* @throws DriverException if the form node cannot be found
*/
private function getFormNode(\DOMElement $element)
{
if ($element->hasAttribute('form')) {
$formId = $element->getAttribute('form');
$formNode = $element->ownerDocument->getElementById($formId);
if (null === $formNode || 'form' !== $formNode->nodeName) {
throw new DriverException(sprintf('The selected node has an invalid form attribute (%s).', $formId));
}
return $formNode;
}
$formNode = $element;
do {
// use the ancestor form element
if (null === $formNode = $formNode->parentNode) {
throw new DriverException('The selected node does not have a form ancestor.');
}
} while ('form' !== $formNode->nodeName);
return $formNode;
}
/**
* Gets the position of the field node among elements with the same name
*
* BrowserKit uses the field name as index to find the field in its Form object.
* When multiple fields have the same name (checkboxes for instance), it will return
* an array of elements in the order they appear in the DOM.
*
* @param \DOMElement $fieldNode
*
* @return integer
*/
private function getFieldPosition(\DOMElement $fieldNode)
{
$elements = $this->getCrawler()->filterXPath('//*[@name=\''.$fieldNode->getAttribute('name').'\']');
if (count($elements) > 1) {
// more than one element contains this name !
// so we need to find the position of $fieldNode
foreach ($elements as $key => $element) {
/** @var \DOMElement $element */
if ($element->getNodePath() === $fieldNode->getNodePath()) {
return $key;
}
}
}
return 0;
}
private function submit(Form $form)
{
$formId = $this->getFormNodeId($form->getFormNode());
if (isset($this->forms[$formId])) {
$this->mergeForms($form, $this->forms[$formId]);
}
// remove empty file fields from request
foreach ($form->getFiles() as $name => $field) {
if (empty($field['name']) && empty($field['tmp_name'])) {
$form->remove($name);
}
}
foreach ($form->all() as $field) {
// Add a fix for https://github.com/symfony/symfony/pull/10733 to support Symfony versions which are not fixed
if ($field instanceof TextareaFormField && null === $field->getValue()) {
$field->setValue('');
}
}
$this->client->submit($form);
$this->forms = array();
}
private function resetForm(\DOMElement $fieldNode)
{
$formNode = $this->getFormNode($fieldNode);
$formId = $this->getFormNodeId($formNode);
unset($this->forms[$formId]);
}
/**
* Determines if a node can submit a form.
*
* @param \DOMElement $node Node.
*
* @return boolean
*/
private function canSubmitForm(\DOMElement $node)
{
$type = $node->hasAttribute('type') ? $node->getAttribute('type') : null;
if ('input' === $node->nodeName && in_array($type, array('submit', 'image'), true)) {
return true;
}
return 'button' === $node->nodeName && (null === $type || 'submit' === $type);
}
/**
* Determines if a node can reset a form.
*
* @param \DOMElement $node Node.
*
* @return boolean
*/
private function canResetForm(\DOMElement $node)
{
$type = $node->hasAttribute('type') ? $node->getAttribute('type') : null;
return in_array($node->nodeName, array('input', 'button'), true) && 'reset' === $type;
}
/**
* Returns form node unique identifier.
*
* @param \DOMElement $form
*
* @return string
*/
private function getFormNodeId(\DOMElement $form)
{
return md5($form->getLineNo() . $form->getNodePath() . $form->nodeValue);
}
/**
* Gets the value of an option element
*
* @param \DOMElement $option
*
* @return string
*
* @see \Symfony\Component\DomCrawler\Field\ChoiceFormField::buildOptionValue
*/
private function getOptionValue(\DOMElement $option)
{
if ($option->hasAttribute('value')) {
return $option->getAttribute('value');
}
if (!empty($option->nodeValue)) {
return $option->nodeValue;
}
return '1'; // DomCrawler uses 1 by default if there is no text in the option
}
/**
* Merges second form values into first one.
*
* @param Form $to merging target
* @param Form $from merging source
*/
private function mergeForms(Form $to, Form $from)
{
foreach ($from->all() as $name => $field) {
$fieldReflection = new \ReflectionObject($field);
$nodeReflection = $fieldReflection->getProperty('node');
$valueReflection = $fieldReflection->getProperty('value');
$nodeReflection->setAccessible(true);
$valueReflection->setAccessible(true);
$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));
}
}
}
/**
* Returns DOMElement from crawler instance.
*
* @param Crawler $crawler
*
* @return \DOMElement
*
* @throws DriverException when the node does not exist
*/
private function getCrawlerNode(Crawler $crawler)
{
$crawler->rewind();
$node = $crawler->current();
if (null !== $node) {
return $node;
}
throw new DriverException('The element does not exist');
}
/**
* Returns a crawler filtered for the given XPath, requiring at least 1 result.
*
* @param string $xpath
*
* @return Crawler
*
* @throws DriverException when no matching elements are found
*/
private function getFilteredCrawler($xpath)
{
if (!count($crawler = $this->getCrawler()->filterXPath($xpath))) {
throw new DriverException(sprintf('There is no element matching XPath "%s"', $xpath));
}
return $crawler;
}
/**
* Returns crawler instance (got from client).
*
* @return Crawler
*
* @throws DriverException
*/
private function getCrawler()
{
$crawler = $this->client->getCrawler();
if (null === $crawler) {
throw new DriverException('Unable to access the response content before visiting a page');
}
return $crawler;
}
}

View File

@ -1,4 +0,0 @@
vendor
composer.phar
composer.lock
phpunit.xml

View File

@ -1,27 +0,0 @@
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
install:
- composer install
before_script:
- export WEB_FIXTURES_HOST=http://localhost:8000
# 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

View File

@ -1,31 +0,0 @@
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
==================
The driver now relies on BrowserKitDriver 1.2.x, so all changes of this driver are relevant.
The changes below only describe the changes related to GoutteDriver specifically.
New features:
* Added the possibility to use a normal Goutte client instead of requiring to use an extended one
* Added the support of Goutte 2.0 as well
Bug fixes:
* Fixed the support of disabling basic auth
* Fixed the resetting of the driver to reset the basic auth
Testing:
* Updated the testsuite to use the new Mink 1.6 driver testsuite
* Added testing on HHVM

View File

@ -1,22 +0,0 @@
Copyright (c) 2012-2013 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
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,60 +0,0 @@
Mink Goutte Driver
==================
[![Latest Stable Version](https://poser.pugx.org/behat/mink-goutte-driver/v/stable.svg)](https://packagist.org/packages/behat/mink-goutte-driver)
[![Latest Unstable Version](https://poser.pugx.org/behat/mink-goutte-driver/v/unstable.svg)](https://packagist.org/packages/behat/mink-goutte-driver)
[![Total Downloads](https://poser.pugx.org/behat/mink-goutte-driver/downloads.svg)](https://packagist.org/packages/behat/mink-goutte-driver)
[![Build Status](https://travis-ci.org/minkphp/MinkGoutteDriver.svg?branch=master)](https://travis-ci.org/minkphp/MinkGoutteDriver)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/minkphp/MinkGoutteDriver/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/minkphp/MinkGoutteDriver/)
[![Code Coverage](https://scrutinizer-ci.com/g/minkphp/MinkGoutteDriver/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/minkphp/MinkGoutteDriver/)
[![License](https://poser.pugx.org/behat/mink-goutte-driver/license.svg)](https://packagist.org/packages/behat/mink-goutte-driver)
Usage Example
-------------
``` php
<?php
require "vendor/autoload.php";
use Behat\Mink\Mink,
Behat\Mink\Session,
Behat\Mink\Driver\GoutteDriver,
Behat\Mink\Driver\Goutte\Client as GoutteClient;
$mink = new Mink(array(
'goutte' => new Session(new GoutteDriver(new GoutteClient())),
));
$session = $mink->getSession('goutte');
$session->visit("http://php.net/");
$session->getPage()->clickLink('Downloads');
echo $session->getCurrentUrl() . PHP_EOL;
```
Installation
------------
Add a file composer.json with content:
``` json
{
"require": {
"behat/mink": "~1.5",
"behat/mink-goutte-driver": "~1.0"
}
}
```
(or merge the above into your project's existing composer.json file)
``` bash
$> curl -sS https://getcomposer.org/installer | php
$> php composer.phar install
```
Maintainers
-----------
* Christophe Coevoet [stof](https://github.com/stof)
* Other [awesome developers](https://github.com/minkphp/MinkGoutteDriver/graphs/contributors)

View File

@ -1,45 +0,0 @@
{
"name": "behat/mink-goutte-driver",
"description": "Goutte driver for Mink framework",
"keywords": ["goutte", "headless", "testing", "browser"],
"homepage": "http://mink.behat.org/",
"type": "mink-driver",
"license": "MIT",
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
}
],
"require": {
"php": ">=5.3.1",
"behat/mink": "~1.6@dev",
"behat/mink-browserkit-driver": "~1.2@dev",
"fabpot/goutte": "~1.0.4|~2.0|~3.1"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"autoload": {
"psr-4": {
"Behat\\Mink\\Driver\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Behat\\Mink\\Tests\\Driver\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
}
}

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="vendor/behat/mink/driver-testsuite/bootstrap.php">
<testsuites>
<testsuite name="Driver test suite">
<directory>tests</directory>
<directory>vendor/behat/mink/driver-testsuite/tests/Basic</directory>
<directory>vendor/behat/mink/driver-testsuite/tests/Form</directory>
</testsuite>
</testsuites>
<php>
<var name="driver_config_factory" value="Behat\Mink\Tests\Driver\GoutteConfig::getInstance" />
<!--server name="WEB_FIXTURES_HOST" value="http://test.mink.dev" /-->
</php>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
</phpunit>

View File

@ -1,43 +0,0 @@
<?php
/*
* This file is part of the Behat\Mink.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Driver\Goutte;
use Goutte\Client as BaseClient;
use Symfony\Component\BrowserKit\Response;
/**
* Client overrides to support Mink functionality.
*/
class Client extends BaseClient
{
/**
* Reads response meta tags to guess content-type charset.
*
* @param Response $response
*
* @return Response
*/
protected function filterResponse($response)
{
$contentType = $response->getHeader('Content-Type');
if (!$contentType || false === strpos($contentType, 'charset=')) {
if (preg_match('/\<meta[^\>]+charset *= *["\']?([a-zA-Z\-0-9]+)/i', $response->getContent(), $matches)) {
$headers = $response->getHeaders();
$headers['Content-Type'] = $contentType.';charset='.$matches[1];
$response = new Response($response->getContent(), $response->getStatus(), $headers);
}
}
return parent::filterResponse($response);
}
}

View File

@ -1,75 +0,0 @@
<?php
/*
* This file is part of the Behat\Mink.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Driver;
use Behat\Mink\Driver\Goutte\Client as ExtendedClient;
use Goutte\Client;
/**
* Goutte driver.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class GoutteDriver extends BrowserKitDriver
{
/**
* Initializes Goutte driver.
*
* @param Client $client Goutte client instance
*/
public function __construct(Client $client = null)
{
parent::__construct($client ?: new ExtendedClient());
}
/**
* {@inheritdoc}
*/
public function setBasicAuth($user, $password)
{
if (false === $user) {
$this->getClient()->resetAuth();
return;
}
$this->getClient()->setAuth($user, $password);
}
/**
* Gets the Goutte client.
*
* The method is overwritten only to provide the appropriate return type hint.
*
* @return Client
*/
public function getClient()
{
return parent::getClient();
}
/**
* {@inheritdoc}
*/
public function reset()
{
parent::reset();
$this->getClient()->resetAuth();
}
/**
* {@inheritdoc}
*/
protected function prepareUrl($url)
{
return $url;
}
}

View File

@ -1,5 +0,0 @@
*.tgz
*.phar
phpunit.xml
composer.lock
vendor

View File

@ -1,28 +0,0 @@
language: php
sudo: false
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/files
before_install:
- composer self-update
install:
- composer update $COMPOSER_FLAGS
script: phpunit -v --coverage-clover=coverage.clover
after_script:
- 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

View File

@ -1,297 +0,0 @@
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
==================
Bug fixes:
* Added a check for empty path in `WebAssert::cleanUrl()`
Driver testsuite:
* Added an extra test to ensure the right behavior for traversal
Misc:
* Changed the description in the composer.json
* Switched the repository structure to use PSR-4
* Updated URLs for the move to the new Github organization
1.6.0 / 2014-09-26
==================
* [BC break] Changed the named selector to prefer exact matches over partial matches
* [BC break] Changed `NodeElement::getValue` for checkboxes to return the value rather than the checked state (use `isChecked` for that)
* Fixed the XPath prefixing when searching inside an existing element
* Refactored the driver testsuite entirely and expand it to cover drivers entirely (covering many more cases for consistency)
* Changed `NodeElement::setValue` to support any fields rather than only input elements
* Removed the wrapping of any driver-level exception in a MinkException on invalid usage as it was making the code too complex
* Fixed the matching of the input type in the named selector to be case insensitive according to the HTML spec
* Introduced `Behat\Mink\Selector\Xpath\Escaper` to allow reusing the XPath escaping
* Deprecated `Element::getSession`. Code needing the session should get it from outside rather than the element
* Changed ElementNotFoundException to extend from ExpectationException
* Added `Element::getOuterHtml` to get the HTML code of the element including itself
* Fixed the name selectors to match on the `placeholder` only for textual inputs
* Enforced consistent behavior for drivers on 4xx and 5xx response to return the response rather than throwing an exception
* Added `Element::waitFor` to allow retrying some code until it succeeds or the timeout is reached
* Added `Element::isValid` to check whether an element still exists in the page
* Made `Session::executeScript` compatible across drivers by ensuring they all support the same syntaxes for the JS expression
* Made `Session::evaluateScript` compatible across drivers by ensuring they all support the same syntaxes for the JS expression
* Removed `hasClass` from `DocumentElement` (instead of triggering a fatal error)
* Added testing on HHVM to ensure consistency
* Fixed `NodeElement::getTagName` to ensure that the tag name is lowercase for all drivers
* Fixed `Element::hasAttribute` to ensure it supports attributes with an empty value
* Fixed the `field` selector to avoid matching inputs with the type `submit` or `reset`
* Changed the button XPath selection to accept `reset` buttons as well
* Changed `Session::wait` to return the condition value rather than nothing
* Added `Session::getWindowName` and `Session::getWindowNames` to get the name of the current and of all windows
* Added `Session::maximizeWindow` to maximize the window
* Added `NodeElement::isSelected` to check whether an `<option>` is selected
* Added `NodeElement::submitForm` to allow submitting a form without using a button
* Added assertions about the value of an attribute
* Added the anchor in the assertion on the URL in `WebAssert`
1.5.0 / 2013-04-14
==================
* Add `CoreDriver` to simplify future drivers improvements
* Add `Mink::isSessionStarted()` method
* Fix multibite string `preg_replace` bugs
* Fix handling of whitespaces in `WebAssert::pageText...()` methods
1.4.3 / 2013-03-02
==================
* Bump dependencies constraints
1.4.2 / 2013-02-13
==================
* Fix wrong test case to ensure that core drivers work as expected
1.4.1 / 2013-02-10
==================
* Update dependencies
* Add ElementException to element actions
* Rel attribute support for named selectors
* Add hasClass() helper to traversable elements
* Add getScreenshot() method to session
* Name attr support in named selector for button
* Fix for bunch of bugs
1.4.0 / 2012-05-40
==================
* New `Session::selectWindow()` and `Session::selectIFrame()` methods
* New built-in `WebAssert` class
* Fixed DocBlocks (autocompletion in any IDE now should just work)
* Moved Behat-related code into `Behat\MinkExtension`
* Removed PHPUnit test case class
* Updated composer dependencies to not require custom repository anymore
* All drivers moved into separate packages
1.3.3 / 2012-03-23
==================
* Prevent exceptions in `__toString()`
* Added couple of useful step definitions for Behat
* Fixed issues #168, #211, #212, #208
* Lot of small bug fixes and improvements
* Fixed dependencies and composer installation routine
1.3.2 / 2011-12-21
==================
* Fixed webdriver registration in MinkContext
1.3.1 / 2011-12-21
==================
* Fixed Composer package
1.3.0 / 2011-12-21
==================
* Brand new Selenium2Driver (webdriver session)
* Multiselect bugfixes
* ZombieDriver back in the business
* Composer now manages dependencies
* Some MinkContext steps got fixes
* Lots of bug fixes and cleanup
1.2.0 / 2011-11-04
==================
* Brand new SeleniumDriver (thanks @alexandresalome)
* Multiselect support (multiple options selection), including new Behat steps
* Ability to select option by it's text (in addition to value)
* ZombieDriver updates
* Use SuiteHooks to populate parameters (no need to call parent __construct anymore)
* Updated Goutte and all vendors
* Lot of bugfixes and new tests
1.1.1 / 2011-08-12
==================
* Fixed Zombie.js server termination on Linux
* Fixed base_url usage for external URLs
1.1.0 / 2011-08-08
==================
* Added Zombie.js driver (thanks @b00giZm)
* Added pt translation (thanks Daniel Gomes)
* Refactored MinkContext and MinkTestCase
1.0.3 / 2011-08-02
==================
* File uploads for empty fields fixed (GoutteDriver)
* Lazy sessions restart
* `show_tmp_dir` option in MinkContext
* Updated to stable Symfony2 components
* SahiClient connection limit bumped to 60 seconds
* Dutch language support
1.0.2 / 2011-07-22
==================
* ElementHtmlException fixed (thanks @Stof)
1.0.1 / 2011-07-21
==================
* Fixed buggy assertions in MinkContext
1.0.0 / 2011-07-20
==================
* Added missing tests for almost everything
* Hude speedup for SahiDriver
* Support for Behat 2.0 contexts
* Bundled PHPUnit TestCase
* Deep element traversing
* Correct behavior of getText() method
* New getHtml() method
* Basic HTTP auth support
* Soft and hard session resetting
* Cookies management
* Browser history interactions (reload(), back(), forward())
* Weaverryan'd exception messages
* Huge amount of bugfixes and small additions
0.3.2 / 2011-06-20
==================
* Fixed file uploads in Goutte driver
* Fixed setting of long texts into fields
* Added getPlainText() (returns text without tags and whitespaces) method to the element's API
* Start_url is now optional parameter
* Default session (if needed) name now need to be always specified by hands with setDefaultSessionName()
* default_driver => default_session
* Updated Symfony Components
0.3.1 / 2011-05-17
==================
* Small SahiClient update (it generates SID now if no provided)
* setActiveSessionName => setDefaultSessionName method rename
0.3.0 / 2011-05-17
==================
* Rewritten from scratch Mink drivers handler. Now it's sessions handler. And Mink now
sessions-centric tool. See examples in readme. Much cleaner API now.
0.2.4 / 2011-05-12
==================
* Fixed wrong url locator function
* Fixed wrong regex in `should see` step
* Fixed delimiters use in `should see` step
* Added url-match step for checking urls against regex
0.2.3 / 2011-05-01
==================
* Updated SahiClient with new version, which is faster and cleaner with it's exceptions
0.2.2 / 2011-05-01
==================
* Ability to use already started browser as SahiDriver aim
* Added japanese translation for bundled steps (thanks @hidenorigoto)
* 10 seconds limit for browser connection in SahiDriver
0.2.1 / 2011-04-21
==================
* Fixed some bundled step definitions
0.2.0 / 2011-04-21
==================
* Additional step definitions
* Support for extended drivers configuration through behat.yml environment parameters
* Lots of new named selectors
* Bug fixes
* Small improvements
0.1.2 / 2011-04-08
==================
* Fixed Sahi url escaping
0.1.1 / 2011-04-06
==================
* Fixed should/should_not steps
* Added spanish translation
* Fixed forms to use <base> element
* Fixed small UnsupportedByDriverException issue
0.1.0 / 2011-04-04
==================
* Initial release

View File

@ -1,22 +0,0 @@
# Contributing
Mink is an open source, community-driven project. If you'd like to contribute, feel free to do this, but remember to follow these few simple rules:
## Submitting an issues
- __Driver-related__ issues must be reported in the corresponding driver repository
- A reproducible example is required for every bug report, otherwise it will most probably be __closed without warning__
- If you are going to make a big, substantial change, let's discuss it first
## Working with Pull Requests
1. Create your feature addition or a bug fix branch based on `master` branch in your repository's fork.
2. Make necessary changes, but __don't mix__ code reformatting with code changes on topic.
3. Add tests for those changes (please look into `tests/` folder for some examples). This is important so we don't break it in a future version unintentionally.
4. Commit your code, but do not mess with `CHANGES.md`.
5. Squash your commits by topic to preserve a clean and readable log.
6. Create Pull Request.
# Running tests
Make sure that you don't break anything with your changes by running:
```bash
$> phpunit
```

View File

@ -1,22 +0,0 @@
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
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,74 +0,0 @@
Mink
====
[![Latest Stable Version](https://poser.pugx.org/behat/mink/v/stable.svg)](https://packagist.org/packages/behat/mink)
[![Latest Unstable Version](https://poser.pugx.org/behat/mink/v/unstable.svg)](https://packagist.org/packages/behat/mink)
[![Total Downloads](https://poser.pugx.org/behat/mink/downloads.svg)](https://packagist.org/packages/behat/mink)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/minkphp/Mink/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/minkphp/Mink/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/minkphp/Mink/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/minkphp/Mink/)
[![Build Status](https://travis-ci.org/minkphp/Mink.svg?branch=master)](https://travis-ci.org/minkphp/Mink)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/5bb8fab0-978f-428a-ae23-44ee4e129fbc/mini.png)](https://insight.sensiolabs.com/projects/5bb8fab0-978f-428a-ae23-44ee4e129fbc)
[![License](https://poser.pugx.org/behat/mink/license.svg)](https://packagist.org/packages/behat/mink)
Useful Links
------------
- The main website with documentation is at [http://mink.behat.org](http://mink.behat.org)
- Official Google Group is at [http://groups.google.com/group/behat](http://groups.google.com/group/behat)
- IRC channel on [#freenode](http://freenode.net/) is `#behat`
- [Note on Patches/Pull Requests](CONTRIBUTING.md)
Usage Example
-------------
``` php
<?php
use Behat\Mink\Mink,
Behat\Mink\Session,
Behat\Mink\Driver\GoutteDriver,
Behat\Mink\Driver\Goutte\Client as GoutteClient;
$startUrl = 'http://example.com';
// init Mink and register sessions
$mink = new Mink(array(
'goutte1' => new Session(new GoutteDriver(new GoutteClient())),
'goutte2' => new Session(new GoutteDriver(new GoutteClient())),
'custom' => new Session(new MyCustomDriver($startUrl))
));
// set the default session name
$mink->setDefaultSessionName('goutte2');
// visit a page
$mink->getSession()->visit($startUrl);
// call to getSession() without argument will always return a default session if has one (goutte2 here)
$mink->getSession()->getPage()->findLink('Downloads')->click();
echo $mink->getSession()->getPage()->getContent();
// call to getSession() with argument will return session by its name
$mink->getSession('custom')->getPage()->findLink('Downloads')->click();
echo $mink->getSession('custom')->getPage()->getContent();
// this all is done to make possible mixing sessions
$mink->getSession('goutte1')->getPage()->findLink('Chat')->click();
$mink->getSession('goutte2')->getPage()->findLink('Chat')->click();
```
Install Dependencies
--------------------
``` bash
$> curl -sS https://getcomposer.org/installer | php
$> php composer.phar install
```
Contributors
------------
* Konstantin Kudryashov [everzet](https://github.com/everzet) [lead developer]
* Christophe Coevoet [stof](https://github.com/stof) [lead developer]
* Alexander Obuhovich [aik099](https://github.com/aik099) [lead developer]
* Other [awesome developers](https://github.com/minkphp/Mink/graphs/contributors)

View File

@ -1,50 +0,0 @@
{
"name": "behat/mink",
"description": "Browser controller/emulator abstraction for PHP",
"keywords": ["web", "testing", "browser"],
"homepage": "http://mink.behat.org/",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
}
],
"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)"
},
"autoload": {
"psr-4": {
"Behat\\Mink\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Behat\\Mink\\Tests\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.7.x-dev"
}
}
}

View File

@ -1,125 +0,0 @@
; Default configuration file for PHPDoctor
; This config file will cause PHPDoctor to generate API documentation of
; itself.
; PHPDoctor settings
; -----------------------------------------------------------------------------
; Names of files to parse. This can be a single filename, or a comma separated
; list of filenames. Wildcards are allowed.
files = "*.php"
; Names of files or directories to ignore. This can be a single filename, or a
; comma separated list of filenames. Wildcards are NOT allowed.
ignore = "CVS, .svn, .git, _compiled"
; The directory to look for files in, if not used the PHPDoctor will look in
; the current directory (the directory it is run from).
source_path = "./src"
; If you do not want PHPDoctor to look in each sub directory for files
; uncomment this line.
;subdirs = off
; Set how loud PHPDoctor is as it runs. Quiet mode suppresses all output other
; than warnings and errors. Verbose mode outputs additional messages during
; execution.
;quiet = on
;verbose = on
; Select the doclet to use for generating output.
doclet = standard
;doclet = debug
; The directory to find the doclet in. Doclets are expected to be in a
; directory named after themselves at the location given.
;doclet_path = ./doclets
; The directory to find taglets in. Taglets allow you to make PHPDoctor handle
; new tags and to alter the behavour of existing tags and their output.
;taglet_path = ./taglets
; If the code you are parsing does not use package tags or not all elements
; have package tags, use this setting to place unbound elements into a
; particular package.
default_package = "Behat\Mink"
; Specifies the name of a HTML file containing text for the overview
; documentation to be placed on the overview page. The path is relative to
; "source_path" unless an absolute path is given.
overview = readme.html
; Package comments will be looked for in a file named package.html in the same
; directory as the first source file parsed in that package or in the directory
; given below. If package comments are placed in the directory given below then
; they should be named "<packageName>.html".
package_comment_dir = ./
; Parse out global variables and/or global constants?
;globals = off
;constants = off
; Generate documentation for all class members
;private = on
; Generate documentation for public and protected class members
;protected = on
; Generate documentation for only public class members
public = on
; Use the PEAR compatible handling of the docblock first sentence
;pear_compat = on
; Standard doclet settings
; -----------------------------------------------------------------------------
; The directory to place generated documentation in. If the given path is
; relative to it will be relative to "source_path".
d = "api"
; Specifies the title to be placed in the HTML <title> tag.
windowtitle = "Behat\Mink"
; Specifies the title to be placed near the top of the overview summary file.
doctitle = "Behat\Mink: browser emulators abstraction library for PHP"
; Specifies the header text to be placed at the top of each output file. The
; header will be placed to the right of the upper navigation bar.
header = "Behat\Mink"
; Specifies the footer text to be placed at the bottom of each output file. The
; footer will be placed to the right of the lower navigation bar.
footer = "Behat\Mink"
; Specifies the text to be placed at the bottom of each output file. The text
; will be placed at the bottom of the page, below the lower navigation bar.
;bottom = "This document was generated by <a href="http://phpdoctor.sourceforge.net/">PHPDoctor: The PHP Documentation Creator</a>"
; Create a class tree?
tree = on

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="Behat Mink test suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
</phpunit>

View File

@ -1,475 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Driver;
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\UnsupportedDriverActionException;
use Behat\Mink\Session;
/**
* Core driver.
* All other drivers should extend this class for future compatibility.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
abstract class CoreDriver implements DriverInterface
{
/**
* @var Session
*/
private $session;
/**
* {@inheritdoc}
*/
public function setSession(Session $session)
{
$this->session = $session;
}
/**
* {@inheritdoc}
*/
public function start()
{
throw new UnsupportedDriverActionException('Starting the driver is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function isStarted()
{
throw new UnsupportedDriverActionException('Checking the driver state is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function stop()
{
throw new UnsupportedDriverActionException('Stopping the driver is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function reset()
{
throw new UnsupportedDriverActionException('Resetting the driver is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function visit($url)
{
throw new UnsupportedDriverActionException('Visiting an url is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getCurrentUrl()
{
throw new UnsupportedDriverActionException('Getting the current url is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getContent()
{
throw new UnsupportedDriverActionException('Getting the page content is not supported by %s', $this);
}
/**
* {@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);
}
/**
* {@inheritdoc}
*/
public function getTagName($xpath)
{
throw new UnsupportedDriverActionException('Getting the tag name is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getText($xpath)
{
throw new UnsupportedDriverActionException('Getting the element text is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getHtml($xpath)
{
throw new UnsupportedDriverActionException('Getting the element inner HTML is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getOuterHtml($xpath)
{
throw new UnsupportedDriverActionException('Getting the element outer HTML is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getAttribute($xpath, $name)
{
throw new UnsupportedDriverActionException('Getting the element attribute is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getValue($xpath)
{
throw new UnsupportedDriverActionException('Getting the field value is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function setValue($xpath, $value)
{
throw new UnsupportedDriverActionException('Setting the field value is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function check($xpath)
{
throw new UnsupportedDriverActionException('Checking a checkbox is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function uncheck($xpath)
{
throw new UnsupportedDriverActionException('Unchecking a checkbox is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function isChecked($xpath)
{
throw new UnsupportedDriverActionException('Getting the state of a checkbox is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function selectOption($xpath, $value, $multiple = false)
{
throw new UnsupportedDriverActionException('Selecting an option is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function click($xpath)
{
throw new UnsupportedDriverActionException('Clicking on an element is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function attachFile($xpath, $path)
{
throw new UnsupportedDriverActionException('Attaching a file in an input is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function reload()
{
throw new UnsupportedDriverActionException('Page reloading is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function forward()
{
throw new UnsupportedDriverActionException('Forward action is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function back()
{
throw new UnsupportedDriverActionException('Backward action is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function setBasicAuth($user, $password)
{
throw new UnsupportedDriverActionException('Basic auth setup is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function switchToWindow($name = null)
{
throw new UnsupportedDriverActionException('Windows management is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function switchToIFrame($name = null)
{
throw new UnsupportedDriverActionException('iFrames management is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function setRequestHeader($name, $value)
{
throw new UnsupportedDriverActionException('Request headers manipulation is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getResponseHeaders()
{
throw new UnsupportedDriverActionException('Response headers are not available from %s', $this);
}
/**
* {@inheritdoc}
*/
public function setCookie($name, $value = null)
{
throw new UnsupportedDriverActionException('Cookies manipulation is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getCookie($name)
{
throw new UnsupportedDriverActionException('Cookies are not available from %s', $this);
}
/**
* {@inheritdoc}
*/
public function getStatusCode()
{
throw new UnsupportedDriverActionException('Status code is not available from %s', $this);
}
/**
* {@inheritdoc}
*/
public function getScreenshot()
{
throw new UnsupportedDriverActionException('Screenshots are not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getWindowNames()
{
throw new UnsupportedDriverActionException('Listing all window names is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function getWindowName()
{
throw new UnsupportedDriverActionException('Listing this window name is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function doubleClick($xpath)
{
throw new UnsupportedDriverActionException('Double-clicking is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function rightClick($xpath)
{
throw new UnsupportedDriverActionException('Right-clicking is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function isVisible($xpath)
{
throw new UnsupportedDriverActionException('Element visibility check is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function isSelected($xpath)
{
throw new UnsupportedDriverActionException('Element selection check is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function mouseOver($xpath)
{
throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function focus($xpath)
{
throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function blur($xpath)
{
throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function keyPress($xpath, $char, $modifier = null)
{
throw new UnsupportedDriverActionException('Keyboard manipulations are not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function keyDown($xpath, $char, $modifier = null)
{
throw new UnsupportedDriverActionException('Keyboard manipulations are not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function keyUp($xpath, $char, $modifier = null)
{
throw new UnsupportedDriverActionException('Keyboard manipulations are not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function dragTo($sourceXpath, $destinationXpath)
{
throw new UnsupportedDriverActionException('Mouse manipulations are not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function executeScript($script)
{
throw new UnsupportedDriverActionException('JS is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function evaluateScript($script)
{
throw new UnsupportedDriverActionException('JS is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function wait($timeout, $condition)
{
throw new UnsupportedDriverActionException('JS is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function resizeWindow($width, $height, $name = null)
{
throw new UnsupportedDriverActionException('Window resizing is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function maximizeWindow($name = null)
{
throw new UnsupportedDriverActionException('Window maximize is not supported by %s', $this);
}
/**
* {@inheritdoc}
*/
public function submitForm($xpath)
{
throw new UnsupportedDriverActionException('Form submission is not supported by %s', $this);
}
}

View File

@ -1,637 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Driver;
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\DriverException;
use Behat\Mink\Exception\UnsupportedDriverActionException;
use Behat\Mink\Session;
/**
* Driver interface.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
interface DriverInterface
{
/**
* Sets driver's current session.
*
* @param Session $session
*/
public function setSession(Session $session);
/**
* Starts driver.
*
* Once started, the driver should be ready to visit a page.
*
* Calling any action before visiting a page is an undefined behavior.
* The only supported method calls on a fresh driver are
* - visit()
* - setRequestHeader()
* - setBasicAuth()
* - reset()
* - stop()
*
* Calling start on a started driver is an undefined behavior. Driver
* implementations are free to handle it silently or to fail with an
* exception.
*
* @throws DriverException When the driver cannot be started
*/
public function start();
/**
* Checks whether driver is started.
*
* @return Boolean
*/
public function isStarted();
/**
* Stops driver.
*
* Once stopped, the driver should be started again before using it again.
*
* Calling any action on a stopped driver is an undefined behavior.
* The only supported method call after stopping a driver is starting it again.
*
* Calling stop on a stopped driver is an undefined behavior. Driver
* implementations are free to handle it silently or to fail with an
* exception.
*
* @throws DriverException When the driver cannot be closed
*/
public function stop();
/**
* Resets driver state.
*
* This should reset cookies, request headers and basic authentication.
* When possible, the history should be reset as well, but this is not enforced
* as some implementations may not be able to reset it without restarting the
* driver entirely. Consumers requiring a clean history should restart the driver
* to enforce it.
*
* Once reset, the driver should be ready to visit a page.
* Calling any action before visiting a page is an undefined behavior.
* The only supported method calls on a fresh driver are
* - visit()
* - setRequestHeader()
* - setBasicAuth()
* - reset()
* - stop()
*
* Calling reset on a stopped driver is an undefined behavior.
*/
public function reset();
/**
* Visit specified URL.
*
* @param string $url url of the page
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function visit($url);
/**
* Returns current URL address.
*
* @return string
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getCurrentUrl();
/**
* Reloads current page.
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function reload();
/**
* Moves browser forward 1 page.
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function forward();
/**
* Moves browser backward 1 page.
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function back();
/**
* Sets HTTP Basic authentication parameters.
*
* @param string|Boolean $user user name or false to disable authentication
* @param string $password password
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function setBasicAuth($user, $password);
/**
* Switches to specific browser window.
*
* @param string $name window name (null for switching back to main window)
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function switchToWindow($name = null);
/**
* Switches to specific iFrame.
*
* @param string $name iframe name (null for switching back)
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function switchToIFrame($name = null);
/**
* Sets specific request header on client.
*
* @param string $name
* @param string $value
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function setRequestHeader($name, $value);
/**
* Returns last response headers.
*
* @return array
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getResponseHeaders();
/**
* Sets cookie.
*
* @param string $name
* @param string $value
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function setCookie($name, $value = null);
/**
* Returns cookie by name.
*
* @param string $name
*
* @return string|null
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getCookie($name);
/**
* Returns last response status code.
*
* @return int
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getStatusCode();
/**
* Returns last response content.
*
* @return string
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getContent();
/**
* Capture a screenshot of the current window.
*
* @return string screenshot of MIME type image/* depending
* on driver (e.g., image/png, image/jpeg)
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getScreenshot();
/**
* Return the names of all open windows.
*
* @return array array of all open windows
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getWindowNames();
/**
* Return the name of the currently active window.
*
* @return string the name of the current window
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getWindowName();
/**
* Finds elements with specified XPath query.
*
* @param string $xpath
*
* @return NodeElement[]
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function find($xpath);
/**
* Returns element's tag name by it's XPath query.
*
* @param string $xpath
*
* @return string
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getTagName($xpath);
/**
* Returns element's text by it's XPath query.
*
* @param string $xpath
*
* @return string
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getText($xpath);
/**
* Returns element's inner html by it's XPath query.
*
* @param string $xpath
*
* @return string
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getHtml($xpath);
/**
* Returns element's outer html by it's XPath query.
*
* @param string $xpath
*
* @return string
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getOuterHtml($xpath);
/**
* Returns element's attribute by it's XPath query.
*
* @param string $xpath
* @param string $name
*
* @return string|null
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function getAttribute($xpath, $name);
/**
* Returns element's value by it's XPath query.
*
* @param string $xpath
*
* @return string|bool|array
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*
* @see \Behat\Mink\Element\NodeElement::getValue
*/
public function getValue($xpath);
/**
* Sets element's value by it's XPath query.
*
* @param string $xpath
* @param string|bool|array $value
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*
* @see \Behat\Mink\Element\NodeElement::setValue
*/
public function setValue($xpath, $value);
/**
* Checks checkbox by it's XPath query.
*
* @param string $xpath
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*
* @see \Behat\Mink\Element\NodeElement::check
*/
public function check($xpath);
/**
* Unchecks checkbox by it's XPath query.
*
* @param string $xpath
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*
* @see \Behat\Mink\Element\NodeElement::uncheck
*/
public function uncheck($xpath);
/**
* Checks whether checkbox or radio button located by it's XPath query is checked.
*
* @param string $xpath
*
* @return Boolean
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*
* @see \Behat\Mink\Element\NodeElement::isChecked
*/
public function isChecked($xpath);
/**
* Selects option from select field or value in radio group located by it's XPath query.
*
* @param string $xpath
* @param string $value
* @param Boolean $multiple
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*
* @see \Behat\Mink\Element\NodeElement::selectOption
*/
public function selectOption($xpath, $value, $multiple = false);
/**
* Checks whether select option, located by it's XPath query, is selected.
*
* @param string $xpath
*
* @return Boolean
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*
* @see \Behat\Mink\Element\NodeElement::isSelected
*/
public function isSelected($xpath);
/**
* Clicks button or link located by it's XPath query.
*
* @param string $xpath
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function click($xpath);
/**
* Double-clicks button or link located by it's XPath query.
*
* @param string $xpath
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function doubleClick($xpath);
/**
* Right-clicks button or link located by it's XPath query.
*
* @param string $xpath
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function rightClick($xpath);
/**
* Attaches file path to file field located by it's XPath query.
*
* @param string $xpath
* @param string $path
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*
* @see \Behat\Mink\Element\NodeElement::attachFile
*/
public function attachFile($xpath, $path);
/**
* Checks whether element visible located by it's XPath query.
*
* @param string $xpath
*
* @return Boolean
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function isVisible($xpath);
/**
* Simulates a mouse over on the element.
*
* @param string $xpath
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function mouseOver($xpath);
/**
* Brings focus to element.
*
* @param string $xpath
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function focus($xpath);
/**
* Removes focus from element.
*
* @param string $xpath
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function blur($xpath);
/**
* Presses specific keyboard key.
*
* @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
*/
public function keyPress($xpath, $char, $modifier = null);
/**
* Pressed down specific keyboard key.
*
* @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
*/
public function keyDown($xpath, $char, $modifier = null);
/**
* Pressed up specific keyboard key.
*
* @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
*/
public function keyUp($xpath, $char, $modifier = null);
/**
* Drag one element onto another.
*
* @param string $sourceXpath
* @param string $destinationXpath
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function dragTo($sourceXpath, $destinationXpath);
/**
* Executes JS script.
*
* @param string $script
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function executeScript($script);
/**
* Evaluates JS script.
*
* The "return" keyword is optional in the script passed as argument. Driver implementations
* must accept the expression both with and without the keyword.
*
* @param string $script
*
* @return mixed
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function evaluateScript($script);
/**
* Waits some time or until JS condition turns true.
*
* @param int $timeout timeout in milliseconds
* @param string $condition JS condition
*
* @return bool
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*/
public function wait($timeout, $condition);
/**
* Set the dimensions of the 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
*/
public function resizeWindow($width, $height, $name = null);
/**
* Maximizes the window if it is not maximized already.
*
* @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
*/
public function maximizeWindow($name = null);
/**
* Submits the form.
*
* @param string $xpath Xpath.
*
* @throws UnsupportedDriverActionException When operation not supported by the driver
* @throws DriverException When the operation cannot be done
*
* @see \Behat\Mink\Element\NodeElement::submitForm
*/
public function submitForm($xpath);
}

View File

@ -1,51 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Element;
/**
* Document element.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class DocumentElement extends TraversableElement
{
/**
* Returns XPath for handled element.
*
* @return string
*/
public function getXpath()
{
return '//html';
}
/**
* Returns document content.
*
* @return string
*/
public function getContent()
{
return trim($this->getDriver()->getContent());
}
/**
* Check whether document has specified content.
*
* @param string $content
*
* @return Boolean
*/
public function hasContent($content)
{
return $this->has('named', array('content', $content));
}
}

View File

@ -1,214 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Element;
use Behat\Mink\Driver\DriverInterface;
use Behat\Mink\Exception\ElementNotFoundException;
use Behat\Mink\Selector\SelectorsHandler;
use Behat\Mink\Selector\Xpath\Manipulator;
use Behat\Mink\Session;
/**
* Base element.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
abstract class Element implements ElementInterface
{
/**
* @var Session
*/
private $session;
/**
* Driver.
*
* @var DriverInterface
*/
private $driver;
/**
* @var SelectorsHandler
*/
private $selectorsHandler;
/**
* @var Manipulator
*/
private $xpathManipulator;
/**
* Initialize element.
*
* @param Session $session
*/
public function __construct(Session $session)
{
$this->xpathManipulator = new Manipulator();
$this->session = $session;
$this->driver = $session->getDriver();
$this->selectorsHandler = $session->getSelectorsHandler();
}
/**
* Returns element session.
*
* @return Session
*
* @deprecated Accessing the session from the element is deprecated as of 1.6 and will be impossible in 2.0.
*/
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;
}
/**
* Returns element's driver.
*
* @return DriverInterface
*/
protected function getDriver()
{
return $this->driver;
}
/**
* 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;
}
/**
* {@inheritdoc}
*/
public function has($selector, $locator)
{
return null !== $this->find($selector, $locator);
}
/**
* {@inheritdoc}
*/
public function isValid()
{
return 1 === count($this->getDriver()->find($this->getXpath()));
}
/**
* {@inheritdoc}
*/
public function waitFor($timeout, $callback)
{
if (!is_callable($callback)) {
throw new \InvalidArgumentException('Given callback is not a valid callable');
}
$start = microtime(true);
$end = $start + $timeout;
do {
$result = call_user_func($callback, $this);
if ($result) {
break;
}
usleep(100000);
} while (microtime(true) < $end);
return $result;
}
/**
* {@inheritdoc}
*/
public function find($selector, $locator)
{
$items = $this->findAll($selector, $locator);
return count($items) ? current($items) : null;
}
/**
* {@inheritdoc}
*/
public function findAll($selector, $locator)
{
if ('named' === $selector) {
$items = $this->findAll('named_exact', $locator);
if (empty($items)) {
$items = $this->findAll('named_partial', $locator);
}
return $items;
}
$xpath = $this->selectorsHandler->selectorToXpath($selector, $locator);
$xpath = $this->xpathManipulator->prepend($xpath, $this->getXpath());
return $this->getDriver()->find($xpath);
}
/**
* {@inheritdoc}
*/
public function getText()
{
return $this->getDriver()->getText($this->getXpath());
}
/**
* {@inheritdoc}
*/
public function getHtml()
{
return $this->getDriver()->getHtml($this->getXpath());
}
/**
* Returns element outer html.
*
* @return string
*/
public function getOuterHtml()
{
return $this->getDriver()->getOuterHtml($this->getXpath());
}
/**
* 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)
{
@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);
}
}

View File

@ -1,115 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Element;
use Behat\Mink\Session;
/**
* Element interface.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
interface ElementInterface
{
/**
* Returns XPath for handled element.
*
* @return string
*/
public function getXpath();
/**
* Returns element's session.
*
* @return Session
*
* @deprecated Accessing the session from the element is deprecated as of 1.6 and will be impossible in 2.0.
*/
public function getSession();
/**
* Checks whether element with specified selector exists inside the current element.
*
* @param string $selector selector engine name
* @param string|array $locator selector locator
*
* @return Boolean
*
* @see ElementInterface::findAll for the supported selectors
*/
public function has($selector, $locator);
/**
* Checks if an element still exists in the DOM.
*
* @return bool
*/
public function isValid();
/**
* Waits for an element(-s) to appear and returns it.
*
* @param int|float $timeout Maximal allowed waiting time in seconds.
* @param callable $callback Callback, which result is both used as waiting condition and returned.
* Will receive reference to `this element` as first argument.
*
* @return mixed
*
* @throws \InvalidArgumentException When invalid callback given.
*/
public function waitFor($timeout, $callback);
/**
* Finds first element with specified selector inside the current element.
*
* @param string $selector selector engine name
* @param string|array $locator selector locator
*
* @return NodeElement|null
*
* @see ElementInterface::findAll for the supported selectors
*/
public function find($selector, $locator);
/**
* Finds all elements with specified selector inside the current element.
*
* Valid selector engines are named, xpath, css, named_partial and named_exact.
*
* 'named' is a pseudo selector engine which prefers an exact match but
* will return a partial match if no exact match is found.
* 'xpath' is a pseudo selector engine supported by SelectorsHandler.
*
* More selector engines can be registered in the SelectorsHandler.
*
* @param string $selector selector engine name
* @param string|array $locator selector locator
*
* @return NodeElement[]
*
* @see NamedSelector for the locators supported by the named selectors
*/
public function findAll($selector, $locator);
/**
* Returns element text (inside tag).
*
* @return string
*/
public function getText();
/**
* Returns element inner html.
*
* @return string
*/
public function getHtml();
}

View File

@ -1,350 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Element;
use Behat\Mink\Session;
use Behat\Mink\Exception\ElementNotFoundException;
/**
* Page element node.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class NodeElement extends TraversableElement
{
private $xpath;
/**
* Initializes node element.
*
* @param string $xpath element xpath
* @param Session $session session instance
*/
public function __construct($xpath, Session $session)
{
$this->xpath = $xpath;
parent::__construct($session);
}
/**
* Returns XPath for handled element.
*
* @return string
*/
public function getXpath()
{
return $this->xpath;
}
/**
* Returns parent element to the current one.
*
* @return NodeElement
*/
public function getParent()
{
return $this->find('xpath', '..');
}
/**
* Returns current node tag name.
*
* The value is always returned in lowercase to allow an easy comparison.
*
* @return string
*/
public function getTagName()
{
return strtolower($this->getDriver()->getTagName($this->getXpath()));
}
/**
* Returns the value of the form field or option element.
*
* For checkbox fields, the value is a boolean indicating whether the checkbox is checked.
* For radio buttons, the value is the value of the selected button in the radio group
* or null if no button is selected.
* For single select boxes, the value is the value of the selected option.
* For multiple select boxes, the value is an array of selected option values.
* for file inputs, the return value is undefined given that browsers don't allow accessing
* the value of file inputs for security reasons. Some drivers may allow accessing the
* path of the file set in the field, but this is not required if it cannot be implemented.
* For textarea elements and all textual fields, the value is the content of the field.
* Form option elements, the value is the value of the option (the value attribute or the text
* content if the attribute is not set).
*
* Calling this method on other elements than form fields or option elements is not allowed.
*
* @return string|bool|array
*/
public function getValue()
{
return $this->getDriver()->getValue($this->getXpath());
}
/**
* Sets the value of the form field.
*
* Calling this method on other elements than form fields is not allowed.
*
* @param string|bool|array $value
*
* @see NodeElement::getValue for the format of the value for each type of field
*/
public function setValue($value)
{
$this->getDriver()->setValue($this->getXpath(), $value);
}
/**
* Checks whether element has attribute with specified name.
*
* @param string $name
*
* @return Boolean
*/
public function hasAttribute($name)
{
return null !== $this->getDriver()->getAttribute($this->getXpath(), $name);
}
/**
* Returns specified attribute value.
*
* @param string $name
*
* @return string|null
*/
public function getAttribute($name)
{
return $this->getDriver()->getAttribute($this->getXpath(), $name);
}
/**
* Checks whether an element has a named CSS class.
*
* @param string $className Name of the class
*
* @return bool
*/
public function hasClass($className)
{
if ($this->hasAttribute('class')) {
return in_array($className, preg_split('/\s+/', $this->getAttribute('class')));
}
return false;
}
/**
* Clicks current node.
*/
public function click()
{
$this->getDriver()->click($this->getXpath());
}
/**
* Presses current button.
*/
public function press()
{
$this->click();
}
/**
* Double-clicks current node.
*/
public function doubleClick()
{
$this->getDriver()->doubleClick($this->getXpath());
}
/**
* Right-clicks current node.
*/
public function rightClick()
{
$this->getDriver()->rightClick($this->getXpath());
}
/**
* Checks current node if it's a checkbox field.
*/
public function check()
{
$this->getDriver()->check($this->getXpath());
}
/**
* Unchecks current node if it's a checkbox field.
*/
public function uncheck()
{
$this->getDriver()->uncheck($this->getXpath());
}
/**
* Checks whether current node is checked if it's a checkbox or radio field.
*
* Calling this method on any other elements is not allowed.
*
* @return Boolean
*/
public function isChecked()
{
return (Boolean) $this->getDriver()->isChecked($this->getXpath());
}
/**
* 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.
* If the current node is a radio button, this selects the radio button with the given
* value in the radio button group of the current node.
*
* Calling this method on any other elements is not allowed.
*
* @param string $option
* @param Boolean $multiple whether the option should be added to the selection for multiple selects
*
* @throws ElementNotFoundException when the option is not found in the select box
*/
public function selectOption($option, $multiple = false)
{
if ('select' !== $this->getTagName()) {
$this->getDriver()->selectOption($this->getXpath(), $option, $multiple);
return;
}
$opt = $this->find('named', array('option', $option));
if (null === $opt) {
throw new ElementNotFoundException($this->getDriver(), 'select option', 'value|text', $option);
}
$this->getDriver()->selectOption($this->getXpath(), $opt->getValue(), $multiple);
}
/**
* Checks whether current node is selected if it's a option field.
*
* Calling this method on any other elements is not allowed.
*
* @return Boolean
*/
public function isSelected()
{
return (Boolean) $this->getDriver()->isSelected($this->getXpath());
}
/**
* Attach file to current node if it's a file input.
*
* Calling this method on any other elements than file input is not allowed.
*
* @param string $path path to file (local)
*/
public function attachFile($path)
{
$this->getDriver()->attachFile($this->getXpath(), $path);
}
/**
* Checks whether current node is visible on page.
*
* @return Boolean
*/
public function isVisible()
{
return (Boolean) $this->getDriver()->isVisible($this->getXpath());
}
/**
* Simulates a mouse over on the element.
*/
public function mouseOver()
{
$this->getDriver()->mouseOver($this->getXpath());
}
/**
* Drags current node onto other node.
*
* @param ElementInterface $destination other node
*/
public function dragTo(ElementInterface $destination)
{
$this->getDriver()->dragTo($this->getXpath(), $destination->getXpath());
}
/**
* Brings focus to element.
*/
public function focus()
{
$this->getDriver()->focus($this->getXpath());
}
/**
* Removes focus from element.
*/
public function blur()
{
$this->getDriver()->blur($this->getXpath());
}
/**
* Presses specific keyboard key.
*
* @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)
{
$this->getDriver()->keyPress($this->getXpath(), $char, $modifier);
}
/**
* Pressed down specific keyboard key.
*
* @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)
{
$this->getDriver()->keyDown($this->getXpath(), $char, $modifier);
}
/**
* Pressed up specific keyboard key.
*
* @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)
{
$this->getDriver()->keyUp($this->getXpath(), $char, $modifier);
}
/**
* Submits the form.
*
* Calling this method on anything else than form elements is not allowed.
*/
public function submit()
{
$this->getDriver()->submitForm($this->getXpath());
}
}

View File

@ -1,297 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Element;
use Behat\Mink\Exception\ElementNotFoundException;
/**
* Traversable element.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
abstract class TraversableElement extends Element
{
/**
* Finds element by its id.
*
* @param string $id element id
*
* @return NodeElement|null
*/
public function findById($id)
{
return $this->find('named', array('id', $id));
}
/**
* Checks whether element has a link with specified locator.
*
* @param string $locator link id, title, text or image alt
*
* @return Boolean
*/
public function hasLink($locator)
{
return null !== $this->findLink($locator);
}
/**
* Finds link with specified locator.
*
* @param string $locator link id, title, text or image alt
*
* @return NodeElement|null
*/
public function findLink($locator)
{
return $this->find('named', array('link', $locator));
}
/**
* Clicks link with specified locator.
*
* @param string $locator link id, title, text or image alt
*
* @throws ElementNotFoundException
*/
public function clickLink($locator)
{
$link = $this->findLink($locator);
if (null === $link) {
throw new ElementNotFoundException($this->getDriver(), 'link', 'id|title|alt|text', $locator);
}
$link->click();
}
/**
* Checks whether element has a button (input[type=submit|image|button|reset], button) with specified locator.
*
* @param string $locator button id, value or alt
*
* @return Boolean
*/
public function hasButton($locator)
{
return null !== $this->findButton($locator);
}
/**
* Finds button (input[type=submit|image|button|reset], button) with specified locator.
*
* @param string $locator button id, value or alt
*
* @return NodeElement|null
*/
public function findButton($locator)
{
return $this->find('named', array('button', $locator));
}
/**
* Presses button (input[type=submit|image|button|reset], button) with specified locator.
*
* @param string $locator button id, value or alt
*
* @throws ElementNotFoundException
*/
public function pressButton($locator)
{
$button = $this->findButton($locator);
if (null === $button) {
throw new ElementNotFoundException($this->getDriver(), 'button', 'id|name|title|alt|value', $locator);
}
$button->press();
}
/**
* Checks whether element has a field (input, textarea, select) with specified locator.
*
* @param string $locator input id, name or label
*
* @return Boolean
*/
public function hasField($locator)
{
return null !== $this->findField($locator);
}
/**
* Finds field (input, textarea, select) with specified locator.
*
* @param string $locator input id, name or label
*
* @return NodeElement|null
*/
public function findField($locator)
{
return $this->find('named', array('field', $locator));
}
/**
* Fills in field (input, textarea, select) with specified locator.
*
* @param string $locator input id, name or label
* @param string $value value
*
* @throws ElementNotFoundException
*
* @see NodeElement::setValue
*/
public function fillField($locator, $value)
{
$field = $this->findField($locator);
if (null === $field) {
throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value|placeholder', $locator);
}
$field->setValue($value);
}
/**
* Checks whether element has a checkbox with specified locator, which is checked.
*
* @param string $locator input id, name or label
*
* @return Boolean
*
* @see NodeElement::isChecked
*/
public function hasCheckedField($locator)
{
$field = $this->findField($locator);
return null !== $field && $field->isChecked();
}
/**
* Checks whether element has a checkbox with specified locator, which is unchecked.
*
* @param string $locator input id, name or label
*
* @return Boolean
*
* @see NodeElement::isChecked
*/
public function hasUncheckedField($locator)
{
$field = $this->findField($locator);
return null !== $field && !$field->isChecked();
}
/**
* Checks checkbox with specified locator.
*
* @param string $locator input id, name or label
*
* @throws ElementNotFoundException
*/
public function checkField($locator)
{
$field = $this->findField($locator);
if (null === $field) {
throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator);
}
$field->check();
}
/**
* Unchecks checkbox with specified locator.
*
* @param string $locator input id, name or label
*
* @throws ElementNotFoundException
*/
public function uncheckField($locator)
{
$field = $this->findField($locator);
if (null === $field) {
throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator);
}
$field->uncheck();
}
/**
* Checks whether element has a select field with specified locator.
*
* @param string $locator select id, name or label
*
* @return Boolean
*/
public function hasSelect($locator)
{
return $this->has('named', array('select', $locator));
}
/**
* Selects option from select field with specified locator.
*
* @param string $locator input id, name or label
* @param string $value option value
* @param Boolean $multiple select multiple options
*
* @throws ElementNotFoundException
*
* @see NodeElement::selectOption
*/
public function selectFieldOption($locator, $value, $multiple = false)
{
$field = $this->findField($locator);
if (null === $field) {
throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator);
}
$field->selectOption($value, $multiple);
}
/**
* Checks whether element has a table with specified locator.
*
* @param string $locator table id or caption
*
* @return Boolean
*/
public function hasTable($locator)
{
return $this->has('named', array('table', $locator));
}
/**
* Attach file to file field with specified locator.
*
* @param string $locator input id, name or label
* @param string $path path to file
*
* @throws ElementNotFoundException
*
* @see NodeElement::attachFile
*/
public function attachFileToField($locator, $path)
{
$field = $this->findField($locator);
if (null === $field) {
throw new ElementNotFoundException($this->getDriver(), 'form field', 'id|name|label|value', $locator);
}
$field->attachFile($path);
}
}

View File

@ -1,31 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Exception;
/**
* Exception thrown by drivers when they fail to perform an action.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class DriverException extends Exception
{
/**
* Initializes exception.
*
* @param string $message
* @param int $code
* @param \Exception|null $previous
*/
public function __construct($message, $code = 0, \Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}

View File

@ -1,60 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
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.
*
* @deprecated This exception class is not used anymore in Mink 1.6 and will be removed in 2.0
*
* @author Chris Worfolk <xmeltrut@gmail.com>
*/
class ElementException extends Exception
{
private $element;
/**
* Initialises exception.
*
* @param Element $element optional message
* @param \Exception $exception exception
*/
public function __construct(Element $element, \Exception $exception)
{
$this->element = $element;
parent::__construct(sprintf("Exception thrown by %s\n%s", $element->getXpath(), $exception->getMessage()));
}
/**
* Override default toString so we don't send a full backtrace in verbose mode.
*
* @return string
*/
public function __toString()
{
return $this->getMessage();
}
/**
* Get the element that caused the exception.
*
* @return Element
*/
public function getElement()
{
return $this->element;
}
}

View File

@ -1,50 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Exception;
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.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class ElementHtmlException extends ExpectationException
{
/**
* Element instance.
*
* @var Element
*/
protected $element;
/**
* Initializes 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, $driver, Element $element, \Exception $exception = null)
{
$this->element = $element;
parent::__construct($message, $driver, $exception);
}
protected function getContext()
{
return $this->element->getOuterHtml();
}
}

View File

@ -1,54 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Exception;
use Behat\Mink\Driver\DriverInterface;
use Behat\Mink\Session;
/**
* Exception thrown when an expected element is not found.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class ElementNotFoundException extends ExpectationException
{
/**
* Initializes exception.
*
* @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($driver, $type = null, $selector = null, $locator = null)
{
$message = '';
if (null !== $type) {
$message .= ucfirst($type);
} else {
$message .= 'Tag';
}
if (null !== $locator) {
if (null === $selector || in_array($selector, array('css', 'xpath'))) {
$selector = 'matching '.($selector ?: 'locator');
} else {
$selector = 'with '.$selector;
}
$message .= ' '.$selector.' "'.$locator.'"';
}
$message .= ' not found.';
parent::__construct($message, $driver);
}
}

View File

@ -1,24 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Exception;
/**
* Exception thrown when an expectation on the text of an element fails.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class ElementTextException extends ElementHtmlException
{
protected function getContext()
{
return $this->element->getText();
}
}

View File

@ -1,20 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Exception;
/**
* Mink base exception class.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
abstract class Exception extends \Exception
{
}

View File

@ -1,175 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Exception;
use Behat\Mink\Driver\DriverInterface;
use Behat\Mink\Session;
/**
* Exception thrown for failed expectations.
*
* Some specialized child classes are available to customize the error rendering.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class ExpectationException extends Exception
{
private $session;
private $driver;
/**
* Initializes 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, $driver, \Exception $exception = null)
{
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();
}
parent::__construct($message, 0, $exception);
}
/**
* Returns exception message with additional context info.
*
* @return string
*/
public function __toString()
{
try {
$pageText = $this->pipeString($this->trimString($this->getContext())."\n");
$string = sprintf("%s\n\n%s%s", $this->getMessage(), $this->getResponseInfo(), $pageText);
} catch (\Exception $e) {
return $this->getMessage();
}
return $string;
}
/**
* Gets the context rendered for this exception.
*
* @return string
*/
protected function getContext()
{
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;
}
/**
* Prepends every line in a string with pipe (|).
*
* @param string $string
*
* @return string
*/
protected function pipeString($string)
{
return '| '.strtr($string, array("\n" => "\n| "));
}
/**
* Removes response header/footer, letting only <body /> content.
*
* @param string $string response content
*
* @return string
*/
protected function trimBody($string)
{
$string = preg_replace(array('/^.*<body>/s', '/<\/body>.*$/s'), array('<body>', '</body>'), $string);
return $string;
}
/**
* Trims string to specified number of chars.
*
* @param string $string response content
* @param int $count trim count
*
* @return string
*/
protected function trimString($string, $count = 1000)
{
$string = trim($string);
if ($count < mb_strlen($string)) {
return mb_substr($string, 0, $count - 3).'...';
}
return $string;
}
/**
* Returns response information string.
*
* @return string
*/
protected function getResponseInfo()
{
$driver = basename(str_replace('\\', '/', get_class($this->driver)));
$info = '+--[ ';
try {
$info .= 'HTTP/1.1 '.$this->driver->getStatusCode().' | ';
} catch (UnsupportedDriverActionException $e) {
// Ignore the status code when not supported
}
$info .= $this->driver->getCurrentUrl().' | '.$driver." ]\n|\n";
return $info;
}
}

View File

@ -1,24 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Exception;
/**
* Exception thrown when an expectation on the response text fails.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class ResponseTextException extends ExpectationException
{
protected function getContext()
{
return $this->getDriver()->getText('//html');
}
}

View File

@ -1,35 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Exception;
use Behat\Mink\Driver\DriverInterface;
/**
* Exception thrown by drivers when they don't support the requested action.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class UnsupportedDriverActionException extends DriverException
{
/**
* Initializes exception.
*
* @param string $template what is unsupported?
* @param DriverInterface $driver driver instance
* @param \Exception $previous previous exception
*/
public function __construct($template, DriverInterface $driver, \Exception $previous = null)
{
$message = sprintf($template, get_class($driver));
parent::__construct($message, 0, $previous);
}
}

View File

@ -1,216 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink;
/**
* Mink sessions manager.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class Mink
{
private $defaultSessionName;
/**
* Sessions.
*
* @var Session[]
*/
private $sessions = array();
/**
* Initializes manager.
*
* @param Session[] $sessions
*/
public function __construct(array $sessions = array())
{
foreach ($sessions as $name => $session) {
$this->registerSession($name, $session);
}
}
/**
* Stops all started sessions.
*/
public function __destruct()
{
$this->stopSessions();
}
/**
* Registers new session.
*
* @param string $name
* @param Session $session
*/
public function registerSession($name, Session $session)
{
$name = strtolower($name);
$this->sessions[$name] = $session;
}
/**
* Checks whether session with specified name is registered.
*
* @param string $name
*
* @return Boolean
*/
public function hasSession($name)
{
return isset($this->sessions[strtolower($name)]);
}
/**
* Sets default session name to use.
*
* @param string $name name of the registered session
*
* @throws \InvalidArgumentException
*/
public function setDefaultSessionName($name)
{
$name = strtolower($name);
if (!isset($this->sessions[$name])) {
throw new \InvalidArgumentException(sprintf('Session "%s" is not registered.', $name));
}
$this->defaultSessionName = $name;
}
/**
* Returns default session name or null if none.
*
* @return null|string
*/
public function getDefaultSessionName()
{
return $this->defaultSessionName;
}
/**
* Returns registered session by it's name or active one and automatically starts it if required.
*
* @param string $name session name
*
* @return Session
*
* @throws \InvalidArgumentException If the named session is not registered
*/
public function getSession($name = null)
{
$session = $this->locateSession($name);
// start session if needed
if (!$session->isStarted()) {
$session->start();
}
return $session;
}
/**
* 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
*
* @return bool whether the session has been started
*
* @throws \InvalidArgumentException If the named session is not registered
*/
public function isSessionStarted($name = null)
{
$session = $this->locateSession($name);
return $session->isStarted();
}
/**
* Returns session asserter.
*
* @param Session|string $session session object or name
*
* @return WebAssert
*/
public function assertSession($session = null)
{
if (!($session instanceof Session)) {
$session = $this->getSession($session);
}
return new WebAssert($session);
}
/**
* Resets all started sessions.
*/
public function resetSessions()
{
foreach ($this->sessions as $session) {
if ($session->isStarted()) {
$session->reset();
}
}
}
/**
* Restarts all started sessions.
*/
public function restartSessions()
{
foreach ($this->sessions as $session) {
if ($session->isStarted()) {
$session->restart();
}
}
}
/**
* Stops all started sessions.
*/
public function stopSessions()
{
foreach ($this->sessions as $session) {
if ($session->isStarted()) {
$session->stop();
}
}
}
/**
* Returns the named or default session without starting it.
*
* @param string $name session name
*
* @return Session
*
* @throws \InvalidArgumentException If the named session is not registered
*/
protected function locateSession($name = null)
{
$name = strtolower($name) ?: $this->defaultSessionName;
if (null === $name) {
throw new \InvalidArgumentException('Specify session name to get');
}
if (!isset($this->sessions[$name])) {
throw new \InvalidArgumentException(sprintf('Session "%s" is not registered.', $name));
}
$session = $this->sessions[$name];
return $session;
}
}

View File

@ -1,37 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Selector;
use Symfony\Component\CssSelector\CssSelector as CSS;
/**
* CSS selector engine. Transforms CSS to XPath.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class CssSelector implements SelectorInterface
{
/**
* Translates CSS into XPath.
*
* @param string|array $locator current selector locator
*
* @return string
*/
public function translateToXPath($locator)
{
if (!is_string($locator)) {
throw new \InvalidArgumentException('The CssSelector expects to get a string as locator');
}
return CSS::toXPath($locator);
}
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Selector;
/**
* Exact match selector engine. Like the Named selector engine but ignores partial matches.
*/
class ExactNamedSelector extends NamedSelector
{
public function __construct()
{
$this->registerReplacement('%tagTextMatch%', 'normalize-space(string(.)) = %locator%');
$this->registerReplacement('%valueMatch%', './@value = %locator%');
$this->registerReplacement('%titleMatch%', './@title = %locator%');
$this->registerReplacement('%altMatch%', './@alt = %locator%');
$this->registerReplacement('%relMatch%', './@rel = %locator%');
$this->registerReplacement('%labelAttributeMatch%', './@label = %locator%');
parent::__construct();
}
}

View File

@ -1,263 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Selector;
use Behat\Mink\Selector\Xpath\Escaper;
/**
* Named selectors engine. Uses registered XPath selectors to create new expressions.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class NamedSelector implements SelectorInterface
{
private $replacements = array(
// simple replacements
'%lowercaseType%' => "translate(./@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')",
'%lowercaseRole%' => "translate(./@role, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')",
'%tagTextMatch%' => 'contains(normalize-space(string(.)), %locator%)',
'%labelTextMatch%' => './@id = //label[%tagTextMatch%]/@for',
'%idMatch%' => './@id = %locator%',
'%valueMatch%' => 'contains(./@value, %locator%)',
'%idOrValueMatch%' => '(%idMatch% or %valueMatch%)',
'%idOrNameMatch%' => '(%idMatch% or ./@name = %locator%)',
'%placeholderMatch%' => './@placeholder = %locator%',
'%titleMatch%' => 'contains(./@title, %locator%)',
'%altMatch%' => 'contains(./@alt, %locator%)',
'%relMatch%' => 'contains(./@rel, %locator%)',
'%labelAttributeMatch%' => 'contains(./@label, %locator%)',
// complex replacements
'%inputTypeWithoutPlaceholderFilter%' => "%lowercaseType% = 'radio' or %lowercaseType% = 'checkbox' or %lowercaseType% = 'file'",
'%fieldFilterWithPlaceholder%' => 'self::input[not(%inputTypeWithoutPlaceholderFilter%)] | self::textarea',
'%fieldMatchWithPlaceholder%' => '(%idOrNameMatch% or %labelTextMatch% or %placeholderMatch%)',
'%fieldMatchWithoutPlaceholder%' => '(%idOrNameMatch% or %labelTextMatch%)',
'%fieldFilterWithoutPlaceholder%' => 'self::input[%inputTypeWithoutPlaceholderFilter%] | self::select',
'%buttonTypeFilter%' => "%lowercaseType% = 'submit' or %lowercaseType% = 'image' or %lowercaseType% = 'button' or %lowercaseType% = 'reset'",
'%notFieldTypeFilter%' => "not(%buttonTypeFilter% or %lowercaseType% = 'hidden')",
'%buttonMatch%' => '%idOrNameMatch% or %valueMatch% or %titleMatch%',
'%linkMatch%' => '(%idMatch% or %tagTextMatch% or %titleMatch% or %relMatch%)',
'%imgAltMatch%' => './/img[%altMatch%]',
);
private $selectors = array(
'fieldset' => <<<XPATH
.//fieldset
[(%idMatch% or .//legend[%tagTextMatch%])]
XPATH
,'field' => <<<XPATH
.//*
[%fieldFilterWithPlaceholder%][%notFieldTypeFilter%][%fieldMatchWithPlaceholder%]
|
.//label[%tagTextMatch%]//.//*[%fieldFilterWithPlaceholder%][%notFieldTypeFilter%]
|
.//*
[%fieldFilterWithoutPlaceholder%][%notFieldTypeFilter%][%fieldMatchWithoutPlaceholder%]
|
.//label[%tagTextMatch%]//.//*[%fieldFilterWithoutPlaceholder%][%notFieldTypeFilter%]
XPATH
,'link' => <<<XPATH
.//a
[./@href][(%linkMatch% or %imgAltMatch%)]
|
.//*
[%lowercaseRole% = 'link'][(%idOrValueMatch% or %titleMatch% or %tagTextMatch%)]
XPATH
,'button' => <<<XPATH
.//input
[%buttonTypeFilter%][(%buttonMatch%)]
|
.//input
[%lowercaseType% = 'image'][%altMatch%]
|
.//button
[(%buttonMatch% or %tagTextMatch%)]
|
.//*
[%lowercaseRole% = 'button'][(%buttonMatch% or %tagTextMatch%)]
XPATH
,'link_or_button' => <<<XPATH
.//a
[./@href][(%linkMatch% or %imgAltMatch%)]
|
.//input
[%buttonTypeFilter%][(%idOrValueMatch% or %titleMatch%)]
|
.//input
[%lowercaseType% = 'image'][%altMatch%]
|
.//button
[(%idOrValueMatch% or %titleMatch% or %tagTextMatch%)]
|
.//*
[(%lowercaseRole% = 'button' or %lowercaseRole% = 'link')][(%idOrValueMatch% or %titleMatch% or %tagTextMatch%)]
XPATH
,'content' => <<<XPATH
./descendant-or-self::*
[%tagTextMatch%]
XPATH
,'select' => <<<XPATH
.//select
[%fieldMatchWithoutPlaceholder%]
|
.//label[%tagTextMatch%]//.//select
XPATH
,'checkbox' => <<<XPATH
.//input
[%lowercaseType% = 'checkbox'][%fieldMatchWithoutPlaceholder%]
|
.//label[%tagTextMatch%]//.//input[%lowercaseType% = 'checkbox']
XPATH
,'radio' => <<<XPATH
.//input
[%lowercaseType% = 'radio'][%fieldMatchWithoutPlaceholder%]
|
.//label[%tagTextMatch%]//.//input[%lowercaseType% = 'radio']
XPATH
,'file' => <<<XPATH
.//input
[%lowercaseType% = 'file'][%fieldMatchWithoutPlaceholder%]
|
.//label[%tagTextMatch%]//.//input[%lowercaseType% = 'file']
XPATH
,'optgroup' => <<<XPATH
.//optgroup
[%labelAttributeMatch%]
XPATH
,'option' => <<<XPATH
.//option
[(./@value = %locator% or %tagTextMatch%)]
XPATH
,'table' => <<<XPATH
.//table
[(%idMatch% or .//caption[%tagTextMatch%])]
XPATH
,'id' => <<<XPATH
.//*[%idMatch%]
XPATH
,'id_or_name' => <<<XPATH
.//*[%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);
}
foreach ($this->selectors as $alias => $selector) {
$this->selectors[$alias] = strtr($selector, $this->replacements);
}
}
/**
* Registers new XPath selector with specified name.
*
* @param string $name name for selector
* @param string $xpath xpath expression
*/
public function registerNamedXpath($name, $xpath)
{
$this->selectors[$name] = $xpath;
}
/**
* Translates provided locator into XPath.
*
* @param string|array $locator selector name or array of (selector_name, locator)
*
* @return string
*
* @throws \InvalidArgumentException
*/
public function translateToXPath($locator)
{
if (2 < count($locator)) {
throw new \InvalidArgumentException('NamedSelector expects array(name, locator) as argument');
}
if (2 == count($locator)) {
$selector = $locator[0];
$locator = $locator[1];
} else {
$selector = (string) $locator;
$locator = null;
}
if (!isset($this->selectors[$selector])) {
throw new \InvalidArgumentException(sprintf(
'Unknown named selector provided: "%s". Expected one of (%s)',
$selector,
implode(', ', array_keys($this->selectors))
));
}
$xpath = $this->selectors[$selector];
if (null !== $locator) {
$xpath = strtr($xpath, array('%locator%' => $this->escapeLocator($locator)));
}
return $xpath;
}
/**
* Registers a replacement in the list of replacements.
*
* This method must be called in the constructor before calling the parent constructor.
*
* @param string $from
* @param string $to
*/
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);
}
}

View File

@ -1,31 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Selector;
/**
* Named selectors engine. Uses registered XPath selectors to create new expressions.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class PartialNamedSelector extends NamedSelector
{
public function __construct()
{
$this->registerReplacement('%tagTextMatch%', 'contains(normalize-space(string(.)), %locator%)');
$this->registerReplacement('%valueMatch%', 'contains(./@value, %locator%)');
$this->registerReplacement('%titleMatch%', 'contains(./@title, %locator%)');
$this->registerReplacement('%altMatch%', 'contains(./@alt, %locator%)');
$this->registerReplacement('%relMatch%', 'contains(./@rel, %locator%)');
$this->registerReplacement('%labelAttributeMatch%', 'contains(./@label, %locator%)');
parent::__construct();
}
}

View File

@ -1,28 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Selector;
/**
* Mink selector engine interface.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
interface SelectorInterface
{
/**
* Translates provided locator into XPath.
*
* @param string|array $locator current selector locator
*
* @return string
*/
public function translateToXPath($locator);
}

View File

@ -1,135 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Selector;
use Behat\Mink\Selector\Xpath\Escaper;
/**
* Selectors handler.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class SelectorsHandler
{
private $selectors;
private $escaper;
/**
* Initializes selectors handler.
*
* @param SelectorInterface[] $selectors default selectors to register
*/
public function __construct(array $selectors = array())
{
$this->escaper = new Escaper();
$this->registerSelector('named_partial', new PartialNamedSelector());
$this->registerSelector('named_exact', new ExactNamedSelector());
$this->registerSelector('css', new CssSelector());
foreach ($selectors as $name => $selector) {
$this->registerSelector($name, $selector);
}
}
/**
* Registers new selector engine with specified name.
*
* @param string $name selector engine name
* @param SelectorInterface $selector selector engine instance
*/
public function registerSelector($name, SelectorInterface $selector)
{
$this->selectors[$name] = $selector;
}
/**
* Checks whether selector with specified name is registered on handler.
*
* @param string $name selector engine name
*
* @return Boolean
*/
public function isSelectorRegistered($name)
{
return isset($this->selectors[$name]);
}
/**
* Returns selector engine with specified name.
*
* @param string $name selector engine name
*
* @return SelectorInterface
*
* @throws \InvalidArgumentException
*/
public function getSelector($name)
{
if ('named' === $name) {
@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
);
$name = 'named_partial';
}
if (!$this->isSelectorRegistered($name)) {
throw new \InvalidArgumentException("Selector \"$name\" is not registered.");
}
return $this->selectors[$name];
}
/**
* Translates selector with specified name to XPath.
*
* @param string $selector selector engine name (registered)
* @param string|array $locator selector locator (an array or a string depending of the selector being used)
*
* @return string
*/
public function selectorToXpath($selector, $locator)
{
if ('xpath' === $selector) {
if (!is_string($locator)) {
throw new \InvalidArgumentException('The xpath selector expects to get a string as locator');
}
return $locator;
}
return $this->getSelector($selector)->translateToXPath($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);
}
}

View File

@ -1,52 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Selector\Xpath;
/**
* XPath escaper.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class Escaper
{
/**
* Escapes the string as a XPath literal.
*
* @param string $s
*
* @return string
*/
public function escapeLiteral($s)
{
if (false === strpos($s, "'")) {
return sprintf("'%s'", $s);
}
if (false === strpos($s, '"')) {
return sprintf('"%s"', $s);
}
$string = $s;
$parts = array();
while (true) {
if (false !== $pos = strpos($string, "'")) {
$parts[] = sprintf("'%s'", substr($string, 0, $pos));
$parts[] = "\"'\"";
$string = substr($string, $pos + 1);
} else {
$parts[] = "'$string'";
break;
}
}
return sprintf('concat(%s)', implode($parts, ','));
}
}

View File

@ -1,69 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink\Selector\Xpath;
/**
* XPath manipulation utility.
*
* @author Graham Bates
* @author Christophe Coevoet <stof@notk.org>
*/
class Manipulator
{
/**
* Regex to find union operators not inside brackets.
*/
const UNION_PATTERN = '/\|(?![^\[]*\])/';
/**
* Prepends the XPath prefix to the given XPath.
*
* The returned XPath will match elements matching the XPath inside an element
* matching the prefix.
*
* @param string $xpath
* @param string $prefix
*
* @return string
*/
public function prepend($xpath, $prefix)
{
$expressions = array();
// If the xpath prefix contains a union we need to wrap it in parentheses.
if (preg_match(self::UNION_PATTERN, $prefix)) {
$prefix = '('.$prefix.')';
}
// Split any unions into individual expressions.
foreach (preg_split(self::UNION_PATTERN, $xpath) as $expression) {
$expression = trim($expression);
$parenthesis = '';
// If the union is inside some braces, we need to preserve the opening braces and apply
// the prefix only inside it.
if (preg_match('/^[\(\s*]+/', $expression, $matches)) {
$parenthesis = $matches[0];
$expression = substr($expression, strlen($parenthesis));
}
// add prefix before element selector
if (0 === strpos($expression, '/')) {
$expression = $prefix.$expression;
} else {
$expression = $prefix.'/'.$expression;
}
$expressions[] = $parenthesis.$expression;
}
return implode(' | ', $expressions);
}
}

View File

@ -1,373 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink;
use Behat\Mink\Driver\DriverInterface;
use Behat\Mink\Selector\SelectorsHandler;
use Behat\Mink\Element\DocumentElement;
/**
* Mink session.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class Session
{
private $driver;
private $page;
private $selectorsHandler;
/**
* Initializes session.
*
* @param DriverInterface $driver
* @param SelectorsHandler $selectorsHandler
*/
public function __construct(DriverInterface $driver, SelectorsHandler $selectorsHandler = null)
{
$driver->setSession($this);
if (null === $selectorsHandler) {
$selectorsHandler = new SelectorsHandler();
}
$this->driver = $driver;
$this->selectorsHandler = $selectorsHandler;
$this->page = new DocumentElement($this);
}
/**
* Checks whether session (driver) was started.
*
* @return Boolean
*/
public function isStarted()
{
return $this->driver->isStarted();
}
/**
* Starts session driver.
*
* Calling any action before visiting a page is an undefined behavior.
* The only supported method calls on a fresh driver are
* - visit()
* - setRequestHeader()
* - setBasicAuth()
* - reset()
* - stop()
*/
public function start()
{
$this->driver->start();
}
/**
* Stops session driver.
*/
public function stop()
{
$this->driver->stop();
}
/**
* Restart session driver.
*/
public function restart()
{
$this->driver->stop();
$this->driver->start();
}
/**
* Reset session driver state.
*
* Calling any action before visiting a page is an undefined behavior.
* The only supported method calls on a fresh driver are
* - visit()
* - setRequestHeader()
* - setBasicAuth()
* - reset()
* - stop()
*/
public function reset()
{
$this->driver->reset();
}
/**
* Returns session driver.
*
* @return DriverInterface
*/
public function getDriver()
{
return $this->driver;
}
/**
* Returns page element.
*
* @return DocumentElement
*/
public function getPage()
{
return $this->page;
}
/**
* Returns selectors handler.
*
* @return SelectorsHandler
*/
public function getSelectorsHandler()
{
return $this->selectorsHandler;
}
/**
* Visit specified URL.
*
* @param string $url url of the page
*/
public function visit($url)
{
$this->driver->visit($url);
}
/**
* Sets HTTP Basic authentication parameters.
*
* @param string|Boolean $user user name or false to disable authentication
* @param string $password password
*/
public function setBasicAuth($user, $password = '')
{
$this->driver->setBasicAuth($user, $password);
}
/**
* Sets specific request header.
*
* @param string $name
* @param string $value
*/
public function setRequestHeader($name, $value)
{
$this->driver->setRequestHeader($name, $value);
}
/**
* Returns all response headers.
*
* @return array
*/
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.
*
* @param string $name
* @param string $value
*/
public function setCookie($name, $value = null)
{
$this->driver->setCookie($name, $value);
}
/**
* Returns cookie by name.
*
* @param string $name
*
* @return string|null
*/
public function getCookie($name)
{
return $this->driver->getCookie($name);
}
/**
* Returns response status code.
*
* @return int
*/
public function getStatusCode()
{
return $this->driver->getStatusCode();
}
/**
* Returns current URL address.
*
* @return string
*/
public function getCurrentUrl()
{
return $this->driver->getCurrentUrl();
}
/**
* Capture a screenshot of the current window.
*
* @return string screenshot of MIME type image/* depending
* on driver (e.g., image/png, image/jpeg)
*/
public function getScreenshot()
{
return $this->driver->getScreenshot();
}
/**
* Return the names of all open windows.
*
* @return array Array of all open window's names.
*/
public function getWindowNames()
{
return $this->driver->getWindowNames();
}
/**
* Return the name of the currently active window.
*
* @return string The name of the current window.
*/
public function getWindowName()
{
return $this->driver->getWindowName();
}
/**
* Reloads current session page.
*/
public function reload()
{
$this->driver->reload();
}
/**
* Moves backward 1 page in history.
*/
public function back()
{
$this->driver->back();
}
/**
* Moves forward 1 page in history.
*/
public function forward()
{
$this->driver->forward();
}
/**
* Switches to specific browser window.
*
* @param string $name window name (null for switching back to main window)
*/
public function switchToWindow($name = null)
{
$this->driver->switchToWindow($name);
}
/**
* Switches to specific iFrame.
*
* @param string $name iframe name (null for switching back)
*/
public function switchToIFrame($name = null)
{
$this->driver->switchToIFrame($name);
}
/**
* Execute JS in browser.
*
* @param string $script javascript
*/
public function executeScript($script)
{
$this->driver->executeScript($script);
}
/**
* Execute JS in browser and return it's response.
*
* @param string $script javascript
*
* @return string
*/
public function evaluateScript($script)
{
return $this->driver->evaluateScript($script);
}
/**
* Waits some time or until JS condition turns true.
*
* @param int $time time in milliseconds
* @param string $condition JS condition
*
* @return bool
*/
public function wait($time, $condition = 'false')
{
return $this->driver->wait($time, $condition);
}
/**
* Set the dimensions of the 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)
{
$this->driver->resizeWindow($width, $height, $name);
}
/**
* Maximize the window if it is not maximized already.
*
* @param string $name window name (null for the main window)
*/
public function maximizeWindow($name = null)
{
$this->driver->maximizeWindow($name);
}
}

View File

@ -1,849 +0,0 @@
<?php
/*
* This file is part of the Mink package.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\Mink;
use Behat\Mink\Element\Element;
use Behat\Mink\Element\ElementInterface;
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Element\TraversableElement;
use Behat\Mink\Exception\ElementNotFoundException;
use Behat\Mink\Exception\ExpectationException;
use Behat\Mink\Exception\ResponseTextException;
use Behat\Mink\Exception\ElementHtmlException;
use Behat\Mink\Exception\ElementTextException;
/**
* Mink web assertions tool.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class WebAssert
{
protected $session;
/**
* Initializes assertion engine.
*
* @param Session $session
*/
public function __construct(Session $session)
{
$this->session = $session;
}
/**
* Checks that current session address is equals to provided one.
*
* @param string $page
*
* @throws ExpectationException
*/
public function addressEquals($page)
{
$expected = $this->cleanUrl($page);
$actual = $this->getCurrentUrlPath();
$this->assert($actual === $expected, sprintf('Current page is "%s", but "%s" expected.', $actual, $expected));
}
/**
* Checks that current session address is not equals to provided one.
*
* @param string $page
*
* @throws ExpectationException
*/
public function addressNotEquals($page)
{
$expected = $this->cleanUrl($page);
$actual = $this->getCurrentUrlPath();
$this->assert($actual !== $expected, sprintf('Current page is "%s", but should not be.', $actual));
}
/**
* Checks that current session address matches regex.
*
* @param string $regex
*
* @throws ExpectationException
*/
public function addressMatches($regex)
{
$actual = $this->getCurrentUrlPath();
$message = sprintf('Current page "%s" does not match the regex "%s".', $actual, $regex);
$this->assert((bool) preg_match($regex, $actual), $message);
}
/**
* Checks that specified cookie exists and its value equals to a given one.
*
* @param string $name cookie name
* @param string $value cookie value
*
* @throws ExpectationException
*/
public function cookieEquals($name, $value)
{
$this->cookieExists($name);
$actualValue = $this->session->getCookie($name);
$message = sprintf('Cookie "%s" value is "%s", but should be "%s".', $name, $actualValue, $value);
$this->assert($actualValue == $value, $message);
}
/**
* Checks that specified cookie exists.
*
* @param string $name cookie name
*
* @throws ExpectationException
*/
public function cookieExists($name)
{
$message = sprintf('Cookie "%s" is not set, but should be.', $name);
$this->assert($this->session->getCookie($name) !== null, $message);
}
/**
* Checks that current response code equals to provided one.
*
* @param int $code
*
* @throws ExpectationException
*/
public function statusCodeEquals($code)
{
$actual = $this->session->getStatusCode();
$message = sprintf('Current response status code is %d, but %d expected.', $actual, $code);
$this->assert(intval($code) === intval($actual), $message);
}
/**
* Checks that current response code not equals to provided one.
*
* @param int $code
*
* @throws ExpectationException
*/
public function statusCodeNotEquals($code)
{
$actual = $this->session->getStatusCode();
$message = sprintf('Current response status code is %d, but should not be.', $actual);
$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.
*
* @param string $text
*
* @throws ResponseTextException
*/
public function pageTextContains($text)
{
$actual = $this->session->getPage()->getText();
$actual = preg_replace('/\s+/u', ' ', $actual);
$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);
}
/**
* Checks that current page does not contains text.
*
* @param string $text
*
* @throws ResponseTextException
*/
public function pageTextNotContains($text)
{
$actual = $this->session->getPage()->getText();
$actual = preg_replace('/\s+/u', ' ', $actual);
$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);
}
/**
* Checks that current page text matches regex.
*
* @param string $regex
*
* @throws ResponseTextException
*/
public function pageTextMatches($regex)
{
$actual = $this->session->getPage()->getText();
$message = sprintf('The pattern %s was not found anywhere in the text of the current page.', $regex);
$this->assertResponseText((bool) preg_match($regex, $actual), $message);
}
/**
* Checks that current page text does not matches regex.
*
* @param string $regex
*
* @throws ResponseTextException
*/
public function pageTextNotMatches($regex)
{
$actual = $this->session->getPage()->getText();
$message = sprintf('The pattern %s was found in the text of the current page, but it should not.', $regex);
$this->assertResponseText(!preg_match($regex, $actual), $message);
}
/**
* Checks that page HTML (response content) contains text.
*
* @param string $text
*
* @throws ExpectationException
*/
public function responseContains($text)
{
$actual = $this->session->getPage()->getContent();
$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);
}
/**
* Checks that page HTML (response content) does not contains text.
*
* @param string $text
*
* @throws ExpectationException
*/
public function responseNotContains($text)
{
$actual = $this->session->getPage()->getContent();
$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);
}
/**
* Checks that page HTML (response content) matches regex.
*
* @param string $regex
*
* @throws ExpectationException
*/
public function responseMatches($regex)
{
$actual = $this->session->getPage()->getContent();
$message = sprintf('The pattern %s was not found anywhere in the HTML response of the page.', $regex);
$this->assert((bool) preg_match($regex, $actual), $message);
}
/**
* Checks that page HTML (response content) does not matches regex.
*
* @param $regex
*
* @throws ExpectationException
*/
public function responseNotMatches($regex)
{
$actual = $this->session->getPage()->getContent();
$message = sprintf('The pattern %s was found in the HTML response of the page, but it should not.', $regex);
$this->assert(!preg_match($regex, $actual), $message);
}
/**
* Checks that there is specified number of specific elements on the page.
*
* @param string $selectorType element selector type (css, xpath)
* @param string|array $selector element selector
* @param int $count expected count
* @param ElementInterface $container document to check against
*
* @throws ExpectationException
*/
public function elementsCount($selectorType, $selector, $count, ElementInterface $container = null)
{
$container = $container ?: $this->session->getPage();
$nodes = $container->findAll($selectorType, $selector);
$message = sprintf(
'%d %s found on the page, but should be %d.',
count($nodes),
$this->getMatchingElementRepresentation($selectorType, $selector, count($nodes) !== 1),
$count
);
$this->assert(intval($count) === count($nodes), $message);
}
/**
* Checks that specific element exists on the current page.
*
* @param string $selectorType element selector type (css, xpath)
* @param string|array $selector element selector
* @param ElementInterface $container document to check against
*
* @return NodeElement
*
* @throws ElementNotFoundException
*/
public function elementExists($selectorType, $selector, ElementInterface $container = null)
{
$container = $container ?: $this->session->getPage();
$node = $container->find($selectorType, $selector);
if (null === $node) {
if (is_array($selector)) {
$selector = implode(' ', $selector);
}
throw new ElementNotFoundException($this->session->getDriver(), 'element', $selectorType, $selector);
}
return $node;
}
/**
* Checks that specific element does not exists on the current page.
*
* @param string $selectorType element selector type (css, xpath)
* @param string|array $selector element selector
* @param ElementInterface $container document to check against
*
* @throws ExpectationException
*/
public function elementNotExists($selectorType, $selector, ElementInterface $container = null)
{
$container = $container ?: $this->session->getPage();
$node = $container->find($selectorType, $selector);
$message = sprintf(
'An %s appears on this page, but it should not.',
$this->getMatchingElementRepresentation($selectorType, $selector)
);
$this->assert(null === $node, $message);
}
/**
* Checks that specific element contains text.
*
* @param string $selectorType element selector type (css, xpath)
* @param string|array $selector element selector
* @param string $text expected text
*
* @throws ElementTextException
*/
public function elementTextContains($selectorType, $selector, $text)
{
$element = $this->elementExists($selectorType, $selector);
$actual = $element->getText();
$regex = '/'.preg_quote($text, '/').'/ui';
$message = sprintf(
'The text "%s" was not found in the text of the %s.',
$text,
$this->getMatchingElementRepresentation($selectorType, $selector)
);
$this->assertElementText((bool) preg_match($regex, $actual), $message, $element);
}
/**
* Checks that specific element does not contains text.
*
* @param string $selectorType element selector type (css, xpath)
* @param string|array $selector element selector
* @param string $text expected text
*
* @throws ElementTextException
*/
public function elementTextNotContains($selectorType, $selector, $text)
{
$element = $this->elementExists($selectorType, $selector);
$actual = $element->getText();
$regex = '/'.preg_quote($text, '/').'/ui';
$message = sprintf(
'The text "%s" appears in the text of the %s, but it should not.',
$text,
$this->getMatchingElementRepresentation($selectorType, $selector)
);
$this->assertElementText(!preg_match($regex, $actual), $message, $element);
}
/**
* Checks that specific element contains HTML.
*
* @param string $selectorType element selector type (css, xpath)
* @param string|array $selector element selector
* @param string $html expected text
*
* @throws ElementHtmlException
*/
public function elementContains($selectorType, $selector, $html)
{
$element = $this->elementExists($selectorType, $selector);
$actual = $element->getHtml();
$regex = '/'.preg_quote($html, '/').'/ui';
$message = sprintf(
'The string "%s" was not found in the HTML of the %s.',
$html,
$this->getMatchingElementRepresentation($selectorType, $selector)
);
$this->assertElement((bool) preg_match($regex, $actual), $message, $element);
}
/**
* Checks that specific element does not contains HTML.
*
* @param string $selectorType element selector type (css, xpath)
* @param string|array $selector element selector
* @param string $html expected text
*
* @throws ElementHtmlException
*/
public function elementNotContains($selectorType, $selector, $html)
{
$element = $this->elementExists($selectorType, $selector);
$actual = $element->getHtml();
$regex = '/'.preg_quote($html, '/').'/ui';
$message = sprintf(
'The string "%s" appears in the HTML of the %s, but it should not.',
$html,
$this->getMatchingElementRepresentation($selectorType, $selector)
);
$this->assertElement(!preg_match($regex, $actual), $message, $element);
}
/**
* Checks that an attribute exists in an element.
*
* @param string $selectorType
* @param string|array $selector
* @param string $attribute
*
* @return NodeElement
*
* @throws ElementHtmlException
*/
public function elementAttributeExists($selectorType, $selector, $attribute)
{
$element = $this->elementExists($selectorType, $selector);
$message = sprintf(
'The attribute "%s" was not found in the %s.',
$attribute,
$this->getMatchingElementRepresentation($selectorType, $selector)
);
$this->assertElement($element->hasAttribute($attribute), $message, $element);
return $element;
}
/**
* Checks that an attribute of a specific elements contains text.
*
* @param string $selectorType
* @param string|array $selector
* @param string $attribute
* @param string $text
*
* @throws ElementHtmlException
*/
public function elementAttributeContains($selectorType, $selector, $attribute, $text)
{
$element = $this->elementAttributeExists($selectorType, $selector, $attribute);
$actual = $element->getAttribute($attribute);
$regex = '/'.preg_quote($text, '/').'/ui';
$message = sprintf(
'The text "%s" was not found in the attribute "%s" of the %s.',
$text,
$attribute,
$this->getMatchingElementRepresentation($selectorType, $selector)
);
$this->assertElement((bool) preg_match($regex, $actual), $message, $element);
}
/**
* Checks that an attribute of a specific elements does not contain text.
*
* @param string $selectorType
* @param string|array $selector
* @param string $attribute
* @param string $text
*
* @throws ElementHtmlException
*/
public function elementAttributeNotContains($selectorType, $selector, $attribute, $text)
{
$element = $this->elementAttributeExists($selectorType, $selector, $attribute);
$actual = $element->getAttribute($attribute);
$regex = '/'.preg_quote($text, '/').'/ui';
$message = sprintf(
'The text "%s" was found in the attribute "%s" of the %s.',
$text,
$attribute,
$this->getMatchingElementRepresentation($selectorType, $selector)
);
$this->assertElement(!preg_match($regex, $actual), $message, $element);
}
/**
* Checks that specific field exists on the current page.
*
* @param string $field field id|name|label|value
* @param TraversableElement $container document to check against
*
* @return NodeElement
*
* @throws ElementNotFoundException
*/
public function fieldExists($field, TraversableElement $container = null)
{
$container = $container ?: $this->session->getPage();
$node = $container->findField($field);
if (null === $node) {
throw new ElementNotFoundException($this->session->getDriver(), 'form field', 'id|name|label|value', $field);
}
return $node;
}
/**
* Checks that specific field does not exists on the current page.
*
* @param string $field field id|name|label|value
* @param TraversableElement $container document to check against
*
* @throws ExpectationException
*/
public function fieldNotExists($field, TraversableElement $container = null)
{
$container = $container ?: $this->session->getPage();
$node = $container->findField($field);
$this->assert(null === $node, sprintf('A field "%s" appears on this page, but it should not.', $field));
}
/**
* Checks that specific field have provided value.
*
* @param string $field field id|name|label|value
* @param string $value field value
* @param TraversableElement $container document to check against
*
* @throws ExpectationException
*/
public function fieldValueEquals($field, $value, TraversableElement $container = null)
{
$node = $this->fieldExists($field, $container);
$actual = $node->getValue();
$regex = '/^'.preg_quote($value, '/').'$/ui';
$message = sprintf('The field "%s" value is "%s", but "%s" expected.', $field, $actual, $value);
$this->assert((bool) preg_match($regex, $actual), $message);
}
/**
* Checks that specific field have provided value.
*
* @param string $field field id|name|label|value
* @param string $value field value
* @param TraversableElement $container document to check against
*
* @throws ExpectationException
*/
public function fieldValueNotEquals($field, $value, TraversableElement $container = null)
{
$node = $this->fieldExists($field, $container);
$actual = $node->getValue();
$regex = '/^'.preg_quote($value, '/').'$/ui';
$message = sprintf('The field "%s" value is "%s", but it should not be.', $field, $actual);
$this->assert(!preg_match($regex, $actual), $message);
}
/**
* Checks that specific checkbox is checked.
*
* @param string $field field id|name|label|value
* @param TraversableElement $container document to check against
*
* @throws ExpectationException
*/
public function checkboxChecked($field, TraversableElement $container = null)
{
$node = $this->fieldExists($field, $container);
$this->assert($node->isChecked(), sprintf('Checkbox "%s" is not checked, but it should be.', $field));
}
/**
* Checks that specific checkbox is unchecked.
*
* @param string $field field id|name|label|value
* @param TraversableElement $container document to check against
*
* @throws ExpectationException
*/
public function checkboxNotChecked($field, TraversableElement $container = null)
{
$node = $this->fieldExists($field, $container);
$this->assert(!$node->isChecked(), sprintf('Checkbox "%s" is checked, but it should not be.', $field));
}
/**
* Gets current url of the page.
*
* @return string
*/
protected function getCurrentUrlPath()
{
return $this->cleanUrl($this->session->getCurrentUrl());
}
/**
* Trims scriptname from the URL.
*
* @param string $url
*
* @return string
*/
protected function cleanUrl($url)
{
$parts = parse_url($url);
$fragment = empty($parts['fragment']) ? '' : '#'.$parts['fragment'];
$path = empty($parts['path']) ? '/' : $parts['path'];
return preg_replace('/^\/[^\.\/]+\.php\//', '/', $path).$fragment;
}
/**
* Asserts a condition.
*
* @param bool $condition
* @param string $message Failure message
*
* @throws ExpectationException when the condition is not fulfilled
*/
private function assert($condition, $message)
{
if ($condition) {
return;
}
throw new ExpectationException($message, $this->session->getDriver());
}
/**
* Asserts a condition involving the response text.
*
* @param bool $condition
* @param string $message Failure message
*
* @throws ResponseTextException when the condition is not fulfilled
*/
private function assertResponseText($condition, $message)
{
if ($condition) {
return;
}
throw new ResponseTextException($message, $this->session->getDriver());
}
/**
* Asserts a condition on an element.
*
* @param bool $condition
* @param string $message Failure message
* @param Element $element
*
* @throws ElementHtmlException when the condition is not fulfilled
*/
private function assertElement($condition, $message, Element $element)
{
if ($condition) {
return;
}
throw new ElementHtmlException($message, $this->session->getDriver(), $element);
}
/**
* Asserts a condition involving the text of an element.
*
* @param bool $condition
* @param string $message Failure message
* @param Element $element
*
* @throws ElementTextException when the condition is not fulfilled
*/
private function assertElementText($condition, $message, Element $element)
{
if ($condition) {
return;
}
throw new ElementTextException($message, $this->session->getDriver(), $element);
}
/**
* @param string $selectorType
* @param string|array $selector
* @param bool $plural
*
* @return string
*/
private function getMatchingElementRepresentation($selectorType, $selector, $plural = false)
{
$pluralization = $plural ? 's' : '';
if (in_array($selectorType, array('named', 'named_exact', 'named_partial'))
&& is_array($selector) && 2 === count($selector)
) {
return sprintf('%s%s matching locator "%s"', $selector[0], $pluralization, $selector[1]);
}
if (is_array($selector)) {
$selector = implode(' ', $selector);
}
return sprintf('element%s matching %s "%s"', $pluralization, $selectorType, $selector);
}
}

1
vendor/bin/phpunit vendored
View File

@ -1 +0,0 @@
../phpunit/phpunit/phpunit

View File

@ -1,413 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative) {
return false;
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if ($file === null && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if ($file === null) {
// Remember that this class does not exist.
return $this->classMap[$class] = false;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
if (0 === strpos($class, $prefix)) {
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

View File

@ -1,21 +0,0 @@
Copyright (c) 2015 Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,460 +0,0 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'CallbackFilterIterator' => $vendorDir . '/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php',
'Drupal\\Component\\Utility\\Timer' => $baseDir . '/core/lib/Drupal/Component/Utility/Timer.php',
'Drupal\\Component\\Utility\\Unicode' => $baseDir . '/core/lib/Drupal/Component/Utility/Unicode.php',
'Drupal\\Core\\Database\\Database' => $baseDir . '/core/lib/Drupal/Core/Database/Database.php',
'Drupal\\Core\\DrupalKernel' => $baseDir . '/core/lib/Drupal/Core/DrupalKernel.php',
'Drupal\\Core\\DrupalKernelInterface' => $baseDir . '/core/lib/Drupal/Core/DrupalKernelInterface.php',
'Drupal\\Core\\Site\\Settings' => $baseDir . '/core/lib/Drupal/Core/Site/Settings.php',
'File_Iterator' => $vendorDir . '/phpunit/php-file-iterator/src/Iterator.php',
'File_Iterator_Facade' => $vendorDir . '/phpunit/php-file-iterator/src/Facade.php',
'File_Iterator_Factory' => $vendorDir . '/phpunit/php-file-iterator/src/Factory.php',
'PHPUnit_Exception' => $vendorDir . '/phpunit/phpunit/src/Exception.php',
'PHPUnit_Extensions_GroupTestSuite' => $vendorDir . '/phpunit/phpunit/src/Extensions/GroupTestSuite.php',
'PHPUnit_Extensions_PhptTestCase' => $vendorDir . '/phpunit/phpunit/src/Extensions/PhptTestCase.php',
'PHPUnit_Extensions_PhptTestSuite' => $vendorDir . '/phpunit/phpunit/src/Extensions/PhptTestSuite.php',
'PHPUnit_Extensions_RepeatedTest' => $vendorDir . '/phpunit/phpunit/src/Extensions/RepeatedTest.php',
'PHPUnit_Extensions_TestDecorator' => $vendorDir . '/phpunit/phpunit/src/Extensions/TestDecorator.php',
'PHPUnit_Extensions_TicketListener' => $vendorDir . '/phpunit/phpunit/src/Extensions/TicketListener.php',
'PHPUnit_Framework_Assert' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert.php',
'PHPUnit_Framework_AssertionFailedError' => $vendorDir . '/phpunit/phpunit/src/Framework/AssertionFailedError.php',
'PHPUnit_Framework_BaseTestListener' => $vendorDir . '/phpunit/phpunit/src/Framework/BaseTestListener.php',
'PHPUnit_Framework_CodeCoverageException' => $vendorDir . '/phpunit/phpunit/src/Framework/CodeCoverageException.php',
'PHPUnit_Framework_Constraint' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint.php',
'PHPUnit_Framework_Constraint_And' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/And.php',
'PHPUnit_Framework_Constraint_ArrayHasKey' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php',
'PHPUnit_Framework_Constraint_ArraySubset' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php',
'PHPUnit_Framework_Constraint_Attribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Attribute.php',
'PHPUnit_Framework_Constraint_Callback' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Callback.php',
'PHPUnit_Framework_Constraint_ClassHasAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php',
'PHPUnit_Framework_Constraint_ClassHasStaticAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php',
'PHPUnit_Framework_Constraint_Composite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Composite.php',
'PHPUnit_Framework_Constraint_Count' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Count.php',
'PHPUnit_Framework_Constraint_Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Exception.php',
'PHPUnit_Framework_Constraint_ExceptionCode' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php',
'PHPUnit_Framework_Constraint_ExceptionMessage' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php',
'PHPUnit_Framework_Constraint_ExceptionMessageRegExp' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegExp.php',
'PHPUnit_Framework_Constraint_FileExists' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/FileExists.php',
'PHPUnit_Framework_Constraint_GreaterThan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php',
'PHPUnit_Framework_Constraint_IsAnything' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsAnything.php',
'PHPUnit_Framework_Constraint_IsEmpty' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php',
'PHPUnit_Framework_Constraint_IsEqual' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsEqual.php',
'PHPUnit_Framework_Constraint_IsFalse' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsFalse.php',
'PHPUnit_Framework_Constraint_IsIdentical' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php',
'PHPUnit_Framework_Constraint_IsInstanceOf' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php',
'PHPUnit_Framework_Constraint_IsJson' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsJson.php',
'PHPUnit_Framework_Constraint_IsNull' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsNull.php',
'PHPUnit_Framework_Constraint_IsTrue' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsTrue.php',
'PHPUnit_Framework_Constraint_IsType' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsType.php',
'PHPUnit_Framework_Constraint_JsonMatches' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php',
'PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/JsonMatches/ErrorMessageProvider.php',
'PHPUnit_Framework_Constraint_LessThan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LessThan.php',
'PHPUnit_Framework_Constraint_Not' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Not.php',
'PHPUnit_Framework_Constraint_ObjectHasAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php',
'PHPUnit_Framework_Constraint_Or' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Or.php',
'PHPUnit_Framework_Constraint_PCREMatch' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/PCREMatch.php',
'PHPUnit_Framework_Constraint_SameSize' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/SameSize.php',
'PHPUnit_Framework_Constraint_StringContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringContains.php',
'PHPUnit_Framework_Constraint_StringEndsWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php',
'PHPUnit_Framework_Constraint_StringMatches' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringMatches.php',
'PHPUnit_Framework_Constraint_StringStartsWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php',
'PHPUnit_Framework_Constraint_TraversableContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php',
'PHPUnit_Framework_Constraint_TraversableContainsOnly' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php',
'PHPUnit_Framework_Constraint_Xor' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Xor.php',
'PHPUnit_Framework_Error' => $vendorDir . '/phpunit/phpunit/src/Framework/Error.php',
'PHPUnit_Framework_Error_Deprecated' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Deprecated.php',
'PHPUnit_Framework_Error_Notice' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Notice.php',
'PHPUnit_Framework_Error_Warning' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Warning.php',
'PHPUnit_Framework_Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception.php',
'PHPUnit_Framework_ExceptionWrapper' => $vendorDir . '/phpunit/phpunit/src/Framework/ExceptionWrapper.php',
'PHPUnit_Framework_ExpectationFailedException' => $vendorDir . '/phpunit/phpunit/src/Framework/ExpectationFailedException.php',
'PHPUnit_Framework_IncompleteTest' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTest.php',
'PHPUnit_Framework_IncompleteTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTestCase.php',
'PHPUnit_Framework_IncompleteTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTestError.php',
'PHPUnit_Framework_InvalidCoversTargetError' => $vendorDir . '/phpunit/phpunit/src/Framework/InvalidCoversTargetError.php',
'PHPUnit_Framework_InvalidCoversTargetException' => $vendorDir . '/phpunit/phpunit/src/Framework/InvalidCoversTargetException.php',
'PHPUnit_Framework_MockObject_BadMethodCallException' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Exception/BadMethodCallException.php',
'PHPUnit_Framework_MockObject_Builder_Identity' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Builder/Identity.php',
'PHPUnit_Framework_MockObject_Builder_InvocationMocker' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Builder/InvocationMocker.php',
'PHPUnit_Framework_MockObject_Builder_Match' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Builder/Match.php',
'PHPUnit_Framework_MockObject_Builder_MethodNameMatch' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Builder/MethodNameMatch.php',
'PHPUnit_Framework_MockObject_Builder_Namespace' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Builder/Namespace.php',
'PHPUnit_Framework_MockObject_Builder_ParametersMatch' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Builder/ParametersMatch.php',
'PHPUnit_Framework_MockObject_Builder_Stub' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Builder/Stub.php',
'PHPUnit_Framework_MockObject_Exception' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Exception/Exception.php',
'PHPUnit_Framework_MockObject_Generator' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Generator.php',
'PHPUnit_Framework_MockObject_Invocation' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Invocation.php',
'PHPUnit_Framework_MockObject_InvocationMocker' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/InvocationMocker.php',
'PHPUnit_Framework_MockObject_Invocation_Object' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Invocation/Object.php',
'PHPUnit_Framework_MockObject_Invocation_Static' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Invocation/Static.php',
'PHPUnit_Framework_MockObject_Invokable' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Invokable.php',
'PHPUnit_Framework_MockObject_Matcher' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher.php',
'PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/AnyInvokedCount.php',
'PHPUnit_Framework_MockObject_Matcher_AnyParameters' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/AnyParameters.php',
'PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/ConsecutiveParameters.php',
'PHPUnit_Framework_MockObject_Matcher_Invocation' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/Invocation.php',
'PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/InvokedAtIndex.php',
'PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastCount' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/InvokedAtLeastCount.php',
'PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/InvokedAtLeastOnce.php',
'PHPUnit_Framework_MockObject_Matcher_InvokedAtMostCount' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/InvokedAtMostCount.php',
'PHPUnit_Framework_MockObject_Matcher_InvokedCount' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/InvokedCount.php',
'PHPUnit_Framework_MockObject_Matcher_InvokedRecorder' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/InvokedRecorder.php',
'PHPUnit_Framework_MockObject_Matcher_MethodName' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/MethodName.php',
'PHPUnit_Framework_MockObject_Matcher_Parameters' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/Parameters.php',
'PHPUnit_Framework_MockObject_Matcher_StatelessInvocation' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/StatelessInvocation.php',
'PHPUnit_Framework_MockObject_MockBuilder' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/MockBuilder.php',
'PHPUnit_Framework_MockObject_MockObject' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/MockObject.php',
'PHPUnit_Framework_MockObject_RuntimeException' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Exception/RuntimeException.php',
'PHPUnit_Framework_MockObject_Stub' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub.php',
'PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ConsecutiveCalls.php',
'PHPUnit_Framework_MockObject_Stub_Exception' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/Exception.php',
'PHPUnit_Framework_MockObject_Stub_MatcherCollection' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/MatcherCollection.php',
'PHPUnit_Framework_MockObject_Stub_Return' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/Return.php',
'PHPUnit_Framework_MockObject_Stub_ReturnArgument' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ReturnArgument.php',
'PHPUnit_Framework_MockObject_Stub_ReturnCallback' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ReturnCallback.php',
'PHPUnit_Framework_MockObject_Stub_ReturnSelf' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ReturnSelf.php',
'PHPUnit_Framework_MockObject_Stub_ReturnValueMap' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ReturnValueMap.php',
'PHPUnit_Framework_MockObject_Verifiable' => $vendorDir . '/phpunit/phpunit-mock-objects/src/Framework/MockObject/Verifiable.php',
'PHPUnit_Framework_OutputError' => $vendorDir . '/phpunit/phpunit/src/Framework/OutputError.php',
'PHPUnit_Framework_RiskyTest' => $vendorDir . '/phpunit/phpunit/src/Framework/RiskyTest.php',
'PHPUnit_Framework_RiskyTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/RiskyTestError.php',
'PHPUnit_Framework_SelfDescribing' => $vendorDir . '/phpunit/phpunit/src/Framework/SelfDescribing.php',
'PHPUnit_Framework_SkippedTest' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTest.php',
'PHPUnit_Framework_SkippedTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTestCase.php',
'PHPUnit_Framework_SkippedTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTestError.php',
'PHPUnit_Framework_SkippedTestSuiteError' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTestSuiteError.php',
'PHPUnit_Framework_SyntheticError' => $vendorDir . '/phpunit/phpunit/src/Framework/SyntheticError.php',
'PHPUnit_Framework_Test' => $vendorDir . '/phpunit/phpunit/src/Framework/Test.php',
'PHPUnit_Framework_TestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/TestCase.php',
'PHPUnit_Framework_TestFailure' => $vendorDir . '/phpunit/phpunit/src/Framework/TestFailure.php',
'PHPUnit_Framework_TestListener' => $vendorDir . '/phpunit/phpunit/src/Framework/TestListener.php',
'PHPUnit_Framework_TestResult' => $vendorDir . '/phpunit/phpunit/src/Framework/TestResult.php',
'PHPUnit_Framework_TestSuite' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSuite.php',
'PHPUnit_Framework_TestSuite_DataProvider' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSuite/DataProvider.php',
'PHPUnit_Framework_UnintentionallyCoveredCodeError' => $vendorDir . '/phpunit/phpunit/src/Framework/UnintentionallyCoveredCodeError.php',
'PHPUnit_Framework_Warning' => $vendorDir . '/phpunit/phpunit/src/Framework/Warning.php',
'PHPUnit_Runner_BaseTestRunner' => $vendorDir . '/phpunit/phpunit/src/Runner/BaseTestRunner.php',
'PHPUnit_Runner_Exception' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception.php',
'PHPUnit_Runner_Filter_Factory' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/Factory.php',
'PHPUnit_Runner_Filter_GroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/Group.php',
'PHPUnit_Runner_Filter_Group_Exclude' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/Group/Exclude.php',
'PHPUnit_Runner_Filter_Group_Include' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/Group/Include.php',
'PHPUnit_Runner_Filter_Test' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/Test.php',
'PHPUnit_Runner_StandardTestSuiteLoader' => $vendorDir . '/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php',
'PHPUnit_Runner_TestSuiteLoader' => $vendorDir . '/phpunit/phpunit/src/Runner/TestSuiteLoader.php',
'PHPUnit_Runner_Version' => $vendorDir . '/phpunit/phpunit/src/Runner/Version.php',
'PHPUnit_TextUI_Command' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command.php',
'PHPUnit_TextUI_ResultPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/ResultPrinter.php',
'PHPUnit_TextUI_TestRunner' => $vendorDir . '/phpunit/phpunit/src/TextUI/TestRunner.php',
'PHPUnit_Util_Blacklist' => $vendorDir . '/phpunit/phpunit/src/Util/Blacklist.php',
'PHPUnit_Util_Configuration' => $vendorDir . '/phpunit/phpunit/src/Util/Configuration.php',
'PHPUnit_Util_ErrorHandler' => $vendorDir . '/phpunit/phpunit/src/Util/ErrorHandler.php',
'PHPUnit_Util_Fileloader' => $vendorDir . '/phpunit/phpunit/src/Util/Fileloader.php',
'PHPUnit_Util_Filesystem' => $vendorDir . '/phpunit/phpunit/src/Util/Filesystem.php',
'PHPUnit_Util_Filter' => $vendorDir . '/phpunit/phpunit/src/Util/Filter.php',
'PHPUnit_Util_Getopt' => $vendorDir . '/phpunit/phpunit/src/Util/Getopt.php',
'PHPUnit_Util_GlobalState' => $vendorDir . '/phpunit/phpunit/src/Util/GlobalState.php',
'PHPUnit_Util_InvalidArgumentHelper' => $vendorDir . '/phpunit/phpunit/src/Util/InvalidArgumentHelper.php',
'PHPUnit_Util_Log_JSON' => $vendorDir . '/phpunit/phpunit/src/Util/Log/JSON.php',
'PHPUnit_Util_Log_JUnit' => $vendorDir . '/phpunit/phpunit/src/Util/Log/JUnit.php',
'PHPUnit_Util_Log_TAP' => $vendorDir . '/phpunit/phpunit/src/Util/Log/TAP.php',
'PHPUnit_Util_PHP' => $vendorDir . '/phpunit/phpunit/src/Util/PHP.php',
'PHPUnit_Util_PHP_Default' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/Default.php',
'PHPUnit_Util_PHP_Windows' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/Windows.php',
'PHPUnit_Util_Printer' => $vendorDir . '/phpunit/phpunit/src/Util/Printer.php',
'PHPUnit_Util_Regex' => $vendorDir . '/phpunit/phpunit/src/Util/Regex.php',
'PHPUnit_Util_String' => $vendorDir . '/phpunit/phpunit/src/Util/String.php',
'PHPUnit_Util_Test' => $vendorDir . '/phpunit/phpunit/src/Util/Test.php',
'PHPUnit_Util_TestDox_NamePrettifier' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php',
'PHPUnit_Util_TestDox_ResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php',
'PHPUnit_Util_TestDox_ResultPrinter_HTML' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/ResultPrinter/HTML.php',
'PHPUnit_Util_TestDox_ResultPrinter_Text' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/ResultPrinter/Text.php',
'PHPUnit_Util_TestSuiteIterator' => $vendorDir . '/phpunit/phpunit/src/Util/TestSuiteIterator.php',
'PHPUnit_Util_Type' => $vendorDir . '/phpunit/phpunit/src/Util/Type.php',
'PHPUnit_Util_XML' => $vendorDir . '/phpunit/phpunit/src/Util/XML.php',
'PHP_CodeCoverage' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage.php',
'PHP_CodeCoverage_Driver' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Driver.php',
'PHP_CodeCoverage_Driver_HHVM' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Driver/HHVM.php',
'PHP_CodeCoverage_Driver_PHPDBG' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Driver/PHPDBG.php',
'PHP_CodeCoverage_Driver_Xdebug' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Driver/Xdebug.php',
'PHP_CodeCoverage_Exception' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Exception.php',
'PHP_CodeCoverage_Exception_UnintentionallyCoveredCode' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Exception/UnintentionallyCoveredCode.php',
'PHP_CodeCoverage_Filter' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Filter.php',
'PHP_CodeCoverage_Report_Clover' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/Clover.php',
'PHP_CodeCoverage_Report_Crap4j' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/Crap4j.php',
'PHP_CodeCoverage_Report_Factory' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/Factory.php',
'PHP_CodeCoverage_Report_HTML' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML.php',
'PHP_CodeCoverage_Report_HTML_Renderer' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer.php',
'PHP_CodeCoverage_Report_HTML_Renderer_Dashboard' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer/Dashboard.php',
'PHP_CodeCoverage_Report_HTML_Renderer_Directory' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer/Directory.php',
'PHP_CodeCoverage_Report_HTML_Renderer_File' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/HTML/Renderer/File.php',
'PHP_CodeCoverage_Report_Node' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/Node.php',
'PHP_CodeCoverage_Report_Node_Directory' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/Node/Directory.php',
'PHP_CodeCoverage_Report_Node_File' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/Node/File.php',
'PHP_CodeCoverage_Report_Node_Iterator' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/Node/Iterator.php',
'PHP_CodeCoverage_Report_PHP' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/PHP.php',
'PHP_CodeCoverage_Report_Text' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/Text.php',
'PHP_CodeCoverage_Report_XML' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML.php',
'PHP_CodeCoverage_Report_XML_Directory' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/Directory.php',
'PHP_CodeCoverage_Report_XML_File' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/File.php',
'PHP_CodeCoverage_Report_XML_File_Coverage' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/File/Coverage.php',
'PHP_CodeCoverage_Report_XML_File_Method' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/File/Method.php',
'PHP_CodeCoverage_Report_XML_File_Report' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/File/Report.php',
'PHP_CodeCoverage_Report_XML_File_Unit' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/File/Unit.php',
'PHP_CodeCoverage_Report_XML_Node' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/Node.php',
'PHP_CodeCoverage_Report_XML_Project' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/Project.php',
'PHP_CodeCoverage_Report_XML_Tests' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/Tests.php',
'PHP_CodeCoverage_Report_XML_Totals' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/Totals.php',
'PHP_CodeCoverage_Util' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Util.php',
'PHP_CodeCoverage_Util_InvalidArgumentHelper' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Util/InvalidArgumentHelper.php',
'PHP_Timer' => $vendorDir . '/phpunit/php-timer/src/Timer.php',
'PHP_Token' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_TokenWithScope' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_TokenWithScopeAndVisibility' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ABSTRACT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_AMPERSAND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_AND_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ARRAY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ARRAY_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_AS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ASYNC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_AT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_AWAIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_BACKTICK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_BAD_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_BOOLEAN_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_BOOLEAN_OR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_BOOL_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_BREAK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CALLABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CARET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CASE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CATCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CLASS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CLASS_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CLASS_NAME_CONSTANT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CLONE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CLOSE_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CLOSE_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CLOSE_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CLOSE_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_COALESCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_COMMA' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_COMPILER_HALT_OFFSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CONCAT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CONST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CONSTANT_ENCAPSED_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CONTINUE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CURLY_OPEN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DEC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DEFAULT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DIR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DIV' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DIV_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DOC_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DOLLAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DOT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DOUBLE_ARROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DOUBLE_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DOUBLE_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_DOUBLE_QUOTES' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ELLIPSIS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ELSE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ELSEIF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EMPTY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ENCAPSED_AND_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ENDDECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ENDFOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ENDFOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ENDIF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ENDSWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ENDWHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_END_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ENUM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EQUALS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EVAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EXCLAMATION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EXIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EXTENDS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_FILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_FINAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_FINALLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_FOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_FOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_FUNC_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_GLOBAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_GOTO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_GT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_HALT_COMPILER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_IF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_IMPLEMENTS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_IN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_INC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_INCLUDE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_INCLUDE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_INLINE_HTML' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_INSTANCEOF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_INSTEADOF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_INTERFACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_INT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ISSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_IS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_IS_GREATER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_IS_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_IS_NOT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_IS_NOT_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_IS_SMALLER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_Includes' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_JOIN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_LAMBDA_ARROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_LAMBDA_CP' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_LAMBDA_OP' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_LINE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_LIST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_LNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_LOGICAL_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_LOGICAL_OR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_LOGICAL_XOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_LT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_METHOD_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_MINUS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_MINUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_MOD_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_MULT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_MUL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_NAMESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_NEW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_NS_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_NS_SEPARATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_NUM_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OBJECT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OBJECT_OPERATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ONUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OPEN_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OPEN_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OPEN_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OPEN_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OPEN_TAG_WITH_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_PERCENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_PIPE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_PLUS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_PLUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_POW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_POW_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_PRINT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_PRIVATE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_PROTECTED' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_PUBLIC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_QUESTION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_REQUIRE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_REQUIRE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_RETURN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SEMICOLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SHAPE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SPACESHIP' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_START_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_STATIC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_STRING_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_STRING_VARNAME' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_Stream' => $vendorDir . '/phpunit/php-token-stream/src/Token/Stream.php',
'PHP_Token_Stream_CachingFactory' => $vendorDir . '/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php',
'PHP_Token_THROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_TILDE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_TRAIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_TRAIT_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_TRY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_TYPE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_TYPELIST_GT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_TYPELIST_LT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_UNSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_UNSET_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_USE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_VAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_VARIABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_WHERE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_WHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_ATTRIBUTE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_CATEGORY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_CATEGORY_LABEL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_CHILDREN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_LABEL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_REQUIRED' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_TAG_GT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_TAG_LT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_TEXT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XOR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_YIELD' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_YIELD_FROM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'RecursiveCallbackFilterIterator' => $vendorDir . '/symfony/polyfill-php54/Resources/stubs/RecursiveCallbackFilterIterator.php',
'SebastianBergmann\\Comparator\\ArrayComparator' => $vendorDir . '/sebastian/comparator/src/ArrayComparator.php',
'SebastianBergmann\\Comparator\\Comparator' => $vendorDir . '/sebastian/comparator/src/Comparator.php',
'SebastianBergmann\\Comparator\\ComparisonFailure' => $vendorDir . '/sebastian/comparator/src/ComparisonFailure.php',
'SebastianBergmann\\Comparator\\DOMNodeComparator' => $vendorDir . '/sebastian/comparator/src/DOMNodeComparator.php',
'SebastianBergmann\\Comparator\\DateTimeComparator' => $vendorDir . '/sebastian/comparator/src/DateTimeComparator.php',
'SebastianBergmann\\Comparator\\DoubleComparator' => $vendorDir . '/sebastian/comparator/src/DoubleComparator.php',
'SebastianBergmann\\Comparator\\ExceptionComparator' => $vendorDir . '/sebastian/comparator/src/ExceptionComparator.php',
'SebastianBergmann\\Comparator\\Factory' => $vendorDir . '/sebastian/comparator/src/Factory.php',
'SebastianBergmann\\Comparator\\MockObjectComparator' => $vendorDir . '/sebastian/comparator/src/MockObjectComparator.php',
'SebastianBergmann\\Comparator\\NumericComparator' => $vendorDir . '/sebastian/comparator/src/NumericComparator.php',
'SebastianBergmann\\Comparator\\ObjectComparator' => $vendorDir . '/sebastian/comparator/src/ObjectComparator.php',
'SebastianBergmann\\Comparator\\ResourceComparator' => $vendorDir . '/sebastian/comparator/src/ResourceComparator.php',
'SebastianBergmann\\Comparator\\ScalarComparator' => $vendorDir . '/sebastian/comparator/src/ScalarComparator.php',
'SebastianBergmann\\Comparator\\SplObjectStorageComparator' => $vendorDir . '/sebastian/comparator/src/SplObjectStorageComparator.php',
'SebastianBergmann\\Comparator\\TypeComparator' => $vendorDir . '/sebastian/comparator/src/TypeComparator.php',
'SebastianBergmann\\Diff\\Chunk' => $vendorDir . '/sebastian/diff/src/Chunk.php',
'SebastianBergmann\\Diff\\Diff' => $vendorDir . '/sebastian/diff/src/Diff.php',
'SebastianBergmann\\Diff\\Differ' => $vendorDir . '/sebastian/diff/src/Differ.php',
'SebastianBergmann\\Diff\\LCS\\LongestCommonSubsequence' => $vendorDir . '/sebastian/diff/src/LCS/LongestCommonSubsequence.php',
'SebastianBergmann\\Diff\\LCS\\MemoryEfficientImplementation' => $vendorDir . '/sebastian/diff/src/LCS/MemoryEfficientLongestCommonSubsequenceImplementation.php',
'SebastianBergmann\\Diff\\LCS\\TimeEfficientImplementation' => $vendorDir . '/sebastian/diff/src/LCS/TimeEfficientLongestCommonSubsequenceImplementation.php',
'SebastianBergmann\\Diff\\Line' => $vendorDir . '/sebastian/diff/src/Line.php',
'SebastianBergmann\\Diff\\Parser' => $vendorDir . '/sebastian/diff/src/Parser.php',
'SebastianBergmann\\Environment\\Console' => $vendorDir . '/sebastian/environment/src/Console.php',
'SebastianBergmann\\Environment\\Runtime' => $vendorDir . '/sebastian/environment/src/Runtime.php',
'SebastianBergmann\\Exporter\\Exporter' => $vendorDir . '/sebastian/exporter/src/Exporter.php',
'SebastianBergmann\\GlobalState\\Blacklist' => $vendorDir . '/sebastian/global-state/src/Blacklist.php',
'SebastianBergmann\\GlobalState\\Exception' => $vendorDir . '/sebastian/global-state/src/Exception.php',
'SebastianBergmann\\GlobalState\\Restorer' => $vendorDir . '/sebastian/global-state/src/Restorer.php',
'SebastianBergmann\\GlobalState\\RuntimeException' => $vendorDir . '/sebastian/global-state/src/RuntimeException.php',
'SebastianBergmann\\GlobalState\\Snapshot' => $vendorDir . '/sebastian/global-state/src/Snapshot.php',
'SebastianBergmann\\RecursionContext\\Context' => $vendorDir . '/sebastian/recursion-context/src/Context.php',
'SebastianBergmann\\RecursionContext\\Exception' => $vendorDir . '/sebastian/recursion-context/src/Exception.php',
'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => $vendorDir . '/sebastian/recursion-context/src/InvalidArgumentException.php',
'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php',
'SessionHandlerInterface' => $vendorDir . '/symfony/polyfill-php54/Resources/stubs/SessionHandlerInterface.php',
'Symfony\\Component\\HttpFoundation\\FileBag' => $vendorDir . '/symfony/http-foundation/FileBag.php',
'Symfony\\Component\\HttpFoundation\\HeaderBag' => $vendorDir . '/symfony/http-foundation/HeaderBag.php',
'Symfony\\Component\\HttpFoundation\\ParameterBag' => $vendorDir . '/symfony/http-foundation/ParameterBag.php',
'Symfony\\Component\\HttpFoundation\\Request' => $vendorDir . '/symfony/http-foundation/Request.php',
'Symfony\\Component\\HttpFoundation\\ServerBag' => $vendorDir . '/symfony/http-foundation/ServerBag.php',
'Symfony\\Component\\HttpKernel\\HttpKernel' => $vendorDir . '/symfony/http-kernel/HttpKernel.php',
'Symfony\\Component\\HttpKernel\\HttpKernelInterface' => $vendorDir . '/symfony/http-kernel/HttpKernelInterface.php',
'Symfony\\Component\\HttpKernel\\TerminableInterface' => $vendorDir . '/symfony/http-kernel/TerminableInterface.php',
'Text_Template' => $vendorDir . '/phpunit/php-text-template/src/Template.php',
);

View File

@ -1,19 +0,0 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'e40631d46120a9c38ea139981f8dab26' => $vendorDir . '/ircmaxell/password-compat/lib/password.php',
'edc6464955a37aa4d5fbf39d40fb6ee7' => $vendorDir . '/symfony/polyfill-php55/bootstrap.php',
'3e2471375464aac821502deb0ac64275' => $vendorDir . '/symfony/polyfill-php54/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php',
'454414594637b9dd94a19af83f56f1a2' => $baseDir . '/core/lib/Drupal.php',
);

View File

@ -1,24 +0,0 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'phpDocumentor' => array($vendorDir . '/phpdocumentor/reflection-docblock/src'),
'org\\bovigo\\vfs\\' => array($vendorDir . '/mikey179/vfsStream/src/main/php'),
'Twig_' => array($vendorDir . '/twig/twig/lib'),
'Stack' => array($vendorDir . '/stack/builder/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log'),
'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src'),
'Egulias\\' => array($vendorDir . '/egulias/email-validator/src'),
'EasyRdf_' => array($vendorDir . '/easyrdf/easyrdf/lib'),
'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'),
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'),
'Doctrine\\Common\\Collections\\' => array($vendorDir . '/doctrine/collections/lib'),
'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib'),
'Doctrine\\Common\\Annotations\\' => array($vendorDir . '/doctrine/annotations/lib'),
'Doctrine\\Common\\' => array($vendorDir . '/doctrine/common/lib'),
'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src'),
);

View File

@ -1,53 +0,0 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Zumba\\Mink\\Driver\\' => array($vendorDir . '/jcalderonzumba/mink-phantomjs-driver/src'),
'Zumba\\GastonJS\\' => array($vendorDir . '/jcalderonzumba/gastonjs/src'),
'Zend\\Stdlib\\' => array($vendorDir . '/zendframework/zend-stdlib/src'),
'Zend\\Hydrator\\' => array($vendorDir . '/zendframework/zend-hydrator/src'),
'Zend\\Feed\\' => array($vendorDir . '/zendframework/zend-feed/src'),
'Zend\\Escaper\\' => array($vendorDir . '/zendframework/zend-escaper/src'),
'Zend\\Diactoros\\' => array($vendorDir . '/zendframework/zend-diactoros/src'),
'Wikimedia\\Composer\\' => array($vendorDir . '/wikimedia/composer-merge-plugin/src'),
'Symfony\\Polyfill\\Php55\\' => array($vendorDir . '/symfony/polyfill-php55'),
'Symfony\\Polyfill\\Php54\\' => array($vendorDir . '/symfony/polyfill-php54'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Iconv\\' => array($vendorDir . '/symfony/polyfill-iconv'),
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Symfony\\Component\\Validator\\' => array($vendorDir . '/symfony/validator'),
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Symfony\\Component\\Serializer\\' => array($vendorDir . '/symfony/serializer'),
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'),
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
'Symfony\\Component\\DomCrawler\\' => array($vendorDir . '/symfony/dom-crawler'),
'Symfony\\Component\\DependencyInjection\\' => array($vendorDir . '/symfony/dependency-injection'),
'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
'Symfony\\Component\\ClassLoader\\' => array($vendorDir . '/symfony/class-loader'),
'Symfony\\Component\\BrowserKit\\' => array($vendorDir . '/symfony/browser-kit'),
'Symfony\\Cmf\\Component\\Routing\\' => array($vendorDir . '/symfony-cmf/routing'),
'Symfony\\Bridge\\PsrHttpMessage\\' => array($vendorDir . '/symfony/psr-http-message-bridge'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
'Masterminds\\' => array($vendorDir . '/masterminds/html5/src'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Goutte\\' => array($vendorDir . '/fabpot/goutte/Goutte'),
'Drupal\\Driver\\' => array($baseDir . '/drivers/lib/Drupal/Driver'),
'Drupal\\Core\\Composer\\' => array($baseDir . '/core/lib/Drupal/Core/Composer'),
'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'),
'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
'Behat\\Mink\\Driver\\' => array($vendorDir . '/behat/mink-browserkit-driver/src', $vendorDir . '/behat/mink-goutte-driver/src'),
'Behat\\Mink\\' => array($vendorDir . '/behat/mink/src'),
);

View File

@ -1,59 +0,0 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitDrupal8
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitDrupal8', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitDrupal8', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireDrupal8($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequireDrupal8($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
; top-most EditorConfig file
root = true
; Unix-style newlines
[*]
end_of_line = LF
[*.php]
indent_style = space
indent_size = 4

View File

@ -1,3 +0,0 @@
vendor/
composer.lock
.idea/

View File

@ -1,14 +0,0 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
before_script:
- curl -s http://getcomposer.org/installer | php -- --quiet
- php composer.phar install --dev
script: phpunit

View File

@ -1,19 +0,0 @@
Copyright (c) 2012 Kyle Robinson Young
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,191 +0,0 @@
# A Multi-Framework [Composer](http://getcomposer.org) Library Installer
[![Build Status](http://img.shields.io/travis/composer/installers.svg)](http://travis-ci.org/composer/installers)
This is for PHP package authors to require in their `composer.json`. It will
install their package to the correct location based on the specified package
type.
The goal of `installers` is to be a simple package type to install path map.
Users can also customize the install path per package and package authors can
modify the package name upon installing.
`installers` isn't intended on replacing all custom installers. If your
package requires special installation handling then by all means, create a
custom installer to handle it.
**Natively Supported Frameworks**:
The following frameworks natively work with Composer and will be
installed to the default `vendor` directory. `composer/installers`
is not needed to install packages with these frameworks:
* Aura
* Symfony2
* Yii
* Yii2
**Current Supported Package Types**:
> Stable types are marked as **bold**, this means that installation paths
> for those type will not be changed. Any adjustment for those types would
> require creation of brand new type that will cover required changes.
| Framework | Types
| --------- | -----
| Aimeos | `aimeos-extension`
| Asgard | `asgard-module`<br>`asgard-theme`
| AGL | `agl-module`
| AnnotateCms | `annotatecms-module`<br>`annotatecms-component`<br>`annotatecms-service`
| Bitrix | `bitrix-module`<br>`bitrix-component`<br>`bitrix-theme`
| CakePHP 2+ | **`cakephp-plugin`**
| Chef | `chef-cookbook`<br>`chef-role`
| CCFramework | `ccframework-ship`<br>`ccframework-theme`
| CodeIgniter | `codeigniter-library`<br>`codeigniter-third-party`<br>`codeigniter-module`
| concrete5 | `concrete5-block`<br>`concrete5-package`<br>`concrete5-theme`<br>`concrete5-update`
| Craft | `craft-plugin`
| Croogo | `croogo-plugin`<br>`croogo-theme`
| DokuWiki | `dokuwiki-plugin`<br>`dokuwiki-template`
| Dolibarr | `dolibarr-module`
| Drupal | <b>`drupal-module`<br>`drupal-theme`</b><br>`drupal-library`<br>`drupal-profile`<br>`drupal-drush`
| Elgg | `elgg-plugin`
| FuelPHP v1.x | `fuel-module`<br>`fuel-package`<br/>`fuel-theme`
| FuelPHP v2.x | `fuelphp-component`
| Grav | `grav-plugin`<br>`grav-theme`
| Hurad | `hurad-plugin`<br>`hurad-theme`
| Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library`
| Kirby | **`kirby-plugin`**
| Kohana | **`kohana-module`**
| Laravel | `laravel-library`
| Lithium | **`lithium-library`<br>`lithium-source`**
| Magento | `magento-library`<br>`magento-skin`<br>`magento-theme`
| Mako | `mako-package`
| MODX Evo | `modxevo-snippet`<br>`modxevo-plugin`<br>`modxevo-module`<br>`modxevo-template`<br>`modxevo-lib`
| MediaWiki | `mediawiki-extension`
| October | **`october-module`<br>`october-plugin`<br>`october-theme`**
| OXID | `oxid-module`<br>`oxid-theme`<br>`oxid-out`
| MODULEWork | `modulework-module`
| Moodle | `moodle-*` (Please [check source](https://raw.githubusercontent.com/composer/installers/master/src/Composer/Installers/MoodleInstaller.php) for all supported types)
| Piwik | `piwik-plugin`
| phpBB | `phpbb-extension`<br>`phpbb-style`<br>`phpbb-language`
| Pimcore | `pimcore-plugin`
| PPI | **`ppi-module`**
| Puppet | `puppet-module`
| REDAXO | `redaxo-addon`
| Roundcube | `roundcube-plugin`
| shopware | `shopware-backend-plugin`<br/>`shopware-core-plugin`<br/>`shopware-frontend-plugin`<br/>`shopware-theme`
| SilverStripe | `silverstripe-module`<br>`silverstripe-theme`
| SMF | `smf-module`<br>`smf-theme`
| symfony1 | **`symfony1-plugin`**
| Tusk | `tusk-task`<br>`tusk-command`<br>`tusk-asset`
| TYPO3 Flow | `typo3-flow-package`<br>`typo3-flow-framework`<br>`typo3-flow-plugin`<br>`typo3-flow-site`<br>`typo3-flow-boilerplate`<br>`typo3-flow-build`
| TYPO3 CMS | `typo3-cms-extension`
| Wolf CMS | `wolfcms-plugin`
| WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin`
| Zend | `zend-library`<br>`zend-extra`<br>`zend-module`
| Zikula | `zikula-module`<br>`zikula-theme`
| Prestashop | `prestashop-module`<br>`prestashop-theme`
## Example `composer.json` File
This is an example for a CakePHP plugin. The only important parts to set in your
composer.json file are `"type": "cakephp-plugin"` which describes what your
package is and `"require": { "composer/installers": "~1.0" }` which tells composer
to load the custom installers.
```json
{
"name": "you/ftp",
"type": "cakephp-plugin",
"require": {
"composer/installers": "~1.0"
}
}
```
This would install your package to the `Plugin/Ftp/` folder of a CakePHP app
when a user runs `php composer.phar install`.
So submit your packages to [packagist.org](http://packagist.org)!
## Custom Install Paths
If you are consuming a package that uses the `composer/installers` you can
override the install path with the following extra in your `composer.json`:
```json
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["shama/ftp", "vendor/package"]
}
}
}
```
A package type can have a custom installation path with a `type:` prefix.
``` json
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["type:wordpress-plugin"]
}
}
}
```
This would use your custom path for each of the listed packages. The available
variables to use in your paths are: `{$name}`, `{$vendor}`, `{$type}`.
## Custom Install Names
If you're a package author and need your package to be named differently when
installed consider using the `installer-name` extra.
For example you have a package named `shama/cakephp-ftp` with the type
`cakephp-plugin`. Installing with `composer/installers` would install to the
path `Plugin/CakephpFtp`. Due to the strict naming conventions, you as a
package author actually need the package to be named and installed to
`Plugin/Ftp`. Using the following config within your **package** `composer.json`
will allow this:
```json
{
"name": "shama/cakephp-ftp",
"type": "cakephp-plugin",
"extra": {
"installer-name": "Ftp"
}
}
```
Please note the name entered into `installer-name` will be the final and will
not be inflected.
## Contribute!
* [Fork and clone](https://help.github.com/articles/fork-a-repo).
* Run the command `php composer.phar install --dev` to install the dev
dependencies. See [Composer](https://github.com/composer/composer#installation--usage).
* Use the command `phpunit` to run the tests. See [PHPUnit](http://phpunit.de).
* Create a branch, commit, push and send us a
[pull request](https://help.github.com/articles/using-pull-requests).
To ensure a consistent code base, you should make sure the code follows the
[Coding Standards](http://symfony.com/doc/2.0/contributing/code/standards.html)
which we borrowed from Symfony.
If you would like to help, please take a look at the list of
[issues](https://github.com/composer/installers/issues).
### Should we allow dynamic package types or paths? No.
What are they? The ability for a package author to determine where a package
will be installed either through setting the path directly in their
`composer.json` or through a dynamic package type: `"type":
"framework-install-here"`.
It has been proposed many times. Even implemented once early on and then
removed. `installers` won't do this because it would allow a single package
author to wipe out entire folders without the user's consent. That user would
then come here to yell at us.

View File

@ -1,77 +0,0 @@
{
"name": "composer/installers",
"type": "composer-installer",
"license": "MIT",
"description": "A multi-framework Composer library installer",
"keywords": [
"installer",
"Aimeos",
"AGL",
"AnnotateCms",
"Bitrix",
"CakePHP",
"Chef",
"CodeIgniter",
"concrete5",
"Craft",
"Croogo",
"DokuWiki",
"Dolibarr",
"Drupal",
"Elgg",
"FuelPHP",
"Grav",
"Hurad",
"Joomla",
"Kohana",
"Laravel",
"Lithium",
"Magento",
"Mako",
"MODX Evo",
"MediaWiki",
"OXID",
"MODULEWork",
"Moodle",
"Piwik",
"phpBB",
"PPI",
"Puppet",
"Roundcube",
"shopware",
"SilverStripe",
"SMF",
"symfony",
"Thelia",
"TYPO3",
"WolfCMS",
"WordPress",
"Zend",
"Zikula"
],
"homepage": "http://composer.github.com/installers/",
"authors": [
{
"name": "Kyle Robinson Young",
"email": "kyle@dontkry.com",
"homepage": "https://github.com/shama"
}
],
"autoload": {
"psr-0": { "Composer\\Installers\\": "src/" }
},
"extra": {
"class": "Composer\\Installers\\Installer",
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"replace": {
"shama/baton": "*",
"roundcube/plugin-installer": "*"
},
"require-dev": {
"composer/composer": "1.0.*@dev",
"phpunit/phpunit": "4.1.*"
}
}

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="Installers Test Suite">
<directory>tests/Composer/Installers</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src/Composer/Installers</directory>
</whitelist>
</filter>
</phpunit>

View File

@ -1,21 +0,0 @@
<?php
namespace Composer\Installers;
class AglInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'More/{$name}/',
);
/**
* Format package name to CamelCase
*/
public function inflectPackageVars($vars)
{
$vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) {
return strtoupper($matches[1]);
}, $vars['name']);
return $vars;
}
}

View File

@ -1,9 +0,0 @@
<?php
namespace Composer\Installers;
class AimeosInstaller extends BaseInstaller
{
protected $locations = array(
'extension' => 'ext/{$name}/',
);
}

View File

@ -1,11 +0,0 @@
<?php
namespace Composer\Installers;
class AnnotateCmsInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'addons/modules/{$name}/',
'component' => 'addons/components/{$name}/',
'service' => 'addons/services/{$name}/',
);
}

View File

@ -1,45 +0,0 @@
<?php
namespace Composer\Installers;
class AsgardInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'Modules/{$name}/',
'theme' => 'Themes/{$name}/'
);
/**
* Format package name.
*
* For package type asgard-module, cut off a trailing '-plugin' if present.
*
* For package type asgard-theme, cut off a trailing '-theme' if present.
*
*/
public function inflectPackageVars($vars)
{
if ($vars['type'] === 'asgard-module') {
return $this->inflectPluginVars($vars);
}
if ($vars['type'] === 'asgard-theme') {
return $this->inflectThemeVars($vars);
}
return $vars;
}
protected function inflectPluginVars($vars)
{
$vars['name'] = ucfirst(preg_replace('/-module/', '', $vars['name']));
return $vars;
}
protected function inflectThemeVars($vars)
{
$vars['name'] = ucfirst(preg_replace('/-theme$/', '', $vars['name']));
return $vars;
}
}

View File

@ -1,131 +0,0 @@
<?php
namespace Composer\Installers;
use Composer\Composer;
use Composer\Package\PackageInterface;
abstract class BaseInstaller
{
protected $locations = array();
protected $composer;
protected $package;
/**
* Initializes base installer.
*
* @param PackageInterface $package
* @param Composer $composer
*/
public function __construct(PackageInterface $package = null, Composer $composer = null)
{
$this->composer = $composer;
$this->package = $package;
}
/**
* Return the install path based on package type.
*
* @param PackageInterface $package
* @param string $frameworkType
* @return string
*/
public function getInstallPath(PackageInterface $package, $frameworkType = '')
{
$type = $this->package->getType();
$prettyName = $this->package->getPrettyName();
if (strpos($prettyName, '/') !== false) {
list($vendor, $name) = explode('/', $prettyName);
} else {
$vendor = '';
$name = $prettyName;
}
$availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type'));
$extra = $package->getExtra();
if (!empty($extra['installer-name'])) {
$availableVars['name'] = $extra['installer-name'];
}
if ($this->composer->getPackage()) {
$extra = $this->composer->getPackage()->getExtra();
if (!empty($extra['installer-paths'])) {
$customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type);
if ($customPath !== false) {
return $this->templatePath($customPath, $availableVars);
}
}
}
$packageType = substr($type, strlen($frameworkType) + 1);
$locations = $this->getLocations();
if (!isset($locations[$packageType])) {
throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type));
}
return $this->templatePath($locations[$packageType], $availableVars);
}
/**
* For an installer to override to modify the vars per installer.
*
* @param array $vars
* @return array
*/
public function inflectPackageVars($vars)
{
return $vars;
}
/**
* Gets the installer's locations
*
* @return array
*/
public function getLocations()
{
return $this->locations;
}
/**
* Replace vars in a path
*
* @param string $path
* @param array $vars
* @return string
*/
protected function templatePath($path, array $vars = array())
{
if (strpos($path, '{') !== false) {
extract($vars);
preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches);
if (!empty($matches[1])) {
foreach ($matches[1] as $var) {
$path = str_replace('{$' . $var . '}', $$var, $path);
}
}
}
return $path;
}
/**
* Search through a passed paths array for a custom install path.
*
* @param array $paths
* @param string $name
* @param string $type
* @return string
*/
protected function mapCustomInstallPaths(array $paths, $name, $type)
{
foreach ($paths as $path => $names) {
if (in_array($name, $names) || in_array('type:' . $type, $names)) {
return $path;
}
}
return false;
}
}

View File

@ -1,11 +0,0 @@
<?php
namespace Composer\Installers;
class BitrixInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'local/modules/{$name}/',
'component' => 'local/components/{$name}/',
'theme' => 'local/templates/{$name}/'
);
}

View File

@ -1,78 +0,0 @@
<?php
namespace Composer\Installers;
use Composer\DependencyResolver\Pool;
use Composer\Package\PackageInterface;
use Composer\Package\LinkConstraint\MultiConstraint;
use Composer\Package\LinkConstraint\VersionConstraint;
class CakePHPInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'Plugin/{$name}/',
);
/**
* Format package name to CamelCase
*/
public function inflectPackageVars($vars)
{
if ($this->matchesCakeVersion('>=', '3.0.0')) {
return $vars;
}
$nameParts = explode('/', $vars['name']);
foreach ($nameParts as &$value) {
$value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
$value = str_replace(array('-', '_'), ' ', $value);
$value = str_replace(' ', '', ucwords($value));
}
$vars['name'] = implode('/', $nameParts);
return $vars;
}
/**
* Change the default plugin location when cakephp >= 3.0
*/
public function getLocations()
{
if ($this->matchesCakeVersion('>=', '3.0.0')) {
$this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
}
return $this->locations;
}
/**
* Check if CakePHP version matches against a version
*
* @param string $matcher
* @param string $version
* @return bool
*/
protected function matchesCakeVersion($matcher, $version)
{
$repositoryManager = $this->composer->getRepositoryManager();
if ($repositoryManager) {
$repos = $repositoryManager->getLocalRepository();
if (!$repos) {
return false;
}
$cake3 = new MultiConstraint(array(
new VersionConstraint($matcher, $version),
new VersionConstraint('!=', '9999999-dev'),
));
$pool = new Pool('dev');
$pool->addRepository($repos);
$packages = $pool->whatProvides('cakephp/cakephp');
foreach ($packages as $package) {
$installed = new VersionConstraint('=', $package->getVersion());
if ($cake3->matches($installed)) {
return true;
break;
}
}
}
return false;
}
}

View File

@ -1,11 +0,0 @@
<?php
namespace Composer\Installers;
class ChefInstaller extends BaseInstaller
{
protected $locations = array(
'cookbook' => 'Chef/{$vendor}/{$name}/',
'role' => 'Chef/roles/{$name}/',
);
}

View File

@ -1,10 +0,0 @@
<?php
namespace Composer\Installers;
class ClanCatsFrameworkInstaller extends BaseInstaller
{
protected $locations = array(
'ship' => 'CCF/orbit/{$name}/',
'theme' => 'CCF/app/themes/{$name}/',
);
}

View File

@ -1,11 +0,0 @@
<?php
namespace Composer\Installers;
class CodeIgniterInstaller extends BaseInstaller
{
protected $locations = array(
'library' => 'application/libraries/{$name}/',
'third-party' => 'application/third_party/{$name}/',
'module' => 'application/modules/{$name}/',
);
}

View File

@ -1,12 +0,0 @@
<?php
namespace Composer\Installers;
class Concrete5Installer extends BaseInstaller
{
protected $locations = array(
'block' => 'blocks/{$name}/',
'package' => 'packages/{$name}/',
'theme' => 'themes/{$name}/',
'update' => 'updates/{$name}/',
);
}

View File

@ -1,9 +0,0 @@
<?php
namespace Composer\Installers;
class CraftInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'craft/plugins/{$name}/',
);
}

View File

@ -1,21 +0,0 @@
<?php
namespace Composer\Installers;
class CroogoInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'Plugin/{$name}/',
'theme' => 'View/Themed/{$name}/',
);
/**
* Format package name to CamelCase
*/
public function inflectPackageVars($vars)
{
$vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name']));
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
}
}

View File

@ -1,50 +0,0 @@
<?php
namespace Composer\Installers;
class DokuWikiInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'lib/plugins/{$name}/',
'template' => 'lib/tpl/{$name}/',
);
/**
* Format package name.
*
* For package type dokuwiki-plugin, cut off a trailing '-plugin',
* or leading dokuwiki_ if present.
*
* For package type dokuwiki-template, cut off a trailing '-template' if present.
*
*/
public function inflectPackageVars($vars)
{
if ($vars['type'] === 'dokuwiki-plugin') {
return $this->inflectPluginVars($vars);
}
if ($vars['type'] === 'dokuwiki-template') {
return $this->inflectTemplateVars($vars);
}
return $vars;
}
protected function inflectPluginVars($vars)
{
$vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
$vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
return $vars;
}
protected function inflectTemplateVars($vars)
{
$vars['name'] = preg_replace('/-template$/', '', $vars['name']);
$vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
return $vars;
}
}

View File

@ -1,16 +0,0 @@
<?php
namespace Composer\Installers;
/**
* Class DolibarrInstaller
*
* @package Composer\Installers
* @author Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*/
class DolibarrInstaller extends BaseInstaller
{
//TODO: Add support for scripts and themes
protected $locations = array(
'module' => 'htdocs/custom/{$name}/',
);
}

View File

@ -1,14 +0,0 @@
<?php
namespace Composer\Installers;
class DrupalInstaller extends BaseInstaller
{
protected $locations = array(
'core' => 'core/',
'module' => 'modules/{$name}/',
'theme' => 'themes/{$name}/',
'library' => 'libraries/{$name}/',
'profile' => 'profiles/{$name}/',
'drush' => 'drush/{$name}/',
);
}

View File

@ -1,9 +0,0 @@
<?php
namespace Composer\Installers;
class ElggInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'mod/{$name}/',
);
}

View File

@ -1,11 +0,0 @@
<?php
namespace Composer\Installers;
class FuelInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'fuel/app/modules/{$name}/',
'package' => 'fuel/packages/{$name}/',
'theme' => 'fuel/app/themes/{$name}/',
);
}

View File

@ -1,9 +0,0 @@
<?php
namespace Composer\Installers;
class FuelphpInstaller extends BaseInstaller
{
protected $locations = array(
'component' => 'components/{$name}/',
);
}

View File

@ -1,30 +0,0 @@
<?php
namespace Composer\Installers;
class GravInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'user/plugins/{$name}/',
'theme' => 'user/themes/{$name}/',
);
/**
* Format package name
*
* @param array $vars
*
* @return array
*/
public function inflectPackageVars($vars)
{
$restrictedWords = implode('|', array_keys($this->locations));
$vars['name'] = strtolower($vars['name']);
$vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui',
'$1',
$vars['name']
);
return $vars;
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace Composer\Installers;
class HuradInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'plugins/{$name}/',
'theme' => 'plugins/{$name}/',
);
/**
* Format package name to CamelCase
*/
public function inflectPackageVars($vars)
{
$nameParts = explode('/', $vars['name']);
foreach ($nameParts as &$value) {
$value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
$value = str_replace(array('-', '_'), ' ', $value);
$value = str_replace(' ', '', ucwords($value));
}
$vars['name'] = implode('/', $nameParts);
return $vars;
}
}

View File

@ -1,163 +0,0 @@
<?php
namespace Composer\Installers;
use Composer\Installer\LibraryInstaller;
use Composer\Package\PackageInterface;
use Composer\Repository\InstalledRepositoryInterface;
class Installer extends LibraryInstaller
{
/**
* Package types to installer class map
*
* @var array
*/
private $supportedTypes = array(
'aimeos' => 'AimeosInstaller',
'asgard' => 'AsgardInstaller',
'agl' => 'AglInstaller',
'annotatecms' => 'AnnotateCmsInstaller',
'bitrix' => 'BitrixInstaller',
'cakephp' => 'CakePHPInstaller',
'chef' => 'ChefInstaller',
'ccframework' => 'ClanCatsFrameworkInstaller',
'codeigniter' => 'CodeIgniterInstaller',
'concrete5' => 'Concrete5Installer',
'craft' => 'CraftInstaller',
'croogo' => 'CroogoInstaller',
'dokuwiki' => 'DokuWikiInstaller',
'dolibarr' => 'DolibarrInstaller',
'drupal' => 'DrupalInstaller',
'elgg' => 'ElggInstaller',
'fuel' => 'FuelInstaller',
'fuelphp' => 'FuelphpInstaller',
'grav' => 'GravInstaller',
'hurad' => 'HuradInstaller',
'joomla' => 'JoomlaInstaller',
'kirby' => 'KirbyInstaller',
'kohana' => 'KohanaInstaller',
'laravel' => 'LaravelInstaller',
'lithium' => 'LithiumInstaller',
'magento' => 'MagentoInstaller',
'mako' => 'MakoInstaller',
'mediawiki' => 'MediaWikiInstaller',
'microweber' => 'MicroweberInstaller',
'modulework' => 'MODULEWorkInstaller',
'modxevo' => 'MODXEvoInstaller',
'moodle' => 'MoodleInstaller',
'october' => 'OctoberInstaller',
'oxid' => 'OxidInstaller',
'phpbb' => 'PhpBBInstaller',
'pimcore' => 'PimcoreInstaller',
'piwik' => 'PiwikInstaller',
'ppi' => 'PPIInstaller',
'puppet' => 'PuppetInstaller',
'redaxo' => 'RedaxoInstaller',
'roundcube' => 'RoundcubeInstaller',
'shopware' => 'ShopwareInstaller',
'silverstripe' => 'SilverStripeInstaller',
'smf' => 'SMFInstaller',
'symfony1' => 'Symfony1Installer',
'thelia' => 'TheliaInstaller',
'tusk' => 'TuskInstaller',
'typo3-cms' => 'TYPO3CmsInstaller',
'typo3-flow' => 'TYPO3FlowInstaller',
'whmcs' => 'WHMCSInstaller',
'wolfcms' => 'WolfCMSInstaller',
'wordpress' => 'WordPressInstaller',
'zend' => 'ZendInstaller',
'zikula' => 'ZikulaInstaller',
'prestashop' => 'PrestashopInstaller',
);
/**
* {@inheritDoc}
*/
public function getInstallPath(PackageInterface $package)
{
$type = $package->getType();
$frameworkType = $this->findFrameworkType($type);
if ($frameworkType === false) {
throw new \InvalidArgumentException(
'Sorry the package type of this package is not yet supported.'
);
}
$class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
$installer = new $class($package, $this->composer);
return $installer->getInstallPath($package, $frameworkType);
}
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
throw new \InvalidArgumentException('Package is not installed: '.$package);
}
$repo->removePackage($package);
$installPath = $this->getInstallPath($package);
$this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
}
/**
* {@inheritDoc}
*/
public function supports($packageType)
{
$frameworkType = $this->findFrameworkType($packageType);
if ($frameworkType === false) {
return false;
}
$locationPattern = $this->getLocationPattern($frameworkType);
return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1;
}
/**
* Finds a supported framework type if it exists and returns it
*
* @param string $type
* @return string
*/
protected function findFrameworkType($type)
{
$frameworkType = false;
krsort($this->supportedTypes);
foreach ($this->supportedTypes as $key => $val) {
if ($key === substr($type, 0, strlen($key))) {
$frameworkType = substr($type, 0, strlen($key));
break;
}
}
return $frameworkType;
}
/**
* Get the second part of the regular expression to check for support of a
* package type
*
* @param string $frameworkType
* @return string
*/
protected function getLocationPattern($frameworkType)
{
$pattern = false;
if (!empty($this->supportedTypes[$frameworkType])) {
$frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
/** @var BaseInstaller $framework */
$framework = new $frameworkClass(null, $this->composer);
$locations = array_keys($framework->getLocations());
$pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
}
return $pattern ? : '(\w+)';
}
}

View File

@ -1,15 +0,0 @@
<?php
namespace Composer\Installers;
class JoomlaInstaller extends BaseInstaller
{
protected $locations = array(
'component' => 'components/{$name}/',
'module' => 'modules/{$name}/',
'template' => 'templates/{$name}/',
'plugin' => 'plugins/{$name}/',
'library' => 'libraries/{$name}/',
);
// TODO: Add inflector for mod_ and com_ names
}

View File

@ -1,9 +0,0 @@
<?php
namespace Composer\Installers;
class KirbyInstaller extends BaseInstaller
{
protected $locations = array(
'plugin' => 'site/plugins/{$name}/',
);
}

View File

@ -1,9 +0,0 @@
<?php
namespace Composer\Installers;
class KohanaInstaller extends BaseInstaller
{
protected $locations = array(
'module' => 'modules/{$name}/',
);
}

View File

@ -1,9 +0,0 @@
<?php
namespace Composer\Installers;
class LaravelInstaller extends BaseInstaller
{
protected $locations = array(
'library' => 'libraries/{$name}/',
);
}

View File

@ -1,10 +0,0 @@
<?php
namespace Composer\Installers;
class LithiumInstaller extends BaseInstaller
{
protected $locations = array(
'library' => 'libraries/{$name}/',
'source' => 'libraries/_source/{$name}/',
);
}

Some files were not shown because too many files have changed in this diff Show More