PK U+yb .travis.ymlnu ٘ language: php
php:
- 5.3
- 5.4
branches:
only:
- master
- develop
before_script:
- bin/install_deps
script: phpunit --group unittest
PK UҞe
CHANGES.mdnu ٘ 1.3.0 / 2011-12-21
==================
* Brand new Selenium2Driver (webdriver session)
* Multiselect bugfixes
* ZombieDriver back in the business
* Composer now manages dependencies
* Some MinkContext steps got fixes
* Lots of bug fixes and cleanup
1.2.0 / 2011-11-04
==================
* Brand new SeleniumDriver (thanks @alexandresalome)
* Multiselect support (multiple options selection), including new Behat steps
* Ability to select option by it's text (in addition to value)
* ZombieDriver updates
* Use SuiteHooks to populate parameters (no need to call parent __construct anymore)
* Updated Goutte and all vendors
* Lot of bugfixes and new tests
1.1.1 / 2011-08-12
==================
* Fixed Zombie.js server termination on Linux
* Fixed base_url usage for external URLs
1.1.0 / 2011-08-08
==================
* Added Zombie.js driver (thanks @b00giZm)
* Added pt translation (thanks Daniel Gomes)
* Refactored MinkContext and MinkTestCase
1.0.3 / 2011-08-02
==================
* File uploads for empty fields fixed (GoutteDriver)
* Lazy sessions restart
* `show_tmp_dir` option in MinkContext
* Updated to stable Symfony2 components
* SahiClient connection limit bumped to 60 seconds
* Dutch language support
1.0.2 / 2011-07-22
==================
* ElementHtmlException fixed (thanks @Stof)
1.0.1 / 2011-07-21
==================
* Fixed buggy assertions in MinkContext
1.0.0 / 2011-07-20
==================
* Added missing tests for almost everything
* Hude speedup for SahiDriver
* Support for Behat 2.0 contexts
* Bundled PHPUnit TestCase
* Deep element traversing
* Correct behavior of getText() method
* New getHtml() method
* Basic HTTP auth support
* Soft and hard session resetting
* Cookies management
* Browser history interactions (reload(), back(), forward())
* Weaverryan'd exception messages
* Huge amount of bugfixes and small additions
0.3.2 / 2011-06-20
==================
* Fixed file uploads in Goutte driver
* Fixed setting of long texts into fields
* Added getPlainText() (returns text without tags and whitespaces) method to the element's API
* Start_url is now optional parameter
* Default session (if needed) name now need to be always specified by hands with setDefaultSessionName()
* default_driver => default_session
* Updated Symfony Components
0.3.1 / 2011-05-17
==================
* Small SahiClient update (it generates SID now if no provided)
* setActiveSessionName => setDefaultSessionName method rename
0.3.0 / 2011-05-17
==================
* Rewritten from scratch Mink drivers handler. Now it's sessions handler. And Mink now
sessions-centric tool. See examples in readme. Much cleaner API now.
0.2.4 / 2011-05-12
==================
* Fixed wrong url locator function
* Fixed wrong regex in `should see` step
* Fixed delimiters use in `should see` step
* Added url-match step for checking urls against regex
0.2.3 / 2011-05-01
==================
* Updated SahiClient with new version, which is faster and cleaner with it's exceptions
0.2.2 / 2011-05-01
==================
* Ability to use already started browser as SahiDriver aim
* Added japanese translation for bundled steps (thanks @hidenorigoto)
* 10 seconds limit for browser connection in SahiDriver
0.2.1 / 2011-04-21
==================
* Fixed some bundled step definitions
0.2.0 / 2011-04-21
==================
* Additional step definitions
* Support for extended drivers configuration through behat.yml environment parameters
* Lots of new named selectors
* Bug fixes
* Small improvements
0.1.2 / 2011-04-08
==================
* Fixed Sahi url escaping
0.1.1 / 2011-04-06
==================
* Fixed should/should_not steps
* Added spanish translation
* Fixed forms to use element
* Fixed small UnsupportedByDriverException issue
0.1.0 / 2011-04-04
==================
* Initial release
PK U>c c README.mdnu ٘ Mink
====
[![Build Status](https://secure.travis-ci.org/Behat/Mink.png)](http://travis-ci.org/Behat/Mink)
* 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)
Usage Example
-------------
``` php
new Session(new GoutteDriver($startUrl)),
'goutte2' => new Session(new GoutteDriver($startUrl)),
'javascript' => new Session(new SahiDriver($startUrl, 'firefox')),
'custom' => new Session(new MyCustomDriver($startUrl))
);
// set default session name
$mink->setDefaultSessionName('goutte2');
// call getSession without argument will always return 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
$mink->getSession('custom')->getPage()->findLink('Downloads')->click();
echo $mink->getSession('custom')->getPage()->getContent();
// mix sessions
$mink->getSession('goutte1')->getPage()->findLink('Chat')->click();
$mink->getSession('goutte2')->getPage()->findLink('Chat')->click();
```
Install Dependencies
--------------------
wget http://getcomposer.org/composer.phar
php composer.phar install
How to run Mink test suite
--------------------------
1. Install dependencies (including Sahi and Selenium)
``` bash
bin/install_deps
bin/install_sahi
bin/install_selenium
```
2. To run all tests - call `bin/run_all_tests`
If you want to run specific driver tests, use appropriate PHPUnit group
and make sure that `Sahi`/`Selenium` is runned if you want to test
one of them:
``` bash
bin/start_sahi
phpunit --group sahidriver
bin/kill_sahi
```
``` bash
bin/start_selenium
phpunit --group seleniumdriver
bin/kill_selenium
```
`Zombie` and `Goutte` driver tests doesn't require some specific proxy
to be runned and could be tested as is:
``` bash
phpunit --group zombiedriver
```
``` bash
phpunit --group gouttedriver
```
Translated languages
--------------------
For now exists 6 translated language: `es`,`fr`,`ja`,`nl`,`pt`,`ru`.
**Note:** The `es` and `fr` are outdated.
#### How to add a new translated language?
If you want to translate another language, you can use as reference the `ru` language file under
[translations folder](https://github.com/Behat/Mink/tree/develop/src/Behat/Mink/Behat/Context/translations).
Then add it in [MinkContext](https://github.com/Behat/Mink/blob/develop/src/Behat/Mink/Behat/Context/MinkContext.php) after line #657.
**Important:** The filename must match with the same translated language file in [Behat](https://github.com/Behat/Behat/tree/master/i18n) and [Gherkin](https://github.com/Behat/Gherkin/tree/master/i18n) in order to work correctly. If the language does not exist in [Gherkin](https://github.com/Behat/Gherkin/tree/master/i18n) and [Behat](https://github.com/Behat/Behat/tree/master/i18n) you must add it there too.
Copyright
---------
Copyright (c) 2011 Konstantin Kudryashov (ever.zet). See LICENSE for details.
Contributors
------------
* Konstantin Kudryashov [everzet](http://github.com/everzet) [lead developer]
* Pascal Cremer [b00giZm](http://github.com/b00giZm) [ZombieDriver creator]
* Alexandre Salomé [alexandresalome](http://github.com/alexandresalome) [SeleniumDriver creator]
* Pete Otaqui [pete-otaqui](http://github.com/pete-otaqui) [Selenium2Driver creator]
Sponsors
--------
* knpLabs [knpLabs](http://www.knplabs.com/) [main sponsor]
PK Uq
! ! % features/bootstrap/FeatureContext.phpnu ٘ useContext('mink', new Behat\Mink\Behat\Context\MinkContext($parameters));
}
}
PK U1wn features/mink_feature.featurenu ٘ Feature: Mink steps
In order to describe web application behavior
As a web developer
I need to be able to talk with Mink through Behat features
@javascript
Scenario: Basic form (through Sahi)
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"
Then I should see "Anket for Konstantin"
And I should see "Lastname: Kudryashov"
Scenario: Basic form (through Goutte)
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"
Then I should see "Anket for Konstantin"
And I should see "Lastname: Kudryashov"
PK Ug<} } features/mink_feature_ru.featurenu ٘ # language: ru
Функционал: Шаги Mink
Для того, чтобы описывать поведение веб-приложений
Как веб-девелопер
Мне нужна возможность говорить с Mink через Behat
@mink:zombie
Сценарий: Стандартная форма (через Sahi)
Допустим я на странице "basic_form.php"
Когда я ввожу "Konstantin" в поле "first_name"
И ввожу "Kudryashov" в поле "lastn"
И я нажимаю "Save"
Тогда я должен видеть "Anket for Konstantin"
И я должен видеть "Lastname: Kudryashov"
Сценарий: Стандартная форма (через Goutte)
Допустим я на странице "basic_form.php"
Когда я заполняю поле "first_name" значением "Konstantin"
И заполняю поле "lastn" значением "Kudryashov"
И нажимаю "Save"
Тогда я должен видеть "Anket for Konstantin"
И я должен видеть "Lastname: Kudryashov"
PK Uy y phpdoc.ini.distnu ٘ ; 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 ".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 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 PHPDoctor: The PHP Documentation Creator"
; Create a class tree?
tree = on
PK U. .
.gitignorenu ٘ *.tgz
*.phar
phpunit.xml
composer.lock
vendor
PK UB B * src/Behat/Mink/Element/DocumentElement.phpnu ٘
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Document element.
*
* @author Konstantin Kudryashov
*/
class DocumentElement extends TraversableElement
{
/**
* @see Behat\Mink\Element\ElementInterface::getXpath()
*/
public function getXpath()
{
return '//html';
}
/**
* Returns document content.
*
* @return string
*/
public function getContent()
{
return trim($this->getSession()->getDriver()->getContent());
}
/**
* Check whether document has specified content.
*
* @param string $content
*
* @return Boolean
*/
public function hasContent($content)
{
return $this->has('named', array(
'content', $this->getSession()->getSelectorsHandler()->xpathLiteral($content)
));
}
}
PK UĀ " src/Behat/Mink/Element/Element.phpnu ٘
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Base element.
*
* @author Konstantin Kudryashov
*/
abstract class Element implements ElementInterface
{
private $session;
/**
* Initialize element.
*
* @param Behat\Mink\Session $session
*/
public function __construct(Session $session)
{
$this->session = $session;
}
/**
* Returns element session.
*
* @return Behat\Mink\Session
*/
public function getSession()
{
return $this->session;
}
/**
* @see Behat\Mink\Element\ElementInterface::findAll()
*/
public function has($selector, $locator)
{
return null !== $this->find($selector, $locator);
}
/**
* @see Behat\Mink\Element\ElementInterface::find()
*/
public function find($selector, $locator)
{
$items = $this->findAll($selector, $locator);
return count($items) ? current($items) : null;
}
/**
* @see Behat\Mink\Element\ElementInterface::findAll()
*/
public function findAll($selector, $locator)
{
$xpath = $this->getSession()->getSelectorsHandler()->selectorToXpath($selector, $locator);
// add parent xpath before element selector
if (0 === strpos($xpath, '/')) {
$xpath = $this->getXpath().$xpath;
} else {
$xpath = $this->getXpath().'/'.$xpath;
}
return $this->getSession()->getDriver()->find($xpath);
}
/**
* @see Behat\Mink\Element\ElementInterface::getText()
*/
public function getText()
{
return $this->getSession()->getDriver()->getText($this->getXpath());
}
/**
* @see Behat\Mink\Element\ElementInterface::getHtml()
*/
public function getHtml()
{
return $this->getSession()->getDriver()->getHtml($this->getXpath());
}
}
PK UTzu u + src/Behat/Mink/Element/ElementInterface.phpnu ٘
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Element interface.
*
* @author Konstantin Kudryashov
*/
interface ElementInterface
{
/**
* Returns XPath for handled element.
*
* @return string
*/
function getXpath();
/**
* Returns element's session.
*
* @return Behat\Mink\Session
*/
function getSession();
/**
* Checks whether element with specified selector exists.
*
* @param string $selector selector engine name
* @param string $locator selector locator
*
* @return Boolean
*/
function has($selector, $locator);
/**
* Finds first element with specified selector.
*
* @param string $selector selector engine name
* @param string $locator selector locator
*
* @return Behat\Mink\Element\NodeElement|null
*/
function find($selector, $locator);
/**
* Finds all elements with specified selector.
*
* @param string $selector selector engine name
* @param string $locator selector locator
*
* @return array
*/
function findAll($selector, $locator);
/**
* Returns element text (inside tag).
*
* @return string|null
*/
function getText();
/**
* Returns element html.
*
* @return string|null
*/
function getHtml();
}
PK UF;} } &