From 87732a64c20d2036ecec6b00a55c00dd25ebadff Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Wed, 7 Jun 2017 21:39:50 +0200 Subject: [PATCH 01/13] Xdebug support, mocking and tests --- .gitignore | 2 + behat.yml.dist | 6 ++- composer.json | 82 +++++++++++++++++-------------- features/search.feature | 4 +- features/src/FeatureContext.php | 86 +++++++++++++++++++++++++++++++++ features/xdebug.feature | 17 +++++++ 6 files changed, 157 insertions(+), 40 deletions(-) create mode 100644 features/src/FeatureContext.php create mode 100644 features/xdebug.feature diff --git a/.gitignore b/.gitignore index e3897102..72c28984 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.phar composer.lock vendor +.idea +behat.yml diff --git a/behat.yml.dist b/behat.yml.dist index e0cbd419..8da251ba 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -2,10 +2,12 @@ default: suites: default: path: %paths.base%/features - contexts: [Behat\MinkExtension\Context\MinkContext] + contexts: + - Behat\MinkExtension\Context\MinkContext + - Behat\MinkExtension\Tests\FeatureContext extensions: Behat\MinkExtension: - base_url: http://en.wikipedia.org/ + base_url: http://localhost:8082 sessions: default: goutte: ~ diff --git a/composer.json b/composer.json index 2e721d13..7b8aa4bc 100644 --- a/composer.json +++ b/composer.json @@ -1,40 +1,50 @@ { - "name": "behat/mink-extension", - "type": "behat-extension", - "description": "Mink extension for Behat", - "keywords": ["web", "test", "browser", "gui"], - "homepage": "http://extensions.behat.org/mink", - "license": "MIT", - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com" - }, - { - "name": "Christophe Coevoet", - "email": "stof@notk.org" - } - ], - - "require": { - "php": ">=5.3.2", - "behat/behat": "~3.0,>=3.0.5", - "behat/mink": "~1.5", - "symfony/config": "~2.2|~3.0" + "name": "behat/mink-extension", + "type": "behat-extension", + "description": "Mink extension for Behat", + "keywords": [ + "web", + "test", + "browser", + "gui" + ], + "homepage": "http://extensions.behat.org/mink", + "license": "MIT", + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com" }, - - "require-dev": { - "phpspec/phpspec": "~2.0", - "behat/mink-goutte-driver": "~1.1" - }, - - "autoload": { - "psr-0": { "Behat\\MinkExtension": "src/" } - }, - - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + } + ], + "require": { + "php": ">=5.3.2", + "behat/behat": "~3.0,>=3.0.5", + "behat/mink": "~1.5", + "symfony/config": "~2.2|~3.0" + }, + "require-dev": { + "phpspec/phpspec": "~2.0", + "behat/mink-goutte-driver": "~1.1", + "internations/http-mock": "^0.10.0", + "phpunit/phpunit": "^6.2" + }, + "autoload": { + "psr-0": { + "Behat\\MinkExtension": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Behat\\MinkExtension\\Tests\\": "features/src" + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" } + } } diff --git a/features/search.feature b/features/search.feature index b4e08efc..14dc9e27 100644 --- a/features/search.feature +++ b/features/search.feature @@ -4,13 +4,13 @@ Feature: Search I need to be able to search for a word Scenario: Searching for a page that does exist - Given I am on "/wiki/Main_Page" + Given I am on "http://en.wikipedia.org/wiki/Main_Page" When I fill in "search" with "Behavior Driven Development" And I press "searchButton" Then I should see "agile software development" Scenario: Searching for a page that does NOT exist - Given I am on "/wiki/Main_Page" + Given I am on "http://en.wikipedia.org/wiki/Main_Page" When I fill in "search" with "Glory Driven Development" And I press "searchButton" Then I should see "Search results" diff --git a/features/src/FeatureContext.php b/features/src/FeatureContext.php new file mode 100644 index 00000000..567b6255 --- /dev/null +++ b/features/src/FeatureContext.php @@ -0,0 +1,86 @@ +setUpHttpMock(); + + $this->http->mock->when() + ->methodIs('GET') + ->pathIs('/foo') + ->then() + ->body('Request body') + ->end(); + $this->http->setUp(); + } + + /** + * @AfterScenario + */ + public function tearDown() { + static::tearDownHttpMockAfterClass(); + $this->tearDownHttpMock(); + } + + /** + * @BeforeScenario @xdebug + */ + public function setUpXdebug() { + $this->getSession()->setCookie('XDEBUG_SESSION_START', 'xdebug'); + } + + /** + * Mocking the phpunit assertion as it is used by HttpMockTrait. + */ + public static function assertSame($message, $argument_1, $argument_2) { + return $argument_1 !== $argument_2; + } + + /** + * @Then /^I should have the "([^"]*)" cookie with value "([^"]*)"$/ + */ + public function iShouldHaveTheCookieWithValue($cookie_name, $cookie_expected_value) { + if ($cookie_real_value = $this->getSession()->getCookie($cookie_name)) { + if ($cookie_real_value !== $cookie_expected_value) { + throw new ExpectationException( + 'The cookie with name ' . $cookie_name . ' was found, but does not contain ' . $cookie_real_value . ', yet it contains ' . $cookie_expected_value . '.', + $this->getSession() + ); + } + } + else { + throw new ExpectationException( + 'The cookie with name ' . $cookie_name . ' was not found', + $this->getSession() + ); + } + } + + /** + * @Then /^I should not have the "([^"]*)" cookie$/ + */ + public function iShouldNotHaveTheCookie($cookie_name) { + if ($cookie_real_value = $this->getSession()->getCookie($cookie_name)) { + throw new ExpectationException( + 'The cookie with name ' . $cookie_name . ' was not found, but it should not be present.', + $this->getSession() + ); + } + } + +} diff --git a/features/xdebug.feature b/features/xdebug.feature new file mode 100644 index 00000000..8996a6ca --- /dev/null +++ b/features/xdebug.feature @@ -0,0 +1,17 @@ +Feature: Xdebug + In order to properly develop with BDD + As a feature developer + I need to be able to use my debugger + + Scenario: Xdebug cookie should not be present on normal requests + Given I am on "/foo" + Then I should not have the "XDEBUG_SESSION_START" cookie + + @xdebug + Scenario: Xdebug cookie should be passed on to requests + Given I am on "/foo" + Then I should have the "XDEBUG_SESSION_START" cookie with value "xdebug" + + Scenario: When running php with xdebug from the command line the cookie should be set + Given I am on "/foo" + Then I should have the "XDEBUG_SESSION_START" cookie with value "xdebug" From ed535915fa72909bfe3d382e1fb40ddfc47f927e Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Wed, 7 Jun 2017 22:20:47 +0200 Subject: [PATCH 02/13] Coding standards and simplefied mocking --- features/src/FeatureContext.php | 131 +++++++++--------- features/xdebug.feature | 10 +- .../MinkExtension/Context/RawMinkContext.php | 13 ++ 3 files changed, 84 insertions(+), 70 deletions(-) diff --git a/features/src/FeatureContext.php b/features/src/FeatureContext.php index 567b6255..9a25ffc9 100644 --- a/features/src/FeatureContext.php +++ b/features/src/FeatureContext.php @@ -9,78 +9,83 @@ /** * Feature context for testing advanced scenarios. */ -class FeatureContext extends RawMinkContext { +class FeatureContext extends RawMinkContext +{ - use HttpMockTrait; + use HttpMockTrait; - /** - * @BeforeScenario - */ - public function setUp() { - static::setUpHttpMockBeforeClass('8082', 'localhost'); - $this->setUpHttpMock(); + /** + * @BeforeScenario + */ + public function setUp() + { + static::setUpHttpMockBeforeClass('8082', 'localhost'); + $this->setUpHttpMock(); - $this->http->mock->when() - ->methodIs('GET') - ->pathIs('/foo') - ->then() - ->body('Request body') - ->end(); - $this->http->setUp(); - } - - /** - * @AfterScenario - */ - public function tearDown() { - static::tearDownHttpMockAfterClass(); - $this->tearDownHttpMock(); - } + $this->http->mock->when() + ->methodIs('GET') + ->pathIs('/foo') + ->then() + ->body('Request body') + ->end(); + $this->http->setUp(); + } - /** - * @BeforeScenario @xdebug - */ - public function setUpXdebug() { - $this->getSession()->setCookie('XDEBUG_SESSION_START', 'xdebug'); - } + /** + * @AfterScenario + */ + public function tearDown() + { + static::tearDownHttpMockAfterClass(); + $this->tearDownHttpMock(); + } - /** - * Mocking the phpunit assertion as it is used by HttpMockTrait. - */ - public static function assertSame($message, $argument_1, $argument_2) { - return $argument_1 !== $argument_2; - } + /** + * @BeforeScenario @MockXdebug + */ + public function setUpXdebugMock() + { + $_SERVER['XDEBUG_CONFIG'] = 'xdebug'; + } - /** - * @Then /^I should have the "([^"]*)" cookie with value "([^"]*)"$/ - */ - public function iShouldHaveTheCookieWithValue($cookie_name, $cookie_expected_value) { - if ($cookie_real_value = $this->getSession()->getCookie($cookie_name)) { - if ($cookie_real_value !== $cookie_expected_value) { - throw new ExpectationException( - 'The cookie with name ' . $cookie_name . ' was found, but does not contain ' . $cookie_real_value . ', yet it contains ' . $cookie_expected_value . '.', - $this->getSession() - ); - } + /** + * Mocking the phpunit assertion as it is used by HttpMockTrait. + */ + public static function assertSame($message, $argument_1, $argument_2) + { + return $argument_1 !== $argument_2; } - else { - throw new ExpectationException( - 'The cookie with name ' . $cookie_name . ' was not found', - $this->getSession() - ); + + /** + * @Then /^I should have the "([^"]*)" cookie with value "([^"]*)"$/ + */ + public function iShouldHaveTheCookieWithValue($cookie_name, $cookie_expected_value) { + if ($cookie_real_value = $this->getSession()->getCookie($cookie_name)) { + if ($cookie_real_value !== $cookie_expected_value) { + throw new ExpectationException( + 'The cookie with name ' . $cookie_name . ' was found, but does not contain ' . $cookie_real_value . ', yet it contains ' . $cookie_expected_value . '.', + $this->getSession() + ); + } + } else { + throw new ExpectationException( + 'The cookie with name ' . $cookie_name . ' was not found', + $this->getSession() + ); + } } - } - /** - * @Then /^I should not have the "([^"]*)" cookie$/ - */ - public function iShouldNotHaveTheCookie($cookie_name) { - if ($cookie_real_value = $this->getSession()->getCookie($cookie_name)) { - throw new ExpectationException( - 'The cookie with name ' . $cookie_name . ' was not found, but it should not be present.', - $this->getSession() - ); + /** + * @Then /^I should not have the "([^"]*)" cookie$/ + */ + public function iShouldNotHaveTheCookie($cookie_name) + { + if ($cookie_real_value = $this->getSession()->getCookie($cookie_name)) { + throw new ExpectationException( + 'The cookie with name ' . $cookie_name . ' was not found, but it should not be present.', + $this->getSession() + ); + } } - } } diff --git a/features/xdebug.feature b/features/xdebug.feature index 8996a6ca..865d03d1 100644 --- a/features/xdebug.feature +++ b/features/xdebug.feature @@ -5,13 +5,9 @@ Feature: Xdebug Scenario: Xdebug cookie should not be present on normal requests Given I am on "/foo" - Then I should not have the "XDEBUG_SESSION_START" cookie + Then I should not have the "XDEBUG_SESSION" cookie - @xdebug + @MockXdebug Scenario: Xdebug cookie should be passed on to requests Given I am on "/foo" - Then I should have the "XDEBUG_SESSION_START" cookie with value "xdebug" - - Scenario: When running php with xdebug from the command line the cookie should be set - Given I am on "/foo" - Then I should have the "XDEBUG_SESSION_START" cookie with value "xdebug" + Then I should have the "XDEBUG_SESSION" cookie with value "xdebug" diff --git a/src/Behat/MinkExtension/Context/RawMinkContext.php b/src/Behat/MinkExtension/Context/RawMinkContext.php index 8e0a9279..dc1c7187 100644 --- a/src/Behat/MinkExtension/Context/RawMinkContext.php +++ b/src/Behat/MinkExtension/Context/RawMinkContext.php @@ -25,6 +25,19 @@ class RawMinkContext implements MinkAwareContext private $mink; private $minkParameters; + + /** + * Currently supports PHPSTORM. + * + * @beforeScenario + */ + public function setUpXdebugIfIdeIsConfigured() + { + if (isset($_SERVER['XDEBUG_CONFIG'])) { + $this->getSession()->setCookie('XDEBUG_SESSION', 'xdebug'); + } + } + /** * Sets Mink instance. * From 89a5c7cc0c6e95873c3c1a4ee92c16cd552aab96 Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Wed, 7 Jun 2017 22:25:43 +0200 Subject: [PATCH 03/13] Remove phpunit --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 7b8aa4bc..a392ed54 100644 --- a/composer.json +++ b/composer.json @@ -29,8 +29,7 @@ "require-dev": { "phpspec/phpspec": "~2.0", "behat/mink-goutte-driver": "~1.1", - "internations/http-mock": "^0.10.0", - "phpunit/phpunit": "^6.2" + "internations/http-mock": "^0.10.0" }, "autoload": { "psr-0": { From 5005c1b850841f951e00ca7329b207700733cc7a Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Wed, 7 Jun 2017 22:26:53 +0200 Subject: [PATCH 04/13] Remove double break --- src/Behat/MinkExtension/Context/RawMinkContext.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Behat/MinkExtension/Context/RawMinkContext.php b/src/Behat/MinkExtension/Context/RawMinkContext.php index dc1c7187..43c58abb 100644 --- a/src/Behat/MinkExtension/Context/RawMinkContext.php +++ b/src/Behat/MinkExtension/Context/RawMinkContext.php @@ -25,7 +25,6 @@ class RawMinkContext implements MinkAwareContext private $mink; private $minkParameters; - /** * Currently supports PHPSTORM. * From ea815b1f53fa355914f0f30963992c568759c9b9 Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Wed, 7 Jun 2017 22:32:58 +0200 Subject: [PATCH 05/13] Remove http mocking --- composer.json | 3 +-- features/src/FeatureContext.php | 37 --------------------------------- features/xdebug.feature | 4 ++-- 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/composer.json b/composer.json index a392ed54..d5ec1305 100644 --- a/composer.json +++ b/composer.json @@ -28,8 +28,7 @@ }, "require-dev": { "phpspec/phpspec": "~2.0", - "behat/mink-goutte-driver": "~1.1", - "internations/http-mock": "^0.10.0" + "behat/mink-goutte-driver": "~1.1" }, "autoload": { "psr-0": { diff --git a/features/src/FeatureContext.php b/features/src/FeatureContext.php index 9a25ffc9..6ab810bc 100644 --- a/features/src/FeatureContext.php +++ b/features/src/FeatureContext.php @@ -4,7 +4,6 @@ use Behat\Mink\Exception\ExpectationException; use Behat\MinkExtension\Context\RawMinkContext; -use InterNations\Component\HttpMock\PHPUnit\HttpMockTrait; /** * Feature context for testing advanced scenarios. @@ -12,34 +11,6 @@ class FeatureContext extends RawMinkContext { - use HttpMockTrait; - - /** - * @BeforeScenario - */ - public function setUp() - { - static::setUpHttpMockBeforeClass('8082', 'localhost'); - $this->setUpHttpMock(); - - $this->http->mock->when() - ->methodIs('GET') - ->pathIs('/foo') - ->then() - ->body('Request body') - ->end(); - $this->http->setUp(); - } - - /** - * @AfterScenario - */ - public function tearDown() - { - static::tearDownHttpMockAfterClass(); - $this->tearDownHttpMock(); - } - /** * @BeforeScenario @MockXdebug */ @@ -48,14 +19,6 @@ public function setUpXdebugMock() $_SERVER['XDEBUG_CONFIG'] = 'xdebug'; } - /** - * Mocking the phpunit assertion as it is used by HttpMockTrait. - */ - public static function assertSame($message, $argument_1, $argument_2) - { - return $argument_1 !== $argument_2; - } - /** * @Then /^I should have the "([^"]*)" cookie with value "([^"]*)"$/ */ diff --git a/features/xdebug.feature b/features/xdebug.feature index 865d03d1..5a82e4dc 100644 --- a/features/xdebug.feature +++ b/features/xdebug.feature @@ -4,10 +4,10 @@ Feature: Xdebug I need to be able to use my debugger Scenario: Xdebug cookie should not be present on normal requests - Given I am on "/foo" + Given I am on "http://en.wikipedia.org/wiki/Main_Page" Then I should not have the "XDEBUG_SESSION" cookie @MockXdebug Scenario: Xdebug cookie should be passed on to requests - Given I am on "/foo" + Given I am on "http://en.wikipedia.org/wiki/Main_Page" Then I should have the "XDEBUG_SESSION" cookie with value "xdebug" From e4a39895968419d2de698a5757e17949e1540763 Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Wed, 7 Jun 2017 22:35:18 +0200 Subject: [PATCH 06/13] Update behat.yml.dist --- behat.yml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/behat.yml.dist b/behat.yml.dist index 8da251ba..ff86d66f 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -7,7 +7,7 @@ default: - Behat\MinkExtension\Tests\FeatureContext extensions: Behat\MinkExtension: - base_url: http://localhost:8082 + base_url: http://en.wikipedia.org/ sessions: default: goutte: ~ From fde2070043a2eb53f0ca226738ab931f9c559e9b Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Thu, 8 Jun 2017 07:31:12 +0200 Subject: [PATCH 07/13] Create search.feature --- features/search.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/search.feature b/features/search.feature index 14dc9e27..b4e08efc 100644 --- a/features/search.feature +++ b/features/search.feature @@ -4,13 +4,13 @@ Feature: Search I need to be able to search for a word Scenario: Searching for a page that does exist - Given I am on "http://en.wikipedia.org/wiki/Main_Page" + Given I am on "/wiki/Main_Page" When I fill in "search" with "Behavior Driven Development" And I press "searchButton" Then I should see "agile software development" Scenario: Searching for a page that does NOT exist - Given I am on "http://en.wikipedia.org/wiki/Main_Page" + Given I am on "/wiki/Main_Page" When I fill in "search" with "Glory Driven Development" And I press "searchButton" Then I should see "Search results" From 0d9524c31eecf00551e70811491086f09bf307df Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Thu, 8 Jun 2017 07:32:08 +0200 Subject: [PATCH 08/13] Create xdebug.feature --- features/xdebug.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/xdebug.feature b/features/xdebug.feature index 5a82e4dc..233988e4 100644 --- a/features/xdebug.feature +++ b/features/xdebug.feature @@ -4,10 +4,10 @@ Feature: Xdebug I need to be able to use my debugger Scenario: Xdebug cookie should not be present on normal requests - Given I am on "http://en.wikipedia.org/wiki/Main_Page" + Given I am on "/wiki/Main_Page" Then I should not have the "XDEBUG_SESSION" cookie @MockXdebug Scenario: Xdebug cookie should be passed on to requests - Given I am on "http://en.wikipedia.org/wiki/Main_Page" + Given I am on "/wiki/Main_Page" Then I should have the "XDEBUG_SESSION" cookie with value "xdebug" From 914a018056a27e6bebe4f647dd6539be6641c8f0 Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Thu, 8 Jun 2017 09:49:13 +0200 Subject: [PATCH 09/13] Revert composer json indentation --- composer.json | 86 +++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/composer.json b/composer.json index d5ec1305..ce0cedee 100644 --- a/composer.json +++ b/composer.json @@ -1,48 +1,46 @@ { - "name": "behat/mink-extension", - "type": "behat-extension", - "description": "Mink extension for Behat", - "keywords": [ - "web", - "test", - "browser", - "gui" - ], - "homepage": "http://extensions.behat.org/mink", - "license": "MIT", - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com" + "name": "behat/mink-extension", + "type": "behat-extension", + "description": "Mink extension for Behat", + "keywords": ["web", "test", "browser", "gui"], + "homepage": "http://extensions.behat.org/mink", + "license": "MIT", + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com" + }, + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + } + ], + + "require": { + "php": ">=5.3.2", + "behat/behat": "~3.0,>=3.0.5", + "behat/mink": "~1.5", + "symfony/config": "~2.2|~3.0" }, - { - "name": "Christophe Coevoet", - "email": "stof@notk.org" - } - ], - "require": { - "php": ">=5.3.2", - "behat/behat": "~3.0,>=3.0.5", - "behat/mink": "~1.5", - "symfony/config": "~2.2|~3.0" - }, - "require-dev": { - "phpspec/phpspec": "~2.0", - "behat/mink-goutte-driver": "~1.1" - }, - "autoload": { - "psr-0": { - "Behat\\MinkExtension": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Behat\\MinkExtension\\Tests\\": "features/src" - } - }, - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" + + "require-dev": { + "phpspec/phpspec": "~2.0", + "behat/mink-goutte-driver": "~1.1" + }, + + "autoload": { + "psr-0": { "Behat\\MinkExtension": "src/" } + }, + + "autoload-dev": { + "psr-4": { + "Behat\\MinkExtension\\Tests\\": "features/src" + } + }, + + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } } - } } From 4831d535cb3af8d189632944c6ccfd351bc28a61 Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Thu, 8 Jun 2017 09:50:34 +0200 Subject: [PATCH 10/13] Remove idea from gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 72c28984..55f5feed 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ *.phar composer.lock vendor -.idea behat.yml From b4325e13c3d6be88388db0693bb048812f42022e Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Thu, 8 Jun 2017 09:54:09 +0200 Subject: [PATCH 11/13] Apply correct standards, use existing assertion --- features/src/FeatureContext.php | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/features/src/FeatureContext.php b/features/src/FeatureContext.php index 6ab810bc..942a2894 100644 --- a/features/src/FeatureContext.php +++ b/features/src/FeatureContext.php @@ -22,30 +22,19 @@ public function setUpXdebugMock() /** * @Then /^I should have the "([^"]*)" cookie with value "([^"]*)"$/ */ - public function iShouldHaveTheCookieWithValue($cookie_name, $cookie_expected_value) { - if ($cookie_real_value = $this->getSession()->getCookie($cookie_name)) { - if ($cookie_real_value !== $cookie_expected_value) { - throw new ExpectationException( - 'The cookie with name ' . $cookie_name . ' was found, but does not contain ' . $cookie_real_value . ', yet it contains ' . $cookie_expected_value . '.', - $this->getSession() - ); - } - } else { - throw new ExpectationException( - 'The cookie with name ' . $cookie_name . ' was not found', - $this->getSession() - ); - } + public function iShouldHaveTheCookieWithValue($cookieName, $cookieExpectedValue) + { + $this->assertSession()->cookieEquals($cookieName, $cookieExpectedValue); } /** * @Then /^I should not have the "([^"]*)" cookie$/ */ - public function iShouldNotHaveTheCookie($cookie_name) + public function iShouldNotHaveTheCookie($cookieName) { - if ($cookie_real_value = $this->getSession()->getCookie($cookie_name)) { + if ($this->getSession()->getCookie($cookieName)) { throw new ExpectationException( - 'The cookie with name ' . $cookie_name . ' was not found, but it should not be present.', + 'The cookie with name ' . $cookieName . ' was not found, but it should not be present.', $this->getSession() ); } From 9eae501a0e0f3a9f24f1559e72d80472702f018f Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Thu, 8 Jun 2017 17:42:49 +0200 Subject: [PATCH 12/13] Remove php 5.3 and hhvm from travis --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f125a612..f90b9142 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,9 @@ cache: - $HOME/.composer/cache/files php: - - 5.3 - 5.4 - 5.5 - 5.6 - - hhvm matrix: include: From a037047139131c2f23017c34f588fa8afb8ecf63 Mon Sep 17 00:00:00 2001 From: Harings Rob Date: Mon, 12 Jun 2017 12:58:10 +0200 Subject: [PATCH 13/13] Update php version in composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ce0cedee..c49551ed 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { - "php": ">=5.3.2", + "php": ">=5.4", "behat/behat": "~3.0,>=3.0.5", "behat/mink": "~1.5", "symfony/config": "~2.2|~3.0"