Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
parameters: | ||
behat.features.path: test/features/vendo | ||
|
||
behat.steps.path: | ||
- %behat.configuration.path%/features/vendo/steps | ||
- %behat.configuration.path%/features/default/steps |
Submodule default
added at
04de68
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Feature: Shopping cart management | ||
Users can add, modify and delete things in their shopping cart | ||
|
||
Scenario: Add item to cart | ||
Given I am on /product/view/195 | ||
When I click the "Add to cart" link | ||
Then I should see the "Shopping Cart" page | ||
And there should be 1 item in my shopping cart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Feature: Shopping cart checkout | ||
In order for users to get stuff, they have to pay for it | ||
|
||
Scenario: Checkout fails with no data | ||
Given there are items in my cart | ||
When I go to /cart/index | ||
And I click the "Checkout" link | ||
Then I should see the "Checkout goes here" page | ||
When I submit the form | ||
Then I should see the "Checkout goes here" page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
$steps->And('/^there should be (\d+) item in my shopping cart$/', function($world, $num) { | ||
assertTrue(current($world->response->filter('.total_items')->extract(array('_text'))) == $num); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
$steps->Given('/^there are items in my cart$/', function($world) { | ||
$world->visit('cart/add?id=105'); | ||
assertTrue($world->response->filter('.total_items')->extract(array('_text')) > 0); | ||
}); | ||
|
||
$steps->Then('/^I should see the "(.+)" page$/', function($world, $title) { | ||
$text = $world->response->filter('div#content > h2')->extract(array('_text')); | ||
assertSame(current($text), $title); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
/*$steps->When('/^I click the (.+) link$/', function($world, $anchor_text) { | ||
$link = $world->response->selectLink($anchor_text)->link(); | ||
$world->response = $world->client->click($link); | ||
});*/ | ||
|
||
$steps->When('/^I submit the form$/', function($world) { | ||
$form = $world->response->selectButton('Submit')->form(); | ||
$world->client->submit($form); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
// Init kohana | ||
defined('APPPATH') ?: define('APPPATH', 'application/'); | ||
defined('MODPATH') ?: define('MODPATH', 'modules/'); | ||
defined('SYSPATH') ?: define('SYSPATH', 'system/'); | ||
defined('EXT') ?: define('EXT', '.php'); | ||
|
||
require_once APPPATH.'bootstrap.php'; | ||
|
||
require_once 'Zend/Registry.php'; | ||
require_once 'PHPUnit/Autoload.php'; | ||
require_once 'PHPUnit/Framework/Assert/Functions.php'; | ||
require_once 'test/features/goutte.phar'; | ||
|
||
// Create WebClient behavior | ||
$world->client = new \Goutte\Client; | ||
$world->client->setServerParameters(array('HTTP_HOST' => 'vendo')); | ||
$world->response = null; | ||
$world->form = array(); | ||
|
||
// Helpful closures | ||
$world->visit = function($link) use($world) { | ||
$world->response = $world->client->request('GET', $link); | ||
}; |