Skip to content

Instantly share code, notes, and snippets.

@bgallagh3r
Last active April 8, 2018 01:51
Show Gist options
  • Select an option

  • Save bgallagh3r/dc39f8bb18c380214919 to your computer and use it in GitHub Desktop.

Select an option

Save bgallagh3r/dc39f8bb18c380214919 to your computer and use it in GitHub Desktop.

Revisions

  1. bgallagh3r revised this gist May 22, 2014. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions FeatureContext.php
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,15 @@

    class FeatureContext extends BehatContext //or MinkContext if using Mink
    {

    /**
    * Laravel app instance
    *
    * @var \Illuminate\Foundation\Application
    */
    protected static $laravel;


    /**
    * @static
    * @beforeSuite
  2. bgallagh3r revised this gist May 22, 2014. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions FeatureContext.php
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    <?php
    // Put this inside of your featurecontext class
    // This assumes the FeatureContext.php class is within app/tests/behat/features/bootstrap

    @@ -12,11 +13,10 @@ class FeatureContext extends BehatContext //or MinkContext if using Mink
    */
    public static function bootstrapLaravel()
    {
    $unitTesting = true;
    $testEnvironment = 'testing';
    require_once __DIR__.'/../../../../../bootstrap/start.php';
    // Bootstrap Laravel
    self::$laravel = require __DIR__ . '/../../../../bootstrap/start.php';

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

    /**
    @@ -25,7 +25,7 @@ public static function bootstrapLaravel()
    */
    public static function setUpDb()
    {
    Artisan::call('migrate:install');
    self::$laravel['artisan']->call('migrate:install');
    }


    @@ -35,7 +35,7 @@ public static function setUpDb()
    */
    public static function prepDb()
    {
    Artisan::call('migrate:refresh');
    Artisan::call('db:seed');
    self::$laravel['artisan']->call('migrate:refresh');
    self::$laravel['artisan']->call('db:seed');
    }
    }
  3. @davidstanley01 davidstanley01 created this gist Mar 7, 2014.
    41 changes: 41 additions & 0 deletions FeatureContext.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    // 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
    {
    /**
    * @static
    * @beforeSuite
    */
    public static function bootstrapLaravel()
    {
    $unitTesting = true;
    $testEnvironment = 'testing';
    require_once __DIR__.'/../../../../../bootstrap/start.php';

    Mail::pretend(true);
    }

    /**
    * @static
    * @beforeSuite
    */
    public static function setUpDb()
    {
    Artisan::call('migrate:install');
    }


    /**
    * @static
    * @beforeFeature
    */
    public static function prepDb()
    {
    Artisan::call('migrate:refresh');
    Artisan::call('db:seed');
    }
    }