File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
spec/PhpSpec/Laravel/Util Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ function it_allows_the_env_to_be_set_to_anything(Application $app)
29
29
30
30
function it_will_run_migrations_if_told_to (Application $ app , Console $ console )
31
31
{
32
+ $ console ->call ('migrate:install ' )->shouldBeCalled ();
32
33
$ console ->call ('migrate:refresh ' )->shouldBeCalled ();
33
34
$ app ->make ('artisan ' )->shouldBeCalled ();
34
35
$ app ->make ('artisan ' )->willReturn ($ console );
Original file line number Diff line number Diff line change 1
1
<?php namespace PhpSpec \Laravel \Util ;
2
2
3
3
use ErrorException ;
4
+ use Illuminate \Database \QueryException ;
4
5
use Illuminate \Foundation \Application ;
5
6
6
7
/**
@@ -75,7 +76,15 @@ public function refreshApplication($app = null)
75
76
$ this ->app ->boot ();
76
77
77
78
if ($ this ->migrateDatabase ) {
78
- $ this ->app ->make ('artisan ' )->call ('migrate:refresh ' );
79
+ $ artisan = $ this ->app ->make ('artisan ' );
80
+
81
+ try {
82
+ $ artisan ->call ('migrate:install ' );
83
+ } catch (QueryException $ e ) {
84
+ // migration table is already installed
85
+ }
86
+
87
+ $ artisan ->call ('migrate:refresh ' );
79
88
}
80
89
}
81
90
You can’t perform that action at this time.
0 commit comments