This file contains hidden or 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
| <?php | |
| /* | |
| You can't use classes like this to define steps by the simple reason: | |
| in Behat and Cucumber, step definitions and test contexts ARE two | |
| splitted logical elements, not one. Different step definitions | |
| can be used together in different scenarios and each scenario will | |
| have it's own context (environment) object. That's the main logical | |
| idea behind Behat - define step once - use it everywhere. |
This file contains hidden or 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
| <?php | |
| /* | |
| Why i think, that "RSpec is not possible in PHP"? | |
| Cuz Ruby's syntax abilities can represent | |
| natural language constructions: | |
| object should equals 2 |
This file contains hidden or 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
| <?php | |
| // how that: | |
| class DescribeContextZend extends PHPSpec_Context | |
| { | |
| public function itShouldSetControllerNameUsingContextClass() | |
| { | |
| $context = new DescribeFooController; | |
| $this->spec($context->getController())->should->be('Foo'); |
This file contains hidden or 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
| framework: | |
| test: ~ | |
| behat_mink: | |
| start_url: http://your_app_local.url/app_dev.php/ | |
| behat: ~ |
This file contains hidden or 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
| Feature: REST API | |
| In order to be able to build my own tool for web application | |
| As a developer | |
| I need to have clean REST API for application | |
| Scenario: List all users | |
| Given application has users: | |
| | name | email | | |
| | ivan | ivan@ex.com | | |
| | dima | dima@ex.com | |
This file contains hidden or 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
| <?php | |
| use Symfony\Component\ResourceWatcher\ResourceWatcher, | |
| Symfony\Component\ResourceWatcher\Event\Event, | |
| Symfony\Component\Config\Resource\DirectoryResource, | |
| Symfony\Component\Config\Resource\FileResource; | |
| $watcher = new ResourceWatcher(); | |
| $watcher->track(new DirectoryResource('/some/directory'), function($event) { |
This file contains hidden or 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
| Feature: New Study | |
| In order to create a new Study | |
| As a Researcher | |
| I must be able to enter information about the study and save it | |
| Scenario Outline: Researcher adds new study | |
| When I enter <study name> | |
| And I enter <short url> | |
| And I enter <welcome text> | |
| And I set self registration to <self registration> |
This file contains hidden or 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
| <?php | |
| $steps->Then('/^it should pass with:$/', function($world, $data) { | |
| try { | |
| assertEquals((string) $data, $world->output); | |
| } catch (\Exception $e) { | |
| $exceptionDiff = \PHPUnit_Framework_TestFailure::exceptionToString($e); | |
| throw new \Exception($exceptionDiff, $e->getCode(), $e); | |
| } | |
| }); |
This file contains hidden or 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
| # RSpec (aka "Best in Ruby"): | |
| @account.balance.should == 12 | |
| # PHPUnit (aka "Best in PHP"): | |
| $this->assertEquals(12, $account->getBalance()); | |
| # PHPSpec: |
This file contains hidden or 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
| <?php | |
| require_once '/sahi/driver/path/autoload.php.dist'; | |
| use Everzet\SahiDriver; | |
| $connection = new SahiDriver\Connection('@@SAHI_SESSION_ID@@'); // replace with your custom session ID | |
| $browser = new SahiDriver\Browser($connection); | |
| $browser->navigateTo('http://shopopensky.com/'); |