One of the most important parts in the web is a browser. A browser is the window through which web users interact with web applications and other users. Users are always talking with web applications through browsers.
So, in order to test that our web application behaves correctly, we need a way to simulate this interaction between the browser and the web application in our tests. We need Mink.
Mink is an open source browser controller/emulator for web applications, written in PHP.
Read :doc:`/at-a-glance` to learn more about Mink and why you need it.
Mink is a php library that you'll use inside your test suites or project. Before you begin, ensure that you have at least PHP 5.4 installed.
The recommended way to install Mink with all its dependencies is through Composer:
$ composer require --dev behat/mink
Note
For local installations of composer you must call it like this:
$ php composer.phar require --dev behat/mink
.
In this case you must use the different call
php composer.phar
everywhere instead of the simple command composer
.
Everything will be installed inside the vendor
folder.
Finally, include the Composer autoloading script to your project:
require_once 'vendor/autoload.php';
Note
By default, Mink will be installed with no drivers. In order to be able to use additional drivers, you should install them (through composer). Require the appropriate dependencies:
- GoutteDriver -
behat/mink-goutte-driver
- Selenium2Driver -
behat/mink-selenium2-driver
- BrowserKitDriver -
behat/mink-browserkit-driver
- ChromeDriver -
dmore/chrome-mink-driver
- ZombieDriver -
behat/mink-zombie-driver
- SeleniumDriver -
behat/mink-selenium-driver
- SahiDriver -
behat/mink-sahi-driver
- WUnitDriver -
behat/mink-wunit-driver
If you're a newcomer or just don't know what to choose, you should probably start with the GoutteDriver and the Selenium2Driver (you will be able to tune it up later):
Learn Mink with the topical guides:
.. toctree:: :maxdepth: 1 at-a-glance guides/session guides/traversing-pages guides/manipulating-pages guides/interacting-with-pages guides/drivers guides/managing-sessions contributing
Mink has integrations for several testing tools:
- Behat through the Behat MinkExtension
- PHPUnit through the phpunit-mink package