diff --git a/src/Illuminate/Database/Console/Migrations/FreshCommand.php b/src/Illuminate/Database/Console/Migrations/FreshCommand.php index d3d8bbe534d8..e319e74bc06a 100644 --- a/src/Illuminate/Database/Console/Migrations/FreshCommand.php +++ b/src/Illuminate/Database/Console/Migrations/FreshCommand.php @@ -90,8 +90,6 @@ protected function needsSeeding() */ protected function runSeeder($database) { - $this->newLine(); - $this->call('db:seed', array_filter([ '--database' => $database, '--class' => $this->option('seeder') ?: 'Database\\Seeders\\DatabaseSeeder', diff --git a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php index 444876d85cc1..01b159e841a5 100755 --- a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php +++ b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php @@ -91,10 +91,6 @@ public function handle() // seed task to re-populate the database, which is convenient when adding // a migration and a seed at the same time, as it is only this command. if ($this->option('seed') && ! $this->option('pretend')) { - if (! empty($migrations)) { - $this->newLine(); - } - $this->call('db:seed', [ '--class' => $this->option('seeder') ?: 'Database\\Seeders\\DatabaseSeeder', '--force' => true, diff --git a/src/Illuminate/Database/Console/Migrations/RefreshCommand.php b/src/Illuminate/Database/Console/Migrations/RefreshCommand.php index aff48ace944c..2073cd9977e6 100755 --- a/src/Illuminate/Database/Console/Migrations/RefreshCommand.php +++ b/src/Illuminate/Database/Console/Migrations/RefreshCommand.php @@ -132,8 +132,6 @@ protected function needsSeeding() */ protected function runSeeder($database) { - $this->newLine(); - $this->call('db:seed', array_filter([ '--database' => $database, '--class' => $this->option('seeder') ?: 'Database\\Seeders\\DatabaseSeeder', diff --git a/src/Illuminate/Database/Migrations/Migrator.php b/src/Illuminate/Database/Migrations/Migrator.php index 4b4f00add6d7..5680e2098e0a 100755 --- a/src/Illuminate/Database/Migrations/Migrator.php +++ b/src/Illuminate/Database/Migrations/Migrator.php @@ -180,6 +180,10 @@ public function runPending(array $migrations, array $options = []) } $this->fireMigrationEvent(new MigrationsEnded('up')); + + if ($this->output) { + $this->output->writeln(''); + } } /** @@ -233,7 +237,11 @@ public function rollback($paths = [], array $options = []) return []; } - return $this->rollbackMigrations($migrations, $paths, $options); + return tap($this->rollbackMigrations($migrations, $paths, $options), function () { + if ($this->output) { + $this->output->writeln(''); + } + }); } /** diff --git a/src/Illuminate/Database/Seeder.php b/src/Illuminate/Database/Seeder.php index a702609936fd..f060f4b6cafa 100755 --- a/src/Illuminate/Database/Seeder.php +++ b/src/Illuminate/Database/Seeder.php @@ -61,6 +61,10 @@ public function call($class, $silent = false, array $parameters = []) static::$called[] = $class; } + if (! $silent && $this->command->getOutput()) { + $this->command->getOutput()->writeln(''); + } + return $this; } diff --git a/tests/Database/DatabaseSeederTest.php b/tests/Database/DatabaseSeederTest.php index 907f47d7b4ff..beeec27b90f2 100755 --- a/tests/Database/DatabaseSeederTest.php +++ b/tests/Database/DatabaseSeederTest.php @@ -38,9 +38,9 @@ public function testCallResolveTheClassAndCallsRun() $seeder = new TestSeeder; $seeder->setContainer($container = m::mock(Container::class)); $output = m::mock(OutputInterface::class); - $output->shouldReceive('writeln')->once(); + $output->shouldReceive('writeln')->twice(); $command = m::mock(Command::class); - $command->shouldReceive('getOutput')->once()->andReturn($output); + $command->shouldReceive('getOutput')->times(3)->andReturn($output); $seeder->setCommand($command); $container->shouldReceive('make')->once()->with('ClassName')->andReturn($child = m::mock(Seeder::class)); $child->shouldReceive('setContainer')->once()->with($container)->andReturn($child); diff --git a/tests/Integration/Migration/MigratorTest.php b/tests/Integration/Migration/MigratorTest.php index 7e149c670800..8e388f9161e6 100644 --- a/tests/Integration/Migration/MigratorTest.php +++ b/tests/Integration/Migration/MigratorTest.php @@ -32,6 +32,8 @@ public function testMigrate() $this->expectTask('2015_10_04_000000_modify_people_table', 'DONE'); $this->expectTask('2016_10_04_000000_modify_people_table', 'DONE'); + $this->output->shouldReceive('writeln')->once(); + $this->subject->run([__DIR__.'/fixtures']); $this->assertTrue(DB::getSchemaBuilder()->hasTable('people')); @@ -64,6 +66,8 @@ public function testRollback() $this->expectTask('2015_10_04_000000_modify_people_table', 'DONE'); $this->expectTask('2014_10_12_000000_create_people_table', 'DONE'); + $this->output->shouldReceive('writeln')->once(); + $this->subject->rollback([__DIR__.'/fixtures']); $this->assertFalse(DB::getSchemaBuilder()->hasTable('people')); @@ -85,6 +89,8 @@ public function testPretendMigrate() $this->expectTwoColumnDetail('2016_10_04_000000_modify_people_table'); $this->expectBulletList(['alter table "people" add column "last_name" varchar']); + $this->output->shouldReceive('writeln')->once(); + $this->subject->run([__DIR__.'/fixtures'], ['pretend' => true]); $this->assertFalse(DB::getSchemaBuilder()->hasTable('people'));