- Added API testing suite for Codeception
- Got Guzzle HTTP requests triggering the testing environment by setting headers and modifying core files. What a pain in the ass.
- Removed composer packages: phpunit, phpspec, behat, mink+extensions, debugbar, verify, specify
- All testing suites (unit, functional, integration, api) are now handled under a single tool umbrella
- Added BaseLaravelCest class to tests/_bootstrap.php for all Cest classes to extend. This base class handles creating and copying new instances of SQLite testing databases for each test scenario.
// tests/api.suite.yml
class_name: ApiGuy
modules:
enabled: [PhpBrowser, Laravel5, REST, Asserts, UnitHelper]
config:
PhpBrowser:
url: http://api.inviction.dev
headers:
Environment: testing/1.0
REST:
url: http://api.inviction.dev
Laravel5:
environment_file: .env.testing
cleanup: false
// Illuminate\Foundation\Bootstrap\DetectEnvironment.php
public function bootstrap(Application $app)
{
try
{
if (@$_SERVER['HTTP_ENVIRONMENT'] == 'testing/1.0')
{
Dotenv::makeMutable();
Dotenv::load($app['path.base'], '.env.testing');
}
else
{
Dotenv::load($app['path.base'], $app->environmentFile());
}
}
catch (InvalidArgumentException $e)
{
//
}
$app->detectEnvironment(function()
{
return env('APP_ENV', 'production');
});
}