<?php
// Put this inside of your featurecontext class
// This assumes the FeatureContext.php class is within app/tests/behat/features/bootstrap

// Another thing to note... I'm using sqlite in memory for these tests, 
// so I'm not worried about the db at the end of the run, just the install and start.

class FeatureContext extends BehatContext //or MinkContext if using Mink
{
   
    /**
     * Laravel app instance
     *
     * @var \Illuminate\Foundation\Application
     */
    protected static $laravel;
    
    
   /**
     * @static
     * @beforeSuite
     */
    public static function bootstrapLaravel()
    {
         // Bootstrap Laravel
        self::$laravel = require __DIR__ . '/../../../../bootstrap/start.php';

        self::$laravel['mail']->pretend(true); 
    }

    /**
     * @static
     * @beforeSuite
     */
    public static function setUpDb()
    {
        self::$laravel['artisan']->call('migrate:install');
    }
    
    
    /**
     * @static
     * @beforeFeature
     */
    public static function prepDb()
    {
        self::$laravel['artisan']->call('migrate:refresh');
        self::$laravel['artisan']->call('db:seed');
    }
}