Skip to content

Commit 693d0db

Browse files
author
Florent Morselli
committed
Update
1 parent ff62c55 commit 693d0db

File tree

8 files changed

+151
-132
lines changed

8 files changed

+151
-132
lines changed

.travis.yml

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
language: php
22

3-
php:
4-
- 5.4
5-
- 5.5
6-
- 5.6
7-
- 7.0
8-
- hhvm
3+
sudo: false
94

105
matrix:
11-
fast_finish: true
12-
include:
13-
- php: 5.6
14-
env: GUZZLE_VERSION=4.*
15-
16-
before_install:
17-
# start a web server on port 8080, running in the background
18-
- bin/start_server.sh
6+
fast_finish: true
7+
allow_failures:
8+
- php: nightly
9+
include:
10+
- php: 5.6
11+
- php: 5.6
12+
env: deps=low
13+
- php: 7.0
14+
- php: hhvm
15+
- php: nightly
16+
- php: nightly
17+
env: deps=low
1918

2019
before_script:
21-
- composer self-update
22-
- if [ "$GUZZLE_VERSION" != "" ]; then composer require "guzzlehttp/guzzle:${GUZZLE_VERSION}" --no-update; fi;
23-
- composer install --prefer-source
24-
- export LANG=C
25-
- export PATH=vendor/bin:$PATH
20+
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then phpenv config-rm xdebug.ini; fi;'
21+
- composer self-update
22+
- if [[ $deps = low ]]; then composer update --no-interaction --prefer-lowest ; fi
23+
- if [[ !$deps ]]; then composer install --no-interaction ; fi
24+
- export LANG=C
25+
- export PATH=vendor/bin:$PATH
2626

2727
script:
28-
- behat -fprogress --strict
28+
- vendor/bin/behat -fprogress --strict
2929

3030
after_failure:
3131
- cat server.log

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
],
1818

1919
"require": {
20-
"php": ">=5.4",
20+
"php": "^5.6|^7.0",
2121
"behat/behat": "~3.0",
22-
"guzzlehttp/guzzle": "4 - 6",
23-
"phpunit/phpunit": "4 - 5"
22+
"guzzlehttp/guzzle": "^6.0",
23+
"beberlei/assert": "^2.4"
2424
},
2525

2626
"require-dev": {

doc/index.rst

+10
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,13 @@ The easiest way to keep your suite updated is to use `Composer <http://getcompos
4444
4545
Usage
4646
-----
47+
48+
Configuring the guzzle client
49+
50+
.. code-block:: yaml
51+
# behat.yml
52+
default:
53+
# ...
54+
extensions:
55+
Behat\WebApiExtension:
56+
base_url: https://localhost

features/bootstrap/FeatureContext.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use Assert\Assertion;
34
use Behat\Behat\Context\SnippetAcceptingContext;
45
use Behat\Gherkin\Node\PyStringNode;
56
use Symfony\Component\Process\PhpExecutableFinder;
@@ -119,7 +120,7 @@ public function itShouldPassWith($success, PyStringNode $text)
119120
*/
120121
public function theOutputShouldContain(PyStringNode $text)
121122
{
122-
PHPUnit_Framework_Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
123+
Assertion::contains($this->getOutput(), $this->getExpectedOutput($text));
123124
}
124125

125126
private function getExpectedOutput(PyStringNode $expectedText)
@@ -162,13 +163,13 @@ public function itShouldFail($success)
162163
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
163164
}
164165

165-
PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode());
166+
Assertion::notEq(0, $this->getExitCode());
166167
} else {
167168
if (0 !== $this->getExitCode()) {
168169
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
169170
}
170171

171-
PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode());
172+
Assertion::eq(0, $this->getExitCode());
172173
}
173174
}
174175

features/context.feature

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Feature: client aware context
88
"""
99
<?php
1010
11+
use Assert\Assertion;
1112
use Behat\WebApiExtension\Context\ApiClientAwareContext;
1213
use GuzzleHttp\ClientInterface;
1314
@@ -24,7 +25,7 @@ Feature: client aware context
2425
* @Then /^the client should be set$/
2526
*/
2627
public function theClientShouldBeSet() {
27-
PHPUnit_Framework_Assert::assertInstanceOf('GuzzleHttp\Client', $this->client);
28+
Assertion::isInstanceOf($this->client, 'GuzzleHttp\ClientInterface');
2829
}
2930
}
3031
"""

src/Context/ApiClientAwareContext.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface ApiClientAwareContext extends Context
2525
/**
2626
* Sets Guzzle Client instance.
2727
*
28-
* @param \GuzzleHttp\Client $client Guzzle client.
28+
* @param \GuzzleHttp\ClientInterface $client Guzzle client.
2929
*
3030
* @return void
3131
*/

0 commit comments

Comments
 (0)