Skip to content

Instantly share code, notes, and snippets.

@thijsvdanker
Created September 4, 2015 10:11
Show Gist options
  • Save thijsvdanker/ec1ef6defe34d903f089 to your computer and use it in GitHub Desktop.
Save thijsvdanker/ec1ef6defe34d903f089 to your computer and use it in GitHub Desktop.
Creates a trait to be used in tests that don't want the whole multi-tenant setup.
<?php
/**
* @file
* Contains tests\helpers\TenantMigrations
*/
namespace tests\helpers;
trait TenantMigrations
{
/**
* @before
*/
public function beginTenantMigrations()
{
putenv('TENANT_CONNECTION=mysql');
$this->artisan('migrate', ['--path' => 'database/tenant_migrations/']);
$this->beforeApplicationDestroyed(function () {
$this->artisan('migrate:rollback');
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment