Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release/1.4.3'

  • Loading branch information...
commit 0817070a6e2ec9f475fad9bfb81a962c462eb934 2 parents 51d904a + d88913f
@everzet everzet authored
View
9 .travis.yml
@@ -3,9 +3,10 @@ language: php
php: [5.3, 5.4, 5.5]
env:
- - SYMFONY_VERSION='2.0.*'
- - SYMFONY_VERSION='2.1.*'
- - SYMFONY_VERSION='2.2.*@dev'
+ - CSS_SELECTOR_VERSION='2.0.*'
+ - CSS_SELECTOR_VERSION='2.1.*'
+ - CSS_SELECTOR_VERSION='2.2.*'
+ - CSS_SELECTOR_VERSION='2.3.*@dev'
branches:
only:
@@ -14,7 +15,7 @@ branches:
before_script:
- curl http://getcomposer.org/installer | php
- - php composer.phar require --no-update symfony/symfony=$SYMFONY_VERSION
+ - php composer.phar require --no-update symfony/css-selector=$CSS_SELECTOR_VERSION
- php composer.phar install --dev --prefer-source
script: phpunit -v
View
5 CHANGES.md
@@ -1,3 +1,8 @@
+1.4.3 / 2013-03-02
+==================
+
+ * Bump dependencies constraints
+
1.4.2 / 2013-02-13
==================
View
28 CONTRIBUTING.md
@@ -0,0 +1,28 @@
+Contributing
+------------
+
+Mink is an open source, community-driven project. If you'd like to contribute, feel free to do this, but remember to follow this few simple rules:
+
+- Make your feature addition or bug fix,
+- __Always__ as base for your changes use `develop` branch (all new development happens here, `master` branch is for releases & hotfixes only),
+- 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,
+- Commit your code, but do not mess with `CHANGES.md`,
+- __Remember__: when you create Pull Request, always select `develop` branch as target, otherwise it will be closed.
+
+Running tests
+-------------
+
+Make sure that you don't break anything with your changes by running:
+
+```bash
+$> phpunit
+```
+
+Behat integration and translated languages
+------------------------------------------
+
+Behat integration altogether with translations have moved into separate
+project called `MinkExtension`. It's an extension to Behat 2.4. This will
+lead to much faster release cycles as `MinkExtension` doesn't have actual
+releases - any accepted PR about language translation or new step definitions
+will immediately go into live.
View
4 LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2012 Konstantin Kudryashov <ever.zet@gmail.com>
+Copyright (c) 2011-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
@@ -19,4 +19,4 @@ 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.
+OTHER DEALINGS IN THE SOFTWARE.
View
59 README.md
@@ -1,11 +1,17 @@
Mink
====
-[![Build Status](https://secure.travis-ci.org/Behat/Mink.png)](http://travis-ci.org/Behat/Mink)
+- [stable (master)](https://github.com/Behat/Mink) ([![Master Build
+Status](https://secure.travis-ci.org/Behat/Mink.png?branch=master)](http://travis-ci.org/Behat/Mink)) - staging branch. Last stable version.
+- [development (develop)](https://github.com/Behat/Mink/tree/develop) ([![Develop Build Status](https://secure.travis-ci.org/Behat/Mink.png?branch=develop)](http://travis-ci.org/Behat/Mink)) - development branch. Development happens here and you should send your PRs here too.
-* The main website with documentation is at
-[http://mink.behat.org](http://mink.behat.org)
-* Official user group is at [Google Groups](http://groups.google.com/group/behat)
+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
-------------
@@ -16,35 +22,29 @@ Usage Example
use Behat\Mink\Mink,
Behat\Mink\Session,
Behat\Mink\Driver\GoutteDriver,
- Behat\Mink\Driver\Goutte\Client as GoutteClient,
- Behat\Mink\Driver\SahiDriver;
+ 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(GoutteClient($startUrl))),
- 'goutte2' => new Session(new GoutteDriver(GoutteClient($startUrl))),
- 'javascript' => new Session(new SahiDriver('firefox')),
- 'custom' => new Session(new MyCustomDriver($startUrl))
+ 'goutte1' => new Session(new GoutteDriver(GoutteClient($startUrl))),
+ 'goutte2' => new Session(new GoutteDriver(GoutteClient($startUrl))),
+ 'custom' => new Session(new MyCustomDriver($startUrl))
));
-// set default session name
+// set the default session name
$mink->setDefaultSessionName('goutte2');
-// call getSession without argument will always return default session if has one (goutte2 here)
+// 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();
-// run in javascript (Sahi) session
-$mink->getSession('javascript')->getPage()->findLink('Downloads')->click();
-echo $mink->getSession('javascript')->getPage()->getContent();
-
-// run in custom session
+// call to getSession() with argument will return session by its name
$mink->getSession('custom')->getPage()->findLink('Downloads')->click();
echo $mink->getSession('custom')->getPage()->getContent();
-// mix sessions
+// this all is done to make possible mixing sessions
$mink->getSession('goutte1')->getPage()->findLink('Chat')->click();
$mink->getSession('goutte2')->getPage()->findLink('Chat')->click();
```
@@ -53,31 +53,12 @@ Install Dependencies
--------------------
``` bash
-curl http://getcomposer.org/installer | php
-php composer.phar install
+$> curl http://getcomposer.org/installer | php
+$> php composer.phar install
```
-Behat integration and translated languages
-------------------------------------------
-
-Behat integration altogether with translations have moved into separate
-project called `MinkExtension`. It's an extension to Behat 2.4. This will
-lead to much faster release cycles as `MinkExtension` doesn't have actual
-releases - any accepted PR about language translation or new step definitions
-will immediately go into live.
-
-Copyright
----------
-
-Copyright (c) 2011 Konstantin Kudryashov (ever.zet). See LICENSE for details.
-
Contributors
------------
* Konstantin Kudryashov [everzet](http://github.com/everzet) [lead developer]
* Other [awesome developers](https://github.com/Behat/Mink/graphs/contributors)
-
-Sponsors
---------
-
-* knpLabs [knpLabs](http://www.knplabs.com/) [main sponsor]
View
11 composer.json
@@ -16,15 +16,14 @@
"require": {
"php": ">=5.3.1",
- "symfony/css-selector": ">=2.0,<2.3-dev"
+ "symfony/css-selector": ">=2.0,<2.4-dev"
},
"suggest": {
- "behat/mink-goutte-driver": "to enable Goutte support",
- "behat/mink-sahi-driver": "to enable Sahi.JS support",
- "behat/mink-selenium-driver": "to enable Selenium1 support",
- "behat/mink-selenium2-driver": "to enable Selenium2 (webdriver support)",
- "behat/mink-zombie-driver": "to enable Zombie.js support"
+ "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": {
View
42 src/Behat/Mink/WebAssert.php
@@ -304,12 +304,14 @@ public function responseNotMatches($regex)
* @param string $selectorType element selector type (css, xpath)
* @param string $selector element selector
* @param integer $count expected count
+ * @param Element $container document to check against
*
* @throws ExpectationException
*/
- public function elementsCount($selectorType, $selector, $count)
+ public function elementsCount($selectorType, $selector, $count, Element $container = null)
{
- $nodes = $this->session->getPage()->findAll($selectorType, $selector);
+ $container = $container ?: $this->session->getPage();
+ $nodes = $container->findAll($selectorType, $selector);
if (intval($count) !== count($nodes)) {
$message = sprintf('%d elements matching %s "%s" found on the page, but should be %d.', count($nodes), $selectorType, $selector, $count);
@@ -330,7 +332,7 @@ public function elementsCount($selectorType, $selector, $count)
*/
public function elementExists($selectorType, $selector, Element $container = null)
{
- $container = ($container !== null) ? $container : $this->session->getPage();
+ $container = $container ?: $this->session->getPage();
$node = $container->find($selectorType, $selector);
if (null === $node) {
@@ -351,7 +353,7 @@ public function elementExists($selectorType, $selector, Element $container = nul
*/
public function elementNotExists($selectorType, $selector, Element $container = null)
{
- $container = ($container !== null) ? $container : $this->session->getPage();
+ $container = $container ?: $this->session->getPage();
$node = $container->find($selectorType, $selector);
if (null !== $node) {
@@ -448,14 +450,16 @@ public function elementNotContains($selectorType, $selector, $html)
* Checks that specific field exists on the current page.
*
* @param string $field field id|name|label|value
+ * @param Element $container document to check against
*
* @return NodeElement
*
* @throws ElementNotFoundException
*/
- public function fieldExists($field)
+ public function fieldExists($field, Element $container = null)
{
- $node = $this->session->getPage()->findField($field);
+ $container = $container ?: $this->session->getPage();
+ $node = $container->findField($field);
if (null === $node) {
throw new ElementNotFoundException($this->session, 'form field', 'id|name|label|value', $field);
@@ -468,12 +472,14 @@ public function fieldExists($field)
* Checks that specific field does not exists on the current page.
*
* @param string $field field id|name|label|value
+ * @param Element $container document to check against
*
* @throws ExpectationException
*/
- public function fieldNotExists($field)
+ public function fieldNotExists($field, Element $container = null)
{
- $node = $this->session->getPage()->findField($field);
+ $container = $container ?: $this->session->getPage();
+ $node = $container->findField($field);
if (null !== $node) {
$message = sprintf('A field "%s" appears on this page, but it should not.', $field);
@@ -486,12 +492,13 @@ public function fieldNotExists($field)
*
* @param string $field field id|name|label|value
* @param string $value field value
+ * @param Element $container document to check against
*
* @throws ExpectationException
*/
- public function fieldValueEquals($field, $value)
+ public function fieldValueEquals($field, $value, Element $container = null)
{
- $node = $this->fieldExists($field);
+ $node = $this->fieldExists($field, $container);
$actual = $node->getValue();
$regex = '/^'.preg_quote($value, '/').'/ui';
@@ -506,12 +513,13 @@ public function fieldValueEquals($field, $value)
*
* @param string $field field id|name|label|value
* @param string $value field value
+ * @param Element $container document to check against
*
* @throws ExpectationException
*/
- public function fieldValueNotEquals($field, $value)
+ public function fieldValueNotEquals($field, $value, Element $container = null)
{
- $node = $this->fieldExists($field);
+ $node = $this->fieldExists($field, $container);
$actual = $node->getValue();
$regex = '/^'.preg_quote($value, '/').'/ui';
@@ -525,12 +533,13 @@ public function fieldValueNotEquals($field, $value)
* Checks that specific checkbox is checked.
*
* @param string $field field id|name|label|value
+ * @param Element $container document to check against
*
* @throws ExpectationException
*/
- public function checkboxChecked($field)
+ public function checkboxChecked($field, Element $container = null)
{
- $node = $this->fieldExists($field);
+ $node = $this->fieldExists($field, $container);
if (!$node->isChecked()) {
$message = sprintf('Checkbox "%s" is not checked, but it should be.', $field);
@@ -542,12 +551,13 @@ public function checkboxChecked($field)
* Checks that specific checkbox is unchecked.
*
* @param string $field field id|name|label|value
+ * @param Element $container document to check against
*
* @throws ExpectationException
*/
- public function checkboxNotChecked($field)
+ public function checkboxNotChecked($field, Element $container = null)
{
- $node = $this->fieldExists($field);
+ $node = $this->fieldExists($field, $container);
if ($node->isChecked()) {
$message = sprintf('Checkbox "%s" is checked, but it should not be.', $field);

0 comments on commit 0817070

Please sign in to comment.
Something went wrong with that request. Please try again.