I'm trying to get some Behavior tests integrated into my API test suite. I'm leveraging Laravel 4.2 and already have a nice suite of unit tests. The problem I'm running into is persistent data after these tests suite run - as well as correctly populated seed data.
I've tried to link sqlite into my bootstrap process following a few examples I've seen in various places online, but all this is really doing is setting up my DB when I call behat from CLI - during the application run (most specifically any curl requests out to the API) laravel still ties my DB to my local configuration which uses a mysql db.
here's an example snippet of a test suite, the Adding a new track
scenario is one where I'd like to have my API use the sqlite when the request and payload is made to my API.
Feature: Tracks
Scenario: Finding all the tracks
When I request "GET /api/v1/tracks"
Then I get a "200" response
Scenario: Finding an invalid track
When I request "GET /api/v1/tracks/1"
Then I get a "404" response
Scenario: Adding a new track
Given I have the payload:
"""
{"title": "behat add", "description": "add description", "short_description": "add short description"}
"""
When I request "POST /api/v1/tracks"
Then I get a "201" response
Here is a snippet of my bootstrap/start.php file. What I'm I am trying to accomplish is for my behat scenario (ie: Adding a new track) request to hit the testing config so I can manage w/ a sqlite db.
$env = $app->detectEnvironment(array(
'local' => array('*.local'),
'production' => array('api'),
'staging' => array('api-staging'),
'virtualmachine' => array('api-vm'),
'testing' => array('*.testing'),
));