functions that you can call, these days usually organized into classes.” “A framework embodies some abstract design, with more behavior built in. In order to use it you need to insert your behavior into various places in the framework either by subclassing or by plugging in your own classes. The framework's code then calls your code at these points.” Martin Fowler http://martinfowler.com/bliki/InversionOfContr ol.html
all $app->get(‘/project/{id}’, function () { ... }); // View one $app->post(‘/project’, function (Request $request) { ... }); // Create one $app->put(‘/project/{id}’, function (Request $request) { ... }); // Update one $app->delete(‘/project/{id}’, function (Request $request) { ... }); // Delete one
Restful Api $ composer require --dev behat/common-contexts Feature: Project As a QA I should be able to manage projects Scenario: List of projects When I send a GET request to "/project/" Then the response code should be 200 And response should contain json: """ [ {"id": “1", "name": "project 1”}, {"id": “2", "name": "project 2”} ] """
context: class: FeatureContext <?php // Customize context to load data fixtures right before tests class FeatureContext extends BehatContext { /** @BeforeScenario */ public function before($event) { //load data into database } /** @AfterScenario */ public function after($event) { // clean data } ?>