Laravel unittest使用SQLite迁移供应商包

时间:2014-06-28 14:13:37

标签: sqlite laravel laravel-4 phpunit

我已将此迁移添加到sentry包中:

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddFieldsUsers extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up() 
    {
        Schema::table('users', function(Blueprint $table)
        {
            /* TODO unittest */
            $table->string('fullname');
            $table->string('username')->unique();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down() 
    {
        Schema::table('users', function(Blueprint $table) 
        {
            $table->dropColumn(array('fullname', 'username'));
        });
    }

}

所以当我去测试时,我需要在SQlite中只有一个用户表。 如何添加此

  

php artisan migrate --package = cartalyst / sentry

在我的设置中

public function setUpDb()
    {
        Artisan::call('migrate');
    }

结束

傻傻的我^^

public function setUpDb()
    {
        Artisan::call('migrate', array('--package'=>'cartalyst/sentry'));
        Artisan::call('migrate');
    }

0 个答案:

没有答案