This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge branch 'release/0.2.0'

  • Loading branch information...
2 parents d92d6c6 + 14f4fed commit 1d5c8655aa995b0863aef57538fa102f94d40a70 @everzet everzet committed Apr 21, 2011
View
@@ -1,3 +1,12 @@
+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
==================
View
@@ -6,35 +6,37 @@ Behat\Mink
Usage
-----
- <?php
-
- use Behat\Mink\Mink,
- Behat\Mink\Driver\GoutteDriver,
- Behat\Mink\Driver\SahiDriver;
-
- $startUrl = 'http://example.com';
-
- // init Mink and register drivers
- $mink = new Mink();
- $mink->registerDriver('goutte', new GoutteDriver($startUrl), true); // last argument === isDefault
- $mink->registerDriver('javascript', new SahiDriver($startUrl, 'firefox'));
- $mink->registerDriver('symfony2', new GoutteDriver($startUrl, $container->get('client')));
- $mink->registerDriver('custom', new MyCustomDriver($startUrl));
-
- // run in default driver ("goutte" is default driver - last argument to registerDriver())
- $mink->switchToDefaultDriver();
- $mink->getSession()->getPage()->findLink('Downloads')->click();
- echo $mink->getSession()->getPage()->getContent();
-
- // run in javascript (Sahi) driver
- $mink->switchToDriver('javascript');
- $mink->getSession()->getPage()->findLink('Downloads')->click();
- echo $mink->getSession()->getPage()->getContent();
-
- // run in custom driver
- $mink->switchToDriver('custom');
- $mink->getSession()->getPage()->findLink('Downloads')->click();
- echo $mink->getSession()->getPage()->getContent();
+``` php
+<?php
+
+use Behat\Mink\Mink,
+ Behat\Mink\Driver\GoutteDriver,
+ Behat\Mink\Driver\SahiDriver;
+
+$startUrl = 'http://example.com';
+
+// init Mink and register drivers
+$mink = new Mink();
+$mink->registerDriver('goutte', new GoutteDriver($startUrl), true); // last argument === isDefault
+$mink->registerDriver('javascript', new SahiDriver($startUrl, 'firefox'));
+$mink->registerDriver('symfony2', new GoutteDriver($startUrl, $container->get('client')));
+$mink->registerDriver('custom', new MyCustomDriver($startUrl));
+
+// run in default driver ("goutte" is default driver - last argument to registerDriver())
+$mink->switchToDefaultDriver();
+$mink->getSession()->getPage()->findLink('Downloads')->click();
+echo $mink->getSession()->getPage()->getContent();
+
+// run in javascript (Sahi) driver
+$mink->switchToDriver('javascript');
+$mink->getSession()->getPage()->findLink('Downloads')->click();
+echo $mink->getSession()->getPage()->getContent();
+
+// run in custom driver
+$mink->switchToDriver('custom');
+$mink->getSession()->getPage()->findLink('Downloads')->click();
+echo $mink->getSession()->getPage()->getContent();
+```
Copyright
---------
View
@@ -5,9 +5,9 @@
http://pear.php.net/dtd/package-2.0.xsd">
<name>mink</name>
<channel>pear.behat.org</channel>
- <summary>Mink is an browser emulation framework for php5.3</summary>
+ <summary>Behat\Mink is an browser emulation framework for PHP</summary>
<description>
- Mink is an open source browser emulation framework for php 5.3.
+ Behat\Mink is an open source browser emulation framework for php 5.3.
</description>
<lead>
<name>Konstantin Kudryashov</name>
View
@@ -0,0 +1,125 @@
+; 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
@@ -8,6 +8,11 @@
Behat\Mink\Driver\GoutteDriver,
Behat\Mink\Driver\SahiDriver;
+use Goutte\Client as GoutteClient;
+
+use Behat\SahiClient\Connection as SahiConnection,
+ Behat\SahiClient\Client as SahiClient;
+
/*
* This file is part of the Behat\Mink.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
@@ -30,21 +35,9 @@ public function __construct()
{
$world = $this;
- $world->initGoutteDriver = function() use($world) {
- return new GoutteDriver(
- $world->getParameter('start_url') ?: 'http://behat.org/'
- );
- };
-
- $world->initSahiDriver = function() use($world) {
- return new SahiDriver(
- $world->getParameter('start_url') ?: 'http://behat.org/',
- $world->getParameter('browser') ?: 'firefox'
- );
- };
-
+ $world->drivers = array();
$world->getPathTo = function($path) use($world) {
- return ($world->getParameter('start_url') ?: 'http://behat.org/') . $path;
+ return 0 !== strpos('http', $path) ? $world->getParameter('start_url') . $path : $path;
};
}
@@ -75,46 +68,38 @@ public function getSession()
return $this->getMink()->getSession();
}
- /**
- * Returns default Mink driver name.
- *
- * @return string
- */
- public function getDefaultDriverName()
- {
- return $this->getParameter('default_driver') ?: 'goutte';
- }
-
- /**
- * Returns default javascript driver name.
- *
- * @return string
- */
- public function getJavascriptDriverName()
- {
- return $this->getParameter('javascript_driver') ?: 'sahi';
- }
-
/**
* Registers drivers on mink.
*
* @param Behat\Mink\Mink $mink
*/
- protected function registerMinkDrivers(Mink $mink)
+ private function registerMinkDrivers(Mink $mink)
{
- foreach ($this->getDrivers() as $driver) {
- $builder = 'init' . ucfirst($driver) . 'Driver';
- $mink->registerDriver($driver, $this->$builder(), $driver === $this->getDefaultDriverName());
+ if (null === $this->getParameter('start_url')) {
+ throw new \InvalidArgumentException('Specify start_url environment parameter');
+ }
+ $startUrl = $this->getParameter('start_url');
+ $defaultDriver = $this->getParameter('default_driver') ?: 'goutte';
+ $browser = $this->getParameter('browser') ?: 'firefox';
+
+ $config = $this->getParameter('goutte', array());
+ $goutte = new GoutteClient(
+ isset($config['zend_config']) ? $config['zend_config'] : array(),
+ isset($config['server_parameters']) ? $config['server_parameters'] : array()
+ );
+ $mink->registerDriver('goutte', new GoutteDriver($startUrl, $goutte), 'goutte' === $defaultDriver);
+
+ $config = $this->getParameter('sahi', array());
+ $client = new SahiClient(new SahiConnection(
+ isset($config['sid']) ? $config['sid'] : uniqid(),
+ isset($config['host']) ? $config['host'] : 'localhost',
+ isset($config['port']) ? $config['port'] : 9999
+ ));
+ $mink->registerDriver('sahi', new SahiDriver($startUrl, $browser, $client), 'sahi' === $defaultDriver);
+
+
+ foreach ($this->drivers as $alias => $driver) {
+ $mink->registerDriver($alias, $driver, $driver === $this->getDefaultDriverName());
}
- }
-
- /**
- * Returns drivers list (available_drivers parameter).
- *
- * @return array
- */
- private function getDrivers()
- {
- return (array) ($this->getParameter('available_drivers') ?: array('goutte', 'sahi'));
}
}
@@ -74,6 +74,26 @@
<source><![CDATA[/^(?:|I )should be on (?P<page>.+)$/]]></source>
<target><![CDATA[/^(?:|я )должен быть на странице (?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[/^элемент "(?P<element>[^"]*)" должен содержать "(?P<value>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-element">
+ <source><![CDATA[/^(?:|I )should see "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^(?:|Я )должен видеть элемент "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-element-should-link-to">
+ <source><![CDATA[/^the "(?P<element>[^"]*)" element should link to (?P<href>.*)$/]]></source>
+ <target><![CDATA[/^элемент "(?P<element>[^"]*)" должен вести на страницу (?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[/^элемент "(?P<element>[^"]*)" должен иметь аттрибут "(?P<attribute>[a-zA-Z\-\_]*)", содержащий "(?P<value>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="">
+ <source><![CDATA[/the response status code should be (?P<code>\d+)/]]></source>
+ <target><![CDATA[/код ответа сервера должен быть (?P<code>\d+)/]]></target>
+ </trans-unit>
</body>
</file>
</xliff>
Oops, something went wrong.

0 comments on commit 1d5c865

Please sign in to comment.