2017 © Pedro Peláez
 

library kahlan-mink

Allows the use of Mink inside Kahlan

image

brunty/kahlan-mink

Allows the use of Mink inside Kahlan

  • Wednesday, October 4, 2017
  • by Brunty
  • Repository
  • 1 Watchers
  • 1 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Kahlan Mink

Build Status, (*1)

🌍 Provides functionality to work with Mink within Kahlan. Also provides a way to boot a PHP web server when tests run., (*2)

Inspired and based on this: http://radify.io/blog/end-to-end-functional-testing-with-kahan/ - many thanks to Simon JAILLET for not only Kahlan, but the blog post on end to end testing in Kahlan., (*3)

Requirements

  • PHP >= 7.1
  • Kahlan ^3.0
  • Mink ^1.7
  • Mink Goutte Driver ^1.2

Installation & Usage

composer require brunty/kahlan-mink --dev, (*4)

Once required, setup your configuration file kahlan-config.php to register mink with Kahlan (making sure to pass through $this to the method):, (*5)

<?php // kahlan-config.php

\Brunty\Kahlan\Mink\Mink::register($this);

If you want to start a PHP server when your tests start and stop it when test execution finishes then register the PhpServer with Kahlan as well:, (*6)

<?php // kahlan-config.php

\Brunty\Kahlan\Mink\PhpServer::register($this);

If you want to use the url() helper function, register a base URL in your config file under the brunty.kahlan-mink.base-url key. All URLs via the url() function will be appended to this., (*7)

<?php

\Kahlan\box('brunty.kahlan-mink.base-url', 'http://localhost:8888');

Based on the above, calling url('my-page') will return http://localhost:8888/my-page, (*8)

Once that's done, you can use the functions to access things via Mink:, (*9)

  • \Brunty\Kahlan\Mink\browser(string $sessionName = 'default'): Session returns the instance of Mink inside our test suite.
  • \Brunty\Kahlan\Mink\page($sessionName = 'default'): DocumentElement returns the page we're currently accessing.
  • \Brunty\Kahlan\Mink\element($locator = 'body', Element $parent = null): Element find an element on the page we're browsing.
<?php // spec/MySiteSpec.php

use function Brunty\Kahlan\Mink\browser;
use function Brunty\Kahlan\Mink\element;

describe('My website', function () {
    it('accesses the site', function () {
        browser()->visit('http://localhost:8888/my-page');
        expect(element('#content p')->getText())->toContain('Hello world!');
    });
});

Contributing

This started as a small personal project., (*10)

Although this project is small, openness and inclusivity are taken seriously. To that end a code of conduct (listed in the contributing guide) has been adopted., (*11)

Contributor Guide, (*12)

The Versions

04/10 2017

dev-master

9999999-dev

Allows the use of Mink inside Kahlan

  Sources   Download

MIT

The Requires

 

04/10 2017

0.2.5

0.2.5.0

Allows the use of Mink inside Kahlan

  Sources   Download

MIT

The Requires

 

04/10 2017

0.2.4

0.2.4.0

Allows the use of Mink inside Kahlan

  Sources   Download

MIT

The Requires

 

04/10 2017

0.2.2

0.2.2.0

Allows the use of Mink inside Kahlan

  Sources   Download

MIT

The Requires

 

04/10 2017

0.2.3

0.2.3.0

Allows the use of Mink inside Kahlan

  Sources   Download

MIT

The Requires

 

04/10 2017

0.2.1

0.2.1.0

Allows the use of Mink inside Kahlan

  Sources   Download

MIT

The Requires

 

04/10 2017

0.2.0

0.2.0.0

Allows the use of Mink inside Kahlan

  Sources   Download

MIT

The Requires

 

28/08 2017

0.1

0.1.0.0

Allows the use of Mink inside Kahlan

  Sources   Download

MIT

The Requires