Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release/1.0.0'

  • Loading branch information...
commit e53741df128f80a6caf0661573b1f901fa909033 2 parents 0760e65 + 99dbfb2
@everzet everzet authored
Showing with 4,179 additions and 1,642 deletions.
  1. +1 −1  .gitignore
  2. +10 −1 .gitmodules
  3. +17 −0 CHANGES.md
  4. +2 −4 autoload.php → autoload.php.dist
  5. +4 −12 behat.yml
  6. +17 −54 bin/release
  7. +26 −0 features/bootstrap/FeatureContext.php
  8. +2 −2 features/mink_feature.feature
  9. +3 −3 features/mink_feature_ru.feature
  10. +0 −13 features/support/bootstrap.php
  11. +0 −17 features/support/env.php
  12. +0 −63 package.xml.tpl
  13. +705 −0 src/Behat/Mink/Behat/Context/MinkContext.php
  14. +79 −0 src/Behat/Mink/Behat/Context/translations/es.xliff
  15. +32 −32 src/Behat/Mink/{Integration/steps/i18n → Behat/Context/translations}/fr.xliff
  16. +131 −0 src/Behat/Mink/Behat/Context/translations/ja.xliff
  17. +131 −0 src/Behat/Mink/Behat/Context/translations/ru.xliff
  18. +76 −0 src/Behat/Mink/ClassLoader/MapFileClassLoader.php
  19. +56 −28 src/Behat/Mink/ClassLoader/UniversalClassLoader.php
  20. +180 −0 src/Behat/Mink/Compiler/MapFileCompiler.php
  21. +244 −0 src/Behat/Mink/Compiler/PearCompiler.php
  22. +174 −0 src/Behat/Mink/Compiler/PharCompiler.php
  23. +87 −4 src/Behat/Mink/Driver/DriverInterface.php
  24. +162 −34 src/Behat/Mink/Driver/GoutteDriver.php
  25. +151 −33 src/Behat/Mink/Driver/SahiDriver.php
  26. +0 −174 src/Behat/Mink/Element/ActionableElement.php
  27. +4 −154 src/Behat/Mink/Element/DocumentElement.php
  28. +24 −27 src/Behat/Mink/Element/Element.php
  29. +19 −5 src/Behat/Mink/Element/ElementInterface.php
  30. +67 −38 src/Behat/Mink/Element/NodeElement.php
  31. +309 −0 src/Behat/Mink/Element/TraversableElement.php
  32. +7 −0 src/Behat/Mink/Exception/DriverException.php
  33. +56 −0 src/Behat/Mink/Exception/ElementHtmlException.php
  34. +30 −8 src/Behat/Mink/Exception/ElementNotFoundException.php
  35. +34 −0 src/Behat/Mink/Exception/ElementTextException.php
  36. +99 −1 src/Behat/Mink/Exception/Exception.php
  37. +45 −0 src/Behat/Mink/Exception/ExpectationException.php
  38. +33 −0 src/Behat/Mink/Exception/ResponseTextException.php
  39. +4 −4 src/Behat/Mink/Exception/{UnsupportedByDriverException.php → UnsupportedDriverActionException.php}
  40. +0 −107 src/Behat/Mink/Integration/MinkEnvironment.php
  41. +0 −79 src/Behat/Mink/Integration/steps/i18n/es.xliff
  42. +0 −103 src/Behat/Mink/Integration/steps/i18n/ja.xliff
  43. +0 −107 src/Behat/Mink/Integration/steps/i18n/ru.xliff
  44. +0 −175 src/Behat/Mink/Integration/steps/mink_steps.php
  45. +0 −26 src/Behat/Mink/Integration/support/hooks.php
  46. +25 −1 src/Behat/Mink/Mink.php
  47. +135 −0 src/Behat/Mink/PHPUnit/TestCase.php
  48. +3 −3 src/Behat/Mink/Selector/NamedSelector.php
  49. +1 −1  src/Behat/Mink/Selector/SelectorsHandler.php
  50. +78 −0 src/Behat/Mink/Session.php
  51. +0 −191 tests/Behat/Mink/Driver/DriverTest.php
  52. +339 −0 tests/Behat/Mink/Driver/GeneralDriverTest.php
  53. +7 −22 tests/Behat/Mink/Driver/GoutteDriverTest.php
  54. +30 −0 tests/Behat/Mink/Driver/HeadlessDriverTest.php
  55. +97 −0 tests/Behat/Mink/Driver/JavascriptDriverTest.php
  56. +9 −8 tests/Behat/Mink/Driver/SahiDriverTest.php
  57. +1 −1  tests/Behat/Mink/Driver/web-fixtures/advanced_form_post.php
  58. +30 −0 tests/Behat/Mink/Driver/web-fixtures/aria_roles.php
  59. +15 −0 tests/Behat/Mink/Driver/web-fixtures/cookie_page1.php
  60. +12 −0 tests/Behat/Mink/Driver/web-fixtures/cookie_page2.php
  61. +18 −0 tests/Behat/Mink/Driver/web-fixtures/cookie_page3.php
  62. +3 −0  tests/Behat/Mink/Driver/web-fixtures/headers.php
  63. +17 −0 tests/Behat/Mink/Driver/web-fixtures/index.php
  64. +18 −0 tests/Behat/Mink/Driver/web-fixtures/js/jquery-1.6.2-min.js
  65. +127 −0 tests/Behat/Mink/Driver/web-fixtures/js/jquery-ui-1.8.14.custom.min.js
  66. +84 −0 tests/Behat/Mink/Driver/web-fixtures/js_test.php
  67. +7 −0 tests/Behat/Mink/Driver/web-fixtures/json.php
  68. +2 −1  tests/Behat/Mink/Driver/web-fixtures/links.php
  69. +2 −0  tests/Behat/Mink/Driver/web-fixtures/print_cookies.php
  70. +12 −0 tests/Behat/Mink/Driver/web-fixtures/randomizer.php
  71. +3 −1 tests/Behat/Mink/Driver/web-fixtures/redirector.php
  72. +20 −0 tests/Behat/Mink/Driver/web-fixtures/session_test.php
  73. +38 −86 tests/Behat/Mink/Element/DocumentElementTest.php
  74. +12 −12 tests/Behat/Mink/Element/NodeElementTest.php
  75. +1 −1  tests/Behat/Mink/Selector/CssSelectorTest.php
  76. +5 −1 tests/bootstrap.php
  77. +1 −1  vendor/Buzz
  78. +1 −1  vendor/Goutte
  79. +1 −1  vendor/SahiClient
  80. +1 −0  vendor/Symfony/Component/BrowserKit
  81. +1 −1  vendor/Symfony/Component/CssSelector
  82. +1 −0  vendor/Symfony/Component/DomCrawler
  83. +1 −0  vendor/Symfony/Component/Process
View
2  .gitignore
@@ -1,3 +1,3 @@
*.tgz
+*.phar
phpunit.xml
-*.rb
View
11 .gitmodules
@@ -1,6 +1,6 @@
[submodule "vendor/Goutte"]
path = vendor/Goutte
- url = git://github.com/everzet/Goutte.git
+ url = git://github.com/fabpot/Goutte.git
[submodule "vendor/Symfony/Component/CssSelector"]
path = vendor/Symfony/Component/CssSelector
url = git://github.com/symfony/CssSelector.git
@@ -13,3 +13,12 @@
[submodule "vendor/Symfony/Component/Finder"]
path = vendor/Symfony/Component/Finder
url = git://github.com/symfony/Finder
+[submodule "vendor/Symfony/Component/BrowserKit"]
+ path = vendor/Symfony/Component/BrowserKit
+ url = git://github.com/symfony/BrowserKit.git
+[submodule "vendor/Symfony/Component/Process"]
+ path = vendor/Symfony/Component/Process
+ url = git://github.com/symfony/Process.git
+[submodule "vendor/Symfony/Component/DomCrawler"]
+ path = vendor/Symfony/Component/DomCrawler
+ url = git://github.com/symfony/DomCrawler.git
View
17 CHANGES.md
@@ -1,3 +1,20 @@
+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
==================
View
6 autoload.php → autoload.php.dist
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-define('BEHAT_MINK_PATH', __DIR__);
-
if (!class_exists('Behat\Mink\ClassLoader\UniversalClassLoader')) {
require_once __DIR__ . '/src/Behat/Mink/ClassLoader/UniversalClassLoader.php';
}
@@ -21,7 +19,7 @@
'Behat\SahiClient' => __DIR__ . '/vendor/SahiClient/src',
'Symfony\Component' => __DIR__ . '/vendor',
'Buzz' => __DIR__ . '/vendor/Buzz/lib',
+ 'Goutte' => __DIR__ . '/vendor/Goutte/src',
+ 'Zend' => __DIR__ . '/vendor/Goutte/vendor/zend/library',
));
$loader->register();
-
-require_once __DIR__ . '/vendor/Goutte/goutte.phar';
View
16 behat.yml
@@ -1,13 +1,5 @@
default:
- paths:
- steps:
- - %behat.paths.features%/steps
- - %%BEHAT_MINK_PATH%%/src/Behat/Mink/Integration/steps
- steps_i18n:
- - %behat.paths.features%/steps/i18n
- - %%BEHAT_MINK_PATH%%/src/Behat/Mink/Integration/steps/i18n
- hooks:
- - %behat.paths.support%/hooks.php
- - %%BEHAT_MINK_PATH%%/src/Behat/Mink/Integration/support/hooks.php
- environment:
- class: Behat\Mink\Integration\MinkEnvironment
+ context:
+ parameters:
+ base_url: http://test.mink.dev/
+ show_cmd: open %s
View
71 bin/release
@@ -17,70 +17,33 @@
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
-require_once __DIR__ . '/../autoload.php';
+require_once __DIR__ . '/../autoload.php.dist';
+
+use Behat\Mink\Compiler;
if (!isset($argv[1])) {
- throw new Exception('You must provide version.');
+ throw new RuntimeException('You must provide version.');
}
+$version = $argv[1];
if (!isset($argv[2])) {
- throw new Exception('You must provide stability status (alpha/beta/stable).');
+ throw new RuntimeException('You must provide stability status (alpha/beta/stable).');
}
-
-$version = $argv[1];
$stability = $argv[2];
-print sprintf("Releasing mink version \"%s\".\n", $version);
-
-if (is_file('package.xml')) {
- unlink(getcwd().'/package.xml');
-}
-
-copy(getcwd().'/package.xml.tpl', getcwd().'/package.xml');
-
-$dirs = array(
- 'features',
- 'src',
- 'vendor/Symfony/Component/CssSelector',
- 'vendor/SahiClient',
- 'vendor/Buzz'
-);
-
-$xmlSourceFiles = '';
-foreach ($dirs as $dir) {
- $finder = new Symfony\Component\Finder\Finder();
- $sourceFiles = $finder->files()->in($dir);
-
- foreach ($sourceFiles as $file) {
- $xmlSourceFiles .= '<file role="php" baseinstalldir="mink" install-as="'.$file->getPathName().'" name="'.$file->getPathName().'" />'."\n";
- }
-}
-
-function replaceTokens($files, $beginToken, $endToken, $tokens)
-{
- if (!is_array($files)) {
- $files = array($files);
- }
-
- foreach ($files as $file) {
- $content = file_get_contents($file);
- foreach ($tokens as $key => $value) {
- $content = str_replace($beginToken.$key.$endToken, $value, $content, $count);
- }
-
- file_put_contents($file, $content);
- }
-}
+$ldr = new Compiler\MapFileCompiler($autoloaderFilename = 'autoload.php', $mapFilename = 'autoload_map.php');
+$ldr->compile();
+echo "Autoloader compiled\n";
-replaceTokens(getcwd().'/package.xml', '##', '##', array(
- 'MINK_VERSION' => $version
- , 'CURRENT_DATE' => date('Y-m-d')
- , 'SOURCE_FILES' => $xmlSourceFiles
- , 'STABILITY' => $stability
-));
+$pear = new Compiler\PearCompiler();
+$pear->compile($version, $stability);
+echo "PEAR package compiled: mink-$version.tgz\n";
-system('pear package');
+$phar = new Compiler\PharCompiler();
+$phar->compile($version);
+echo "PHAR package compiled: mink-$version.phar\n";
-unlink(getcwd().'/package.xml');
+unlink($autoloaderFilename);
+unlink($mapFilename);
exit(0);
View
26 features/bootstrap/FeatureContext.php
@@ -0,0 +1,26 @@
+<?php
+
+use Behat\Behat\Context\ClosuredContextInterface,
+ Behat\Behat\Context\TranslatedContextInterface,
+ Behat\Behat\Context\BehatContext,
+ Behat\Behat\Exception\Pending;
+
+use Behat\Gherkin\Node\PyStringNode,
+ Behat\Gherkin\Node\TableNode;
+
+if (file_exists(__DIR__ . '/../../autoload.php')) {
+ require_once __DIR__ . '/../../autoload.php';
+} else {
+ require_once __DIR__ . '/../../autoload.php.dist';
+}
+
+/**
+ * Features context.
+ */
+class FeatureContext extends BehatContext
+{
+ public function __construct(array $parameters)
+ {
+ $this->useContext(new Behat\Mink\Behat\Context\MinkContext($parameters));
+ }
+}
View
4 features/mink_feature.feature
@@ -5,7 +5,7 @@ Feature: Mink steps
@javascript
Scenario: Basic form (through Sahi)
- Given I am on basic_form.php
+ Given I am on "basic_form.php"
When I fill in "first_name" with "Konstantin"
And I fill in "Kudryashov" for "lastn"
And I press "Save"
@@ -13,7 +13,7 @@ Feature: Mink steps
And I should see "Lastname: Kudryashov"
Scenario: Basic form (through Goutte)
- Given I am on basic_form.php
+ Given I am on "basic_form.php"
When I fill in "first_name" with "Konstantin"
And I fill in "lastn" with "Kudryashov"
And I press "Save"
View
6 features/mink_feature_ru.feature
@@ -6,7 +6,7 @@
@javascript
Сценарий: Стандартная форма (через Sahi)
- Допустим я на странице basic_form.php
+ Допустим я на странице "basic_form.php"
Когда я ввожу "Konstantin" в поле "first_name"
И ввожу "Kudryashov" в поле "lastn"
И я нажимаю "Save"
@@ -14,8 +14,8 @@
И я должен видеть "Lastname: Kudryashov"
Сценарий: Стандартная форма (через Goutte)
- Допустим я на странице basic_form.php
- Когда я заполняю поле "first_name" значением "Konstantin"
+ Допустим я на странице "basic_form.php"
+ Когда я заполняю поле "first_name" значением "Konstantin"
И заполняю поле "lastn" значением "Kudryashov"
И нажимаю "Save"
Тогда я должен видеть "Anket for Konstantin"
View
13 features/support/bootstrap.php
@@ -1,13 +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.
- */
-
-require_once __DIR__ . '/../../autoload.php';
-require_once 'PHPUnit/Autoload.php';
-require_once 'PHPUnit/Framework/Assert/Functions.php';
View
17 features/support/env.php
@@ -1,17 +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.
- */
-
-// overwrite start_url parameter (this is a hack for Mink internal testing - use behat env params instead)
-$world->setParameter('start_url', 'http://test.mink.loc/');
-
-// redefine getPathTo method
-$world->getPathTo = function($path) use($world) {
- return $world->getParameter('start_url') . $path;
-};
View
63 package.xml.tpl
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<package packagerversion="1.8.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
- http://pear.php.net/dtd/tasks-1.0.xsd
- http://pear.php.net/dtd/package-2.0
- http://pear.php.net/dtd/package-2.0.xsd">
- <name>mink</name>
- <channel>pear.behat.org</channel>
- <summary>Behat\Mink is an browser emulation framework for PHP</summary>
- <description>
- Behat\Mink is an open source browser emulation framework for php 5.3.
- </description>
- <lead>
- <name>Konstantin Kudryashov</name>
- <user>everzet</user>
- <email>ever.zet@gmail.com</email>
- <active>yes</active>
- </lead>
- <date>##CURRENT_DATE##</date>
- <version>
- <release>##MINK_VERSION##</release>
- <api>1.0.0</api>
- </version>
- <stability>
- <release>##STABILITY##</release>
- <api>##STABILITY##</api>
- </stability>
- <license uri="http://www.opensource.org/licenses/mit-license.php">MIT</license>
- <notes>-</notes>
- <contents>
- <dir name="/">
-
- ##SOURCE_FILES##
-
- <file role="php" baseinstalldir="mink" name="autoload.php" />
- <file role="php" baseinstalldir="mink" name="behat.yml" />
- <file role="php" baseinstalldir="mink" name="CHANGES.md" />
- <file role="php" baseinstalldir="mink" name="LICENSE" />
- <file role="php" baseinstalldir="mink" name="README.md" />
- <file role="php" baseinstalldir="mink" install-as="vendor/Goutte/goutte.phar" name="vendor/Goutte/goutte.phar" />
-
- </dir>
- </contents>
- <dependencies>
- <required>
- <php>
- <min>5.3.1</min>
- </php>
- <pearinstaller>
- <min>1.4.0</min>
- </pearinstaller>
- <extension>
- <name>pcre</name>
- </extension>
- <extension>
- <name>simplexml</name>
- </extension>
- <extension>
- <name>xml</name>
- </extension>
- </required>
- </dependencies>
- <phprelease />
-</package>
View
705 src/Behat/Mink/Behat/Context/MinkContext.php
@@ -0,0 +1,705 @@
+<?php
+
+namespace Behat\Mink\Behat\Context;
+
+use Behat\Gherkin\Node\TableNode;
+
+use Behat\Behat\Context\TranslatedContextInterface,
+ Behat\Behat\Context\BehatContext,
+ Behat\Behat\Event\ScenarioEvent;
+
+use Behat\Mink\Mink,
+ Behat\Mink\Session,
+ Behat\Mink\Driver\GoutteDriver,
+ Behat\Mink\Driver\SahiDriver,
+ Behat\Mink\Exception\ElementNotFoundException,
+ Behat\Mink\Exception\ExpectationException,
+ Behat\Mink\Exception\ResponseTextException,
+ Behat\Mink\Exception\ElementHtmlException,
+ Behat\Mink\Exception\ElementTextException;
+
+use Goutte\Client as GoutteClient;
+
+use Behat\SahiClient\Connection as SahiConnection,
+ Behat\SahiClient\Client as SahiClient;
+
+require_once 'PHPUnit/Autoload.php';
+require_once 'PHPUnit/Framework/Assert/Functions.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.
+ */
+
+/**
+ * Mink context for Behat testing tool.
+ *
+ * @author Konstantin Kudryashov <ever.zet@gmail.com>
+ */
+class MinkContext extends BehatContext implements TranslatedContextInterface
+{
+ private static $minkInstance;
+ private $parameters;
+
+ /**
+ * Initializes Mink environment.
+ *
+ * @param array $parameters list of context parameters
+ */
+ public function __construct(array $parameters = array())
+ {
+ $this->parameters = array_merge(array(
+ 'default_session' => 'goutte',
+ 'base_url' => 'http://localhost',
+ 'show_cmd' => null,
+ 'browser' => 'firefox',
+ 'goutte' => array(
+ 'zend_config' => array(),
+ 'server_parameters' => array()
+ ),
+ 'sahi' => array(
+ 'sid' => null,
+ 'host' => 'localhost',
+ 'port' => 9999
+ )
+ ), $parameters);
+
+ if (null === self::$minkInstance) {
+ self::$minkInstance = new Mink();
+ }
+
+ $this->registerSessions(self::$minkInstance);
+ }
+
+ /**
+ * Locates url, based on provided path.
+ *
+ * @param string $path
+ *
+ * @return string
+ */
+ public function locatePath($path)
+ {
+ $startUrl = rtrim($this->getParameter('base_url'), '/') . '/';
+
+ return 0 !== strpos('http', $path) ? $startUrl . ltrim($path, '/') : $path;
+ }
+
+ /**
+ * Returns Mink instance.
+ *
+ * @return Behat\Mink\Mink
+ */
+ public function getMink()
+ {
+ if (null === self::$minkInstance) {
+ throw new \RuntimeException(
+ 'Mink is not initialized. Forgot to call parent context constructor?'
+ );
+ }
+
+ return self::$minkInstance;
+ }
+
+ /**
+ * Returns current Mink session.
+ *
+ * @param string|null name of the session OR active session will be used
+ *
+ * @return Behat\Mink\Session
+ */
+ public function getSession($name = null)
+ {
+ return $this->getMink()->getSession($name);
+ }
+
+ /**
+ * Returns all context parameters.
+ *
+ * @return array
+ */
+ public function getParameters()
+ {
+ return $this->parameters;
+ }
+
+ /**
+ * Returns context parameter.
+ *
+ * @param string $name
+ *
+ * @return mixed
+ */
+ public function getParameter($name)
+ {
+ if (!isset($this->parameters[$name])) {
+ return;
+ }
+
+ return $this->parameters[$name];
+ }
+
+ /**
+ * Opens specified page.
+ *
+ * @Given /^(?:|I )am on "(?P<page>[^"]+)"$/
+ * @When /^(?:|I )go to "(?P<page>[^"]+)"$/
+ */
+ public function visit($page)
+ {
+ $this->getSession()->visit($this->locatePath($page));
+ }
+
+ /**
+ * Reloads current page.
+ *
+ * @When /^(?:|I )reload the page$/
+ */
+ public function reload()
+ {
+ $this->getSession()->reload();
+ }
+
+ /**
+ * Moves backward one page in history.
+ *
+ * @When /^(?:|I )move backward one page$/
+ */
+ public function back()
+ {
+ $this->getSession()->back();
+ }
+
+ /**
+ * Moves forward one page in history
+ *
+ * @When /^(?:|I )move forward one page$/
+ */
+ public function forward()
+ {
+ $this->getSession()->forward();
+ }
+
+ /**
+ * Presses button with specified id|name|title|alt|value.
+ *
+ * @When /^(?:|I )press "(?P<button>(?:[^"]|\\")*)"$/
+ */
+ public function pressButton($button)
+ {
+ $button = str_replace('\\"', '"', $button);
+ $this->getSession()->getPage()->pressButton($button);
+ }
+
+ /**
+ * Clicks link with specified id|title|alt|text.
+ *
+ * @When /^(?:|I )follow "(?P<link>(?:[^"]|\\")*)"$/
+ */
+ public function clickLink($link)
+ {
+ $link = str_replace('\\"', '"', $link);
+ $this->getSession()->getPage()->clickLink($link);
+ }
+
+ /**
+ * Fills in form field with specified id|name|label|value.
+ *
+ * @When /^(?:|I )fill in "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/
+ * @When /^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/
+ */
+ public function fillField($field, $value)
+ {
+ $field = str_replace('\\"', '"', $field);
+ $value = str_replace('\\"', '"', $value);
+ $this->getSession()->getPage()->fillField($field, $value);
+ }
+
+ /**
+ * Fills in form fields with provided table.
+ *
+ * @When /^(?:|I )fill in the following:$/
+ */
+ public function fillFields(TableNode $fields)
+ {
+ foreach ($fields->getRowsHash() as $field => $value) {
+ $this->fillField($field, $value);
+ }
+ }
+
+ /**
+ * Selects option in select field with specified id|name|label|value.
+ *
+ * @When /^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/
+ */
+ public function selectOption($select, $option)
+ {
+ $select = str_replace('\\"', '"', $select);
+ $option = str_replace('\\"', '"', $option);
+ $this->getSession()->getPage()->selectFieldOption($select, $option);
+ }
+
+ /**
+ * Checks checkbox with specified id|name|label|value.
+ *
+ * @When /^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/
+ */
+ public function checkOption($option)
+ {
+ $option = str_replace('\\"', '"', $option);
+ $this->getSession()->getPage()->checkField($option);
+ }
+
+ /**
+ * Unchecks checkbox with specified id|name|label|value.
+ *
+ * @When /^(?:|I )uncheck "(?P<option>(?:[^"]|\\")*)"$/
+ */
+ public function uncheckOption($option)
+ {
+ $option = str_replace('\\"', '"', $option);
+ $this->getSession()->getPage()->uncheckField($option);
+ }
+
+ /**
+ * Attaches file to field with specified id|name|label|value.
+ *
+ * @When /^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|\\")*)"$/
+ */
+ public function attachFileToField($field, $path)
+ {
+ $field = str_replace('\\"', '"', $field);
+ $this->getSession()->getPage()->attachFileToField($field, $path);
+ }
+
+ /**
+ * Checks, that current page PATH is equal to specified.
+ *
+ * @Then /^(?:|I )should be on "(?P<page>[^"]+)"$/
+ */
+ public function assertPageAddress($page)
+ {
+ $expected = parse_url($this->locatePath($page), PHP_URL_PATH);
+ $expected = preg_replace('/^\/[^\.\/]+\.php/', '', $expected);
+
+ $actual = parse_url($this->getSession()->getCurrentUrl(), PHP_URL_PATH);
+ $actual = preg_replace('/^\/[^\.\/]+\.php/', '', $actual);
+
+ try {
+ assertEquals($expected, $actual);
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('Current page is "%s", but "%s" expected', $actual, $expected);
+ throw new ExpectationException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that current page PATH matches regular expression.
+ *
+ * @Then /^the url should match "(?P<pattern>(?:[^"]|\\")*)"$/
+ */
+ public function assertUrlRegExp($pattern)
+ {
+ $pattern = str_replace('\\"', '"', $pattern);
+ if (!preg_match('/^\/.*\/$/', $pattern)) {
+ $this->assertPageAddress($pattern);
+
+ return;
+ }
+
+ $actual = parse_url($this->getSession()->getCurrentUrl(), PHP_URL_PATH);
+ try {
+ assertRegExp($pattern, $actual);
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('Current page "%s" does not match the pattern "%s"', $actual, $pattern);
+ throw new ExpectationException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that current page response status is equal to specified.
+ *
+ * @Then /^the response status code should be (?P<code>\d+)$/
+ */
+ public function assertResponseStatus($code)
+ {
+ $actual = $this->getSession()->getStatusCode();
+ try {
+ assertEquals($actual, $code);
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('Current response status code is %d, but %d expected', $actual, $code);
+ throw new ExpectationException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that page contains specified text.
+ *
+ * @Then /^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/
+ */
+ public function assertPageContainsText($text)
+ {
+ $expected = str_replace('\\"', '"', $text);
+ $actual = $this->getSession()->getPage()->getText();
+
+ try {
+ assertContains($expected, $actual);
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('The text "%s" was not found anywhere in the text of the current page', $expected);
+ throw new ResponseTextException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that page doesn't contains specified text.
+ *
+ * @Then /^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/
+ */
+ public function assertPageNotContainsText($text)
+ {
+ $expected = str_replace('\\"', '"', $text);
+ $actual = $this->getSession()->getPage()->getText();
+
+ try {
+ assertNotContains($expected, $actual);
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('The text "%s" appears in the text of this page, but it should not.', $expected);
+ throw new ResponseTextException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that HTML response contains specified string.
+ *
+ * @Then /^the response should contain "(?P<text>(?:[^"]|\\")*)"$/
+ */
+ public function assertResponseContains($text)
+ {
+ $expected = str_replace('\\"', '"', $text);
+ $actual = $this->getSession()->getPage()->getContent();
+
+ try {
+ assertContains($expected, $actual);
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('The string "%s" was not found anywhere in the HTML response of the current page', $expected);
+ throw new ExpectationException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that HTML response doesn't contains specified string.
+ *
+ * @Then /^the response should not contain "(?P<text>(?:[^"]|\\")*)"$/
+ */
+ public function assertResponseNotContains($text)
+ {
+ $expected = str_replace('\\"', '"', $text);
+ $actual = $this->getSession()->getPage()->getContent();
+
+ try {
+ assertNotContains($expected, $actual);
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('The string "%s" appears in the HTML response of this page, but it should not.', $expected);
+ throw new ExpectationException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that element with specified CSS contains specified text.
+ *
+ * @Then /^(?:|I )should see "(?P<text>(?:[^"]|\\")*)" in the "(?P<element>[^"]*)" element$/
+ */
+ public function assertElementContainsText($element, $text)
+ {
+ $node = $this->getSession()->getPage()->find('css', $element);
+ $text = str_replace('\\"', '"', $text);
+
+ if (null === $node) {
+ throw new ElementNotFoundException(
+ $this->getSession(), 'element', 'css', $element
+ );
+ }
+
+ try {
+ assertContains($text, $node->getText());
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('The text "%s" was not found in the text of the element matching css "%s"', $text, $element);
+ throw new ElementTextException($message, $this->getSession(), $node, $e);
+ }
+ }
+
+ /**
+ * Checks, that element with specified CSS contains specified HTML.
+ *
+ * @Then /^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|\\")*)"$/
+ */
+ public function assertElementContains($element, $value)
+ {
+ $node = $this->getSession()->getPage()->find('css', $element);
+ $value = str_replace('\\"', '"', $value);
+
+ if (null === $node) {
+ throw new ElementNotFoundException(
+ $this->getSession(), 'element', 'css', $element
+ );
+ }
+
+ try {
+ assertContains($value, $node->getHtml());
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('The string "%s" was not found in the contents of the element matching css "%s"', $value, $element);
+ throw new ElementHtmlException($message, $this->getSession(), $node, $e);
+ }
+ }
+
+ /**
+ * Checks, that element with specified CSS exists on page.
+ *
+ * @Then /^(?:|I )should see an? "(?P<element>[^"]*)" element$/
+ */
+ public function assertElementOnPage($element)
+ {
+ $node = $this->getSession()->getPage()->find('css', $element);
+
+ if (null === $node) {
+ throw new ElementNotFoundException(
+ $this->getSession(), 'element', 'css', $element
+ );
+ }
+ }
+
+ /**
+ * Checks, that element with specified CSS doesn't exists on page.
+ *
+ * @Then /^(?:|I )should not see an? "(?P<element>[^"]*)" element$/
+ */
+ public function assertElementNotOnPage($element)
+ {
+ try {
+ assertNull($this->getSession()->getPage()->find('css', $element));
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('An element matching css "%s" appears on this page, but it should not.', $element);
+ throw new ExpectationException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that form field with specified id|name|label|value has specified value.
+ *
+ * @Then /^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/
+ */
+ public function assertFieldContains($field, $value)
+ {
+ $field = str_replace('\\"', '"', $field);
+ $field = $this->getSession()->getPage()->findField($field);
+ $value = str_replace('\\"', '"', $value);
+
+ if (null === $field) {
+ throw new ElementNotFoundException(
+ $this->getSession(), 'form field', 'id|name|label|value', $field
+ );
+ }
+
+ try {
+ assertEquals($value, $field->getValue());
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('Form field with id|name|label|value "%s" has "%s" value, but should have "%s"', $element, $field->getValue(), $value);
+ throw new ExpectationException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that form field with specified id|name|label|value doesn't have specified value.
+ *
+ * @Then /^the "(?P<field>(?:[^"]|\\")*)" field should not contain "(?P<value>(?:[^"]|\\")*)"$/
+ */
+ public function assertFieldNotContains($field, $value)
+ {
+ $field = str_replace('\\"', '"', $field);
+ $field = $this->getSession()->getPage()->findField($field);
+ $value = str_replace('\\"', '"', $value);
+
+ if (null === $field) {
+ throw new ElementNotFoundException(
+ $this->getSession(), 'form field', 'id|name|label|value', $field
+ );
+ }
+
+ try {
+ assertNotEquals($value, $field->getValue());
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('Form field with id|name|label|value "%s" has "%s" value, but it should not have that value', $element, $field->getValue());
+ throw new ExpectationException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that checkbox with specified in|name|label|value is checked.
+ *
+ * @Then /^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should be checked$/
+ */
+ public function assertCheckboxChecked($checkbox)
+ {
+ $checkbox = str_replace('\\"', '"', $checkbox);
+ $field = $this->getSession()->getPage()->findField($checkbox);
+
+ if (null === $field) {
+ throw new ElementNotFoundException(
+ $this->getSession(), 'form field', 'id|name|label|value', $field
+ );
+ }
+
+ try {
+ assertTrue($field->isChecked());
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('Checkbox with id|name|label|value "%s" is not checked, but it should be', $element);
+ throw new ExpectationException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that checkbox with specified in|name|label|value is unchecked.
+ *
+ * @Then /^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should not be checked$/
+ */
+ public function assertCheckboxNotChecked($checkbox)
+ {
+ $checkbox = str_replace('\\"', '"', $checkbox);
+ $field = $this->getSession()->getPage()->findField($checkbox);
+
+ if (null === $field) {
+ throw new ElementNotFoundException(
+ $this->getSession(), 'form field', 'id|name|label|value', $field
+ );
+ }
+
+ try {
+ assertFalse($field->isChecked());
+ } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
+ $message = sprintf('Checkbox with id|name|label|value "%s" is checked, but it should not be', $element);
+ throw new ExpectationException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Prints last response to console.
+ *
+ * @Then /^print last response$/
+ */
+ public function printLastResponse()
+ {
+ $this->printDebug(
+ $this->getSession()->getCurrentUrl()."\n\n".
+ $this->getSession()->getPage()->getContent()
+ );
+ }
+
+ /**
+ * Opens last response content in browser.
+ *
+ * @Then /^show last response$/
+ */
+ public function showLastResponse()
+ {
+ if (null === $this->getParameter('show_cmd')) {
+ throw new \RuntimeException('Set "show_cmd" parameter in behat.yml to be able to open page in browser (ex.: "show_cmd: firefox %s")');
+ }
+
+ $filename = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid().'.html';
+ file_put_contents($filename, $this->getSession()->getPage()->getContent());
+ system(sprintf($this->getParameter('show_cmd'), $filename));
+ }
+
+ /**
+ * @BeforeScenario
+ */
+ public function prepareMinkSession($event)
+ {
+ $scenario = $event instanceof ScenarioEvent ? $event->getScenario() : $event->getOutline();
+ $session = $this->getParameter('default_session');
+
+ foreach ($scenario->getTags() as $tag) {
+ if ('javascript' === $tag) {
+ $session = 'sahi';
+ } elseif (preg_match('/^mink\:(.+)/', $tag, $matches)) {
+ $session = $matches[1];
+ }
+ }
+
+ if ($scenario->hasTag('insulated')) {
+ $this->getMink()->restartSessions();
+ } else {
+ $this->getMink()->resetSessions();
+ }
+
+ $this->getMink()->setDefaultSessionName($session);
+ }
+
+ /**
+ * Returns list of definition translation resources paths.
+ *
+ * @return array
+ */
+ public function getTranslationResources()
+ {
+ return array(
+ __DIR__ . '/translations/ru.xliff',
+ __DIR__ . '/translations/fr.xliff',
+ __DIR__ . '/translations/ja.xliff',
+ __DIR__ . '/translations/es.xliff',
+ );
+ }
+
+ /**
+ * Registers Mink sessions on it's initialization.
+ *
+ * @param Behat\Mink\Mink $mink Mink manager instance
+ */
+ protected function registerSessions(Mink $mink)
+ {
+ if (!$mink->hasSession('goutte')) {
+ $params = $this->getParameter('goutte');
+ $mink->registerSession('goutte', static::initGoutteSession(
+ $params['zend_config'], $params['server_parameters']
+ ));
+ }
+
+ if (!$mink->hasSession('sahi')) {
+ $params = $this->getParameter('sahi');
+ $mink->registerSession('sahi', static::initSahiSession(
+ $this->getParameter('browser'), $params['sid'], $params['host'], $params['port']
+ ));
+ }
+ }
+
+ /**
+ * Initizalizes and returns new GoutteDriver session.
+ *
+ * @param array $zendConfig zend config parameters
+ * @param array $serverParameters server parameters
+ *
+ * @return Behat\Mink\Session
+ */
+ protected static function initGoutteSession(array $zendConfig = array(), array $serverParameters = array())
+ {
+ return new Session(new GoutteDriver(new GoutteClient($zendConfig, $serverParameters)));
+ }
+
+ /**
+ * Initizalizes and returns new SahiDriver session.
+ *
+ * @param string $browser browser name to use (default = firefox)
+ * @param array $sid sahi SID
+ * @param string $host sahi proxy host
+ * @param integer $port port number
+ *
+ * @return Behat\Mink\Session
+ */
+ protected static function initSahiSession($browser = 'firefox', $sid = null, $host = 'localhost', $port = 9999)
+ {
+ return new Session(new SahiDriver($browser, new SahiClient(new SahiConnection($sid, $host, $port))));
+ }
+}
View
79 src/Behat/Mink/Behat/Context/translations/es.xliff
@@ -0,0 +1,79 @@
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+ <file original="global" source-language="en" target-language="es" datatype="plaintext">
+ <header />
+ <body>
+ <trans-unit id="i-am-on-page">
+ <source><![CDATA[/^(?:|I )am on (?P<page>.+)$/]]></source>
+ <target><![CDATA[/^(?:|Yo )estoy en (?P<page>.+)$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-go-to-page">
+ <source><![CDATA[/^(?:|I )go to (?P<page>.+)$/]]></source>
+ <target><![CDATA[/^(?:|Yo )voy a (?P<page>.+)$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-press-button">
+ <source><![CDATA[/^(?:|I )press "(?P<button>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|Yo )presiono "(?P<button>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-follow-link">
+ <source><![CDATA[/^(?:|I )follow "(?P<link>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|Yo )sigo "(?P<link>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-field-with-value">
+ <source><![CDATA[/^(?:|I )fill in "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|Yo )relleno "(?P<field>(?:[^"]|\\")*)" con "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-value-for-field">
+ <source><![CDATA[/^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|Yo )relleno "(?P<value>(?:[^"]|\\")*)" para "(?P<field>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-the-following">
+ <source><![CDATA[/^(?:|I )fill in the following:$/]]></source>
+ <target><![CDATA[/^(?:|Yo )relleno el siguiente:$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-select-option-from-select">
+ <source><![CDATA[/^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|Yo )selecciono "(?P<option>(?:[^"]|\\")*)" desde "(?P<select>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-check-option">
+ <source><![CDATA[/^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|Yo )chequeo "(?P<option>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-uncheck-option">
+ <source><![CDATA[/^(?:|I )uncheck "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|Yo )dechequeo "(?P<option>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-attach-the-file-to-field">
+ <source><![CDATA[/^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|Yo )adjunto el archivo "(?P<path>[^"]*)" a "(?P<field>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-text">
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|Yo )debo ver "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-text">
+ <source><![CDATA[/^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|Yo )no debo ver "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^el campo "(?P<field>(?:[^"]|\\")*)" debe contener "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-not-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should not contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^el campo "(?P<field>(?:[^"]|\\")*)" no debe contener "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should be checked$/]]></source>
+ <target><![CDATA[/^el checkbox "(?P<checkbox>[^"]*) debe estar seleccionado" $/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-not-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should not be checked$/]]></source>
+ <target><![CDATA[/^el checkbox "(?P<checkbox>(?:[^"]|\\")*)" no debe estar seleccionado$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-be-on-page">
+ <source><![CDATA[/^(?:|I )should be on (?P<page>.+)$/]]></source>
+ <target><![CDATA[/^(?:|Yo )debo estar en (?P<page>.+)$/]]></target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
View
64 ...ehat/Mink/Integration/steps/i18n/fr.xliff → .../Mink/Behat/Context/translations/fr.xliff
@@ -11,75 +11,75 @@
<target><![CDATA[/^(?:|je )vais sur (?P<page>.+)$/]]></target>
</trans-unit>
<trans-unit id="i-press-button">
- <source><![CDATA[/^(?:|I )press "(?P<button>[^"]*)"$/]]></source>
- <target><![CDATA[/^(?:|je )presse "(?P<button>[^"]*)"$/]]></target>
+ <source><![CDATA[/^(?:|I )press "(?P<button>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|je )presse "(?P<button>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="i-follow-link">
- <source><![CDATA[/^(?:|I )follow "(?P<link>[^"]*)"$/]]></source>
- <target><![CDATA[/^(?:|je )suis "(?P<link>[^"]*)"$/]]></target>
+ <source><![CDATA[/^(?:|I )follow "(?P<link>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|je )suis "(?P<link>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="i-fill-in-field-with-value">
- <source><![CDATA[/^(?:|I )fill in "(?P<field>[^"]*)" with "(?P<value>[^"]*)"$/]]></source>
- <target><![CDATA[/^(?:|je )remplis "(?P<field>[^"]*)" avec "(?P<value>[^"]*)"$/]]></target>
+ <source><![CDATA[/^(?:|I )fill in "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|je )remplis "(?P<field>(?:[^"]|\\")*)" avec "(?P<value>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="i-fill-in-value-for-field">
- <source><![CDATA[/^(?:|I )fill in "(?P<value>[^"]*)" for "(?P<field>[^"]*)"$/]]></source>
- <target><![CDATA[/^(?:|je )remplis "(?P<value>[^"]*)" pour "(?P<field>[^"]*)"$/]]></target>
+ <source><![CDATA[/^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|je )remplis "(?P<value>(?:[^"]|\\")*)" pour "(?P<field>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="i-fill-in-the-following">
<source><![CDATA[/^(?:|I )fill in the following:$/]]></source>
<target><![CDATA[/^(?:|je )remplis le texte suivant:$/]]></target>
</trans-unit>
<trans-unit id="i-select-option-from-select">
- <source><![CDATA[/^(?:|I )select "(?P<option>[^"]*)" from "(?P<select>[^"]*)"$/]]></source>
- <target><![CDATA[/^(?:|je )sélectionne "(?P<option>[^"]*)" depuis "(?P<select>[^"]*)"$/]]></target>
+ <source><![CDATA[/^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|je )sélectionne "(?P<option>(?:[^"]|\\")*)" depuis "(?P<select>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="i-check-option">
- <source><![CDATA[/^(?:|I )check "(?P<option>[^"]*)"$/]]></source>
- <target><![CDATA[/^(?:|je )coche "(?P<option>[^"]*)"$/]]></target>
+ <source><![CDATA[/^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|je )coche "(?P<option>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="i-uncheck-option">
- <source><![CDATA[/^(?:|I )uncheck "(?P<option>[^"]*)"$/]]></source>
- <target><![CDATA[/^(?:|je )décoche "(?P<option>[^"]*)"$/]]></target>
+ <source><![CDATA[/^(?:|I )uncheck "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|je )décoche "(?P<option>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="i-attach-the-file-to-field">
- <source><![CDATA[/^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>[^"]*)"$/]]></source>
- <target><![CDATA[/^(?:|j' )attache le fichier "(?P<path>[^"]*)" à "(?P<field>[^"]*)"$/]]></target>
+ <source><![CDATA[/^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|j' )attache le fichier "(?P<path>[^"]*)" à "(?P<field>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="i-should-see-text">
- <source><![CDATA[/^(?:|I )should see "(?P<text>[^"]*)"$/]]></source>
- <target><![CDATA[/^(?:|je )devrais voir "(?P<text>[^"]*)"$/]]></target>
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|je )devrais voir "(?P<text>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="i-should-not-see-text">
- <source><![CDATA[/^(?:|I )should not see "(?P<text>[^"]*)"$/]]></source>
- <target><![CDATA[/^(?:|je )ne devrais pas voir "(?P<text>[^"]*)"$/]]></target>
+ <source><![CDATA[/^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|je )ne devrais pas voir "(?P<text>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="the-field-should-contain-value">
- <source><![CDATA[/^the "(?P<field>[^"]*)" field should contain "(?P<value>[^"]*)"$/]]></source>
- <target><![CDATA[/^le champ "(?P<field>[^"]*)" devrait contenir "(?P<value>[^"]*)"$/]]></target>
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^le champ "(?P<field>(?:[^"]|\\")*)" devrait contenir "(?P<value>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="the-field-should-not-contain-value">
- <source><![CDATA[/^the "(?P<field>[^"]*)" field should not contain "(?P<value>[^"]*)"$/]]></source>
- <target><![CDATA[/^le champ "(?P<field>[^"]*)" ne devrait pas contenir "(?P<value>[^"]*)"$/]]></target>
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should not contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^le champ "(?P<field>(?:[^"]|\\")*)" ne devrait pas contenir "(?P<value>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="the-checkbox-should-be-checked">
- <source><![CDATA[/^the "(?P<checkbox>[^"]*)" checkbox should be checked$/]]></source>
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should be checked$/]]></source>
<target><![CDATA[/^la case à cocher "(?P<checkbox>[^"]*) devrait être cochée" $/]]></target>
</trans-unit>
<trans-unit id="the-checkbox-should-not-be-checked">
- <source><![CDATA[/^the "(?P<checkbox>[^"]*)" checkbox should not be checked$/]]></source>
- <target><![CDATA[/^la case à cocher "(?P<checkbox>[^"]*)" ne devrait pas être cochée$/]]></target>
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should not be checked$/]]></source>
+ <target><![CDATA[/^la case à cocher "(?P<checkbox>(?:[^"]|\\")*)" ne devrait pas être cochée$/]]></target>
</trans-unit>
<trans-unit id="i-should-be-on-page">
<source><![CDATA[/^(?:|I )should be on (?P<page>.+)$/]]></source>
<target><![CDATA[/^(?:|je )devrais être sur (?P<page>.+)$/]]></target>
</trans-unit>
<trans-unit id="the-element-should-contain">
- <source><![CDATA[/^the "(?P<element>[^"]*)" element should contain "(?P<value>[^"]*)"$/]]></source>
- <target><![CDATA[/^l'élement "(?P<element>[^"]*)" devrait contenir "(?P<value>[^"]*)"$/]]></target>
+ <source><![CDATA[/^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^l'élement "(?P<element>[^"]*)" devrait contenir "(?P<value>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="i-should-see-element">
- <source><![CDATA[/^(?:|I )should see "(?P<element>[^"]*)" element$/]]></source>
+ <source><![CDATA[/^(?:|I )should see an? "(?P<element>[^"]*)" element$/]]></source>
<target><![CDATA[/^(?:|je )devrais voir l'élement "(?P<element>[^"]*)"$/]]></target>
</trans-unit>
<trans-unit id="the-element-should-link-to">
@@ -87,8 +87,8 @@
<target><![CDATA[/^l'élement "(?P<element>[^"]*)" devrait pointer vers (?P<href>.*)$/]]></target>
</trans-unit>
<trans-unit id="the-element-should-have-attribute-of">
- <source><![CDATA[/^the "(?P<element>[^"]*)" element should have a "(?P<attribute>[a-zA-Z\-\_]*)" attribute of "(?P<value>[^"]*)"$/]]></source>
- <target><![CDATA[/^l'élement "(?P<element>[^"]*)" devrait avoir un attribut "(?P<attribute>[a-zA-Z\-\_]*)" de valeur "(?P<value>[^"]*)"$/]]></target>
+ <source><![CDATA[/^the "(?P<element>[^"]*)" element should have a "(?P<attribute>[a-zA-Z\-\_]*)" attribute of "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^l'élement "(?P<element>[^"]*)" devrait avoir un attribut "(?P<attribute>[a-zA-Z\-\_]*)" de valeur "(?P<value>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
<trans-unit id="">
<source><![CDATA[/the response status code should be (?P<code>\d+)/]]></source>
View
131 src/Behat/Mink/Behat/Context/translations/ja.xliff
@@ -0,0 +1,131 @@
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+ <file original="global" source-language="en" target-language="ja" datatype="plaintext">
+ <header />
+ <body>
+ <trans-unit id="i-am-on-page">
+ <source><![CDATA[/^(?:|I )am on "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーは )"(?P<page>[^\s]+)" を表示している$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-go-to-page">
+ <source><![CDATA[/^(?:|I )go to "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )"(?P<page>[^\s]+)" へ移動する$/]]></target>
+ </trans-unit>
+ <trans-unit id="reload-the-page">
+ <source><![CDATA[/^(?:|I )reload the page$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )ページをリロードする$/]]></target>
+ </trans-unit>
+ <trans-unit id="move-backward-one-page">
+ <source><![CDATA[/^(?:|I )move backward one page$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )履歴の前のページに戻る$/]]></target>
+ </trans-unit>
+ <trans-unit id="move-forward-one-page">
+ <source><![CDATA[/^(?:|I )move forward one page$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )履歴の次のページヘ進む$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-press-button">
+ <source><![CDATA[/^(?:|I )press "(?P<button>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )"(?P<button>(?:[^"]|\\")*)" ボタンをクリックする$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-follow-link">
+ <source><![CDATA[/^(?:|I )follow "(?P<link>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )"(?P<link>(?:[^"]|\\")*)" のリンク先へ移動する$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-field-with-value">
+ <source><![CDATA[/^(?:|I )fill in "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )"(?P<field>(?:[^"]|\\")*)" フィールドに "(?P<value>(?:[^"]|\\")*)" と入力する$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-value-for-field">
+ <source><![CDATA[/^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )"(?P<value>(?:[^"]|\\")*)" という値を "(?P<field>(?:[^"]|\\")*)" に入力する$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-the-following">
+ <source><![CDATA[/^(?:|I )fill in the following:$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが)次のように入力する:$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-select-option-from-select">
+ <source><![CDATA[/^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )"(?P<option>(?:[^"]|\\")*)" という値を "(?P<select>(?:[^"]|\\")*)" から選択する$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-check-option">
+ <source><![CDATA[/^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )"(?P<option>(?:[^"]|\\")*)" にチェックをつける$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-uncheck-option">
+ <source><![CDATA[/^(?:|I )uncheck "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )"(?P<option>(?:[^"]|\\")*)" のチェックをはずす$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-attach-the-file-to-field">
+ <source><![CDATA[/^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが)パス "(?P<path>[^"]*)" にあるファイルを "(?P<field>(?:[^"]|\\")*)" に添付する$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-text">
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|画面に )"(?P<text>(?:[^"]|\\")*)" と表示されていること$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-should-contain">
+ <source><![CDATA[/^the response should contain "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^レスポンスに "(?P<text>(?:[^"]|\\")*)" が含まれていること$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-text">
+ <source><![CDATA[/^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|画面に )"(?P<text>(?:[^"]|\\")*)" と表示されていないこと$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-should-not-contain">
+ <source><![CDATA[/^the response should not contain "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^レスポンスに "(?P<text>(?:[^"]|\\")*)" が含まれていないこと$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^"(?P<field>(?:[^"]|\\")*)" フィールドに "(?P<value>(?:[^"]|\\")*)" が含まれていること$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-not-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should not contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^"(?P<field>(?:[^"]|\\")*)" フィールドに "(?P<value>(?:[^"]|\\")*)" が含まれていないこと$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should be checked$/]]></source>
+ <target><![CDATA[/^チェックボックス "(?P<checkbox>(?:[^"]|\\")*)" のチェックがついていること$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-not-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should not be checked$/]]></source>
+ <target><![CDATA[/^チェックボックス "(?P<checkbox>(?:[^"]|\\")*)" のチェックがはずれていること$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-be-on-page">
+ <source><![CDATA[/^(?:|I )should be on "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|ユーザーが )(?P<page>[^\s]+) を表示していること$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-url-should-match">
+ <source><![CDATA[/^the url should match "(?P<pattern>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^URLが "(?P<pattern>(?:[^"]|\\")*)" にマッチすること$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-element-should-contain">
+ <source><![CDATA[/^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^"(?P<element>[^"]*)" エレメントに "(?P<value>(?:[^"]|\\")*)" という値が含まれていること$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-text-in-element">
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)" in the "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^"(?P<element>[^"]*)" エレメントに "(?P<text>(?:[^"]|\\")*)" と表示されていること$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-element">
+ <source><![CDATA[/^(?:|I )should see an? "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^(?:|画面に )"(?P<element>[^"]*)" エレメントが表示されていること$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-element">
+ <source><![CDATA[/^(?:|I )should not see an? "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^(?:|画面に )"(?P<element>[^"]*)" エレメントが表示されていないこと$/]]></target>
+ </trans-unit>
+ <trans-unit id="response-status-code-should-be">
+ <source><![CDATA[/^the response status code should be (?P<code>\d+)$/]]></source>
+ <target><![CDATA[/レスポンスコードが (?P<code>\d+) であること/]]></target>
+ </trans-unit>
+ <trans-unit id="print-last-response">
+ <source><![CDATA[/^print last response$/]]></source>
+ <target><![CDATA[/^最後のレスポンスを表示$/]]></target>
+ </trans-unit>
+ <trans-unit id="show-last-response">
+ <source><![CDATA[/^show last response$/]]></source>
+ <target><![CDATA[/^最後のレスポンスをブラウザで表示$/]]></target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
View
131 src/Behat/Mink/Behat/Context/translations/ru.xliff
@@ -0,0 +1,131 @@
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+ <file original="global" source-language="en" target-language="ru" datatype="plaintext">
+ <header />
+ <body>
+ <trans-unit id="i-am-on-page">
+ <source><![CDATA[/^(?:|I )am on "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|я )на странице "(?P<page>[^"]+)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-go-to-page">
+ <source><![CDATA[/^(?:|I )go to "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|я )перехожу на "(?P<page>[^"]+)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="reload-the-page">
+ <source><![CDATA[/^(?:|I )reload the page$/]]></source>
+ <target><![CDATA[/^(?:|я )обновляю страницу$/]]></target>
+ </trans-unit>
+ <trans-unit id="move-backward-one-page">
+ <source><![CDATA[/^(?:|I )move backward one page$/]]></source>
+ <target><![CDATA[/^(?:|я )перехожу на одну страницу назад$/]]></target>
+ </trans-unit>
+ <trans-unit id="move-forward-one-page">
+ <source><![CDATA[/^(?:|I )move forward one page$/]]></source>
+ <target><![CDATA[/^(?:|я )перехожу на одну страницу вперед$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-press-button">
+ <source><![CDATA[/^(?:|I )press "(?P<button>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|я )нажимаю "(?P<button>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-follow-link">
+ <source><![CDATA[/^(?:|I )follow "(?P<link>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|я )кликаю по ссылке "(?P<link>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-field-with-value">
+ <source><![CDATA[/^(?:|I )fill in "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|я )заполняю поле "(?P<field>(?:[^"]|\\")*)" значением "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-value-for-field">
+ <source><![CDATA[/^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|я )ввожу "(?P<value>(?:[^"]|\\")*)" в поле "(?P<field>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-the-following">
+ <source><![CDATA[/^(?:|I )fill in the following:$/]]></source>
+ <target><![CDATA[/^(?:|я )ввожу следующие значения:$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-select-option-from-select">
+ <source><![CDATA[/^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|я )выбираю "(?P<option>(?:[^"]|\\")*)" в поле "(?P<select>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-check-option">
+ <source><![CDATA[/^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|я )ставлю галочку "(?P<option>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-uncheck-option">
+ <source><![CDATA[/^(?:|I )uncheck "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|я )снимаю галочку "(?P<option>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-attach-the-file-to-field">
+ <source><![CDATA[/^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|я )выбираю файл "(?P<path>[^"]*)" в поле "(?P<field>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-text">
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|я )должен видеть "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-should-contain">
+ <source><![CDATA[/^the response should contain "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^тело ответа должно содержать "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-text">
+ <source><![CDATA[/^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|я )не должен видеть "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-should-not-contain">
+ <source><![CDATA[/^the response should not contain "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^тело ответа не должно содержать "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^поле "(?P<field>(?:[^"]|\\")*)" должно содержать "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-not-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should not contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^поле "(?P<field>(?:[^"]|\\")*)" не должно содержать "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should be checked$/]]></source>
+ <target><![CDATA[/^галочка "(?P<checkbox>(?:[^"]|\\")*)" должна быть отмечена$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-not-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should not be checked$/]]></source>
+ <target><![CDATA[/^галочка "(?P<checkbox>(?:[^"]|\\")*)" не должна быть отмечена$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-be-on-page">
+ <source><![CDATA[/^(?:|I )should be on "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|я )должен быть на странице "(?P<page>[^"]+)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-url-should-match">
+ <source><![CDATA[/^the url should match "(?P<pattern>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:url|адрес) должен соответствовать "(?P<pattern>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-element-should-contain">
+ <source><![CDATA[/^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^элемент "(?P<element>[^"]*)" должен содержать "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-text-in-element">
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)" in the "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^(?:|я )должен видеть "(?P<text>(?:[^"]|\\")*)" внутри элемента "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-element">
+ <source><![CDATA[/^(?:|I )should see an? "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^(?:|я )должен видеть элемент "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-element">
+ <source><![CDATA[/^(?:|I )should not see an? "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^(?:|я )не должен видеть элемент "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-status-code-should-be">
+ <source><![CDATA[/^the response status code should be (?P<code>\d+)$/]]></source>
+ <target><![CDATA[/^код ответа сервера должен быть (?P<code>\d+)$/]]></target>
+ </trans-unit>
+ <trans-unit id="print-last-response">
+ <source><![CDATA[/^print last response$/]]></source>
+ <target><![CDATA[/^выведи последний ответ сервера$/]]></target>
+ </trans-unit>
+ <trans-unit id="show-last-response">
+ <source><![CDATA[/^show last response$/]]></source>
+ <target><![CDATA[/^покажи последний ответ сервера$/]]></target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
View
76 src/Behat/Mink/ClassLoader/MapFileClassLoader.php
@@ -0,0 +1,76 @@
+<?php
+
+namespace Behat\Mink\ClassLoader;
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * A class loader that uses a mapping file to look up paths.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class MapFileClassLoader
+{
+ private $map = array();
+
+ /**
+ * Constructor.
+ *
+ * @param string $file Path to class mapping file
+ */
+ public function __construct($file)
+ {
+ $this->map = require $file;
+ }
+
+ /**
+ * Registers this instance as an autoloader.
+ *
+ * @param Boolean $prepend Whether to prepend the autoloader or not
+ */
+ public function register($prepend = false)
+ {
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
+ }
+
+ /**
+ * Loads the given class or interface.
+ *
+ * @param string $class The name of the class
+ */
+ public function loadClass($class)
+ {
+ if ('\\' === $class[0]) {
+ $class = substr($class, 1);
+ }
+
+ if (isset($this->map[$class])) {
+ require $this->map[$class];
+ }
+ }
+
+ /**
+ * Finds the path to the file where the class is defined.
+ *
+ * @param string $class The name of the class
+ *
+ * @return string|null The path, if found
+ */
+ public function findFile($class)
+ {
+ if ('\\' === $class[0]) {
+ $class = substr($class, 1);
+ }
+
+ if (isset($this->map[$class])) {
+ return $this->map[$class];
+ }
+ }
+}
View
84 src/Behat/Mink/ClassLoader/UniversalClassLoader.php
@@ -5,7 +5,7 @@
/*
* This file is part of the Symfony package.
*
- * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
+ * (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -50,14 +50,16 @@
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
- * @author Fabien Potencier <fabien.potencier@symfony-project.org>
+ * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @api
*/
class UniversalClassLoader
{
- protected $namespaces = array();
- protected $prefixes = array();
- protected $namespaceFallback = array();
- protected $prefixFallback = array();
+ private $namespaces = array();
+ private $prefixes = array();
+ private $namespaceFallbacks = array();
+ private $prefixFallbacks = array();
/**
* Gets the configured namespaces.
@@ -84,9 +86,9 @@ public function getPrefixes()
*
* @return array An array of directories
*/
- public function getNamespaceFallback()
+ public function getNamespaceFallbacks()
{
- return $this->namespaceFallback;
+ return $this->namespaceFallbacks;
}
/**
@@ -94,35 +96,41 @@ public function getNamespaceFallback()
*
* @return array An array of directories
*/
- public function getPrefixFallback()
+ public function getPrefixFallbacks()
{
- return $this->prefixFallback;
+ return $this->prefixFallbacks;
}
/**
* Registers the directory to use as a fallback for namespaces.
*
- * @return string|array $dirs A directory path or an array of directories
+ * @param array $dirs An array of directories
+ *
+ * @api
*/
- public function registerNamespaceFallback($dirs)
+ public function registerNamespaceFallbacks(array $dirs)
{
- $this->namespaceFallback = (array) $dirs;
+ $this->namespaceFallbacks = $dirs;
}
/**
* Registers the directory to use as a fallback for class prefixes.
*
- * @return string|array $dirs A directory path or an array of directories
+ * @param array $dirs An array of directories
+ *
+ * @api
*/
- public function registerPrefixFallback($dirs)
+ public function registerPrefixFallbacks(array $dirs)
{
- $this->prefixFallback = (array) $dirs;
+ $this->prefixFallbacks = $dirs;
}
/**
* Registers an array of namespaces
*
* @param array $namespaces An array of namespaces (namespaces as keys and locations as values)
+ *
+ * @api
*/
public function registerNamespaces(array $namespaces)
{
@@ -136,6 +144,8 @@ public function registerNamespaces(array $namespaces)
*
* @param string $namespace The namespace
* @param array|string $paths The location(s) of the namespace
+ *
+ * @api
*/
public function registerNamespace($namespace, $paths)
{
@@ -146,6 +156,8 @@ public function registerNamespace($namespace, $paths)
* Registers an array of classes using the PEAR naming convention.
*
* @param array $classes An array of classes (prefixes as keys and locations as values)
+ *
+ * @api
*/
public function registerPrefixes(array $classes)
{
@@ -159,6 +171,8 @@ public function registerPrefixes(array $classes)
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
+ *
+ * @api
*/
public function registerPrefix($prefix, $paths)
{
@@ -169,6 +183,8 @@ public function registerPrefix($prefix, $paths)
* Registers this instance as an autoloader.
*
* @param Boolean $prepend Whether to prepend the autoloader or not
+ *
+ * @api
*/
public function register($prepend = false)
{
@@ -182,9 +198,25 @@ public function register($prepend = false)
*/
public function loadClass($class)
{
- $class = ltrim($class, '\\');
+ if ($file = $this->findFile($class)) {
+ require $file;
+ }
+ }
+
+ /**
+ * Finds the path to the file where the class is defined.
+ *
+ * @param string $class The name of the class
+ *
+ * @return string|null The path, if found
+ */
+ public function findFile($class)
+ {
+ if ('\\' == $class[0]) {
+ $class = substr($class, 1);
+ }
- if (false !== ($pos = strrpos($class, '\\'))) {
+ if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$namespace = substr($class, 0, $pos);
foreach ($this->namespaces as $ns => $dirs) {
@@ -193,18 +225,16 @@ public function loadClass($class)
$className = substr($class, $pos + 1);
$file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
if (file_exists($file)) {
- require $file;
- return;
+ return $file;
}
}
}
}
- foreach ($this->namespaceFallback as $dir) {
+ foreach ($this->namespaceFallbacks as $dir) {
$file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($file)) {
- require $file;
- return;
+ return $file;
}
}
} else {
@@ -214,18 +244,16 @@ public function loadClass($class)
if (0 === strpos($class, $prefix)) {
$file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($file)) {
- require $file;
- return;
+ return $file;
}
}
}
}
- foreach ($this->prefixFallback as $dir) {
+ foreach ($this->prefixFallbacks as $dir) {
$file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($file)) {
- require $file;
- return;
+ return $file;
}
}
}
View
180 src/Behat/Mink/Compiler/MapFileCompiler.php
@@ -0,0 +1,180 @@
+<?php
+
+namespace Behat\Mink\Compiler;
+
+use Symfony\Component\Finder\Finder;
+
+/*
+ * 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.
+ */
+
+/**
+ * Class loader map file compiler.
+ *
+ * @author Konstantin Kudryashov <ever.zet@gmail.com>
+ */
+class MapFileCompiler
+{
+ /**
+ * Behat lib directory.
+ *
+ * @var string
+ */
+ private $libPath;
+
+ /**
+ * Initializes compiler.
+ */
+ public function __construct()
+ {
+ $this->libPath = realpath(__DIR__ . '/../../../../');
+ }
+
+ /**
+ * Compiles map file and autoloader.
+ *
+ * @param string $version
+ */
+ public function compile($autoloaderFilename = 'autoload.php', $mapFilename = 'autoload_map.php')
+ {
+ if (file_exists($mapFilename)) {
+ unlink($mapFilename);
+ }
+ $mappings = '';
+
+ foreach ($this->findPhpFile()->in($this->libPath . '/src') as $file) {
+ $path = str_replace($this->libPath . '/src/', '', $file->getRealPath());
+ $class = str_replace(array('/', '.php'), array('\\', ''), $path);
+ $mappings .= "\$mappings['$class'] = \$minkDir . 'src/$path';\n";
+ }
+
+ // autoload Goutte
+ $mappings .= "\nif (!defined('BEHAT_AUTOLOAD_GOUTTE') || true === BEHAT_AUTOLOAD_GOUTTE) {\n";
+ $mappings .= " \$mappings['Goutte\Client'] = __DIR__ . '/vendor/Goutte/src/Goutte/Client.php';\n";
+ $mappings .= "}\n";
+
+ // autoload SahiClient
+ $mappings .= "\nif (!defined('BEHAT_AUTOLOAD_SAHI') || true === BEHAT_AUTOLOAD_SAHI) {\n";
+ foreach ($this->findPhpFile()->in($this->libPath . '/vendor/SahiClient/src') as $file) {
+ $path = str_replace($this->libPath . '/vendor/SahiClient/src/', '', $file->getRealPath());
+ $class = str_replace(array('/', '.php'), array('\\', ''), $path);
+ $mappings .= " \$mappings['$class'] = __DIR__ . '/vendor/SahiClient/src/$path';\n";
+ }
+ $mappings .= "}\n";
+
+ // autoload Buzz
+ $mappings .= "\nif (!defined('BEHAT_AUTOLOAD_BUZZ') || true === BEHAT_AUTOLOAD_BUZZ) {\n";
+ foreach ($this->findPhpFile()->in($this->libPath . '/vendor/Buzz/lib') as $file) {
+ $path = str_replace($this->libPath . '/vendor/Buzz/lib/', '', $file->getRealPath());
+ $class = str_replace(array('/', '.php'), array('\\', ''), $path);
+ $mappings .= " \$mappings['$class'] = __DIR__ . '/vendor/Buzz/lib/$path';\n";
+ }
+ $mappings .= "}\n";
+
+ // autoload Symfony2
+ $mappings .= "\nif (!defined('BEHAT_AUTOLOAD_SF2') || true === BEHAT_AUTOLOAD_SF2) {\n";
+ foreach ($this->findPhpFile()->in($this->libPath . '/vendor/Symfony') as $file) {
+ $path = str_replace($this->libPath . '/vendor/', '', $file->getRealPath());
+ $class = str_replace(array('/', '.php'), array('\\', ''), $path);
+ $mappings .= " \$mappings['$class'] = \$symfonyDir . '$path';\n";
+ }
+ $mappings .= "}\n";
+
+ // autoload ZF2
+ $mappings .= "\nif (!defined('BEHAT_AUTOLOAD_ZF2') || true === BEHAT_AUTOLOAD_ZF2) {\n";
+ $zendDir = $this->libPath . '/vendor/Goutte/vendor/zend/library';
+ foreach (array(
+ 'Zend\Tool\Framework\Exception',
+ 'Zend\Registry',
+ 'Zend\Uri\Uri',
+ 'Zend\Validator\Validator',
+ 'Zend\Validator\AbstractValidator',
+ 'Zend\Validator\Hostname',
+ 'Zend\Validator\Ip',
+ 'Zend\Validator\Hostname\Com',
+ 'Zend\Validator\Hostname\Jp',
+ ) as $class) {
+ $path = str_replace('\\', '/', $class) . '.php';
+ $mappings .= " \$mappings['$class'] = \$zendDir . '$path';\n";
+ }
+ foreach ($this->findPhpFile()->in($zendDir . '/Zend/Uri') as $file) {
+ $path = str_replace($zendDir . '/', '', $file->getRealPath());
+ $class = str_replace(array('/', '.php'), array('\\', ''), $path);
+ $mappings .= " \$mappings['$class'] = \$zendDir . '$path';\n";