Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道 Laravel 5 尚未完成,但到目前为止我已经很好地解决了这个问题。
我的问题涉及测试。以前您可以Artisan::call('migrate')在测试中设置数据库。
Artisan::call('migrate')
我们应该如何在 Laravel 5 中做到这一点?
我尝试了Artisan::call('migrate'), $this->app['artisan']->call('migrate'),包括通过 的课程use Illuminate\Support\Facades\Artisan,但都没有奏效。
$this->app['artisan']->call('migrate')
use Illuminate\Support\Facades\Artisan
在我们等待更好的内置支持时,我找到了一个临时解决方案。
$this->app->make('Illuminate\Contracts\Console\Kernel')->handle( new Symfony\Component\Console\Input\StringInput('migrate'), new Symfony\Component\Console\Output\NullOutput);