Skip to content

Commit

Permalink
Make Seeder and its run() method abstract
Browse files Browse the repository at this point in the history
  • Loading branch information
mbernson committed Oct 14, 2015
1 parent 3e38a4e commit 65f69f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 2 additions & 5 deletions src/Illuminate/Database/Seeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Console\Command;
use Illuminate\Container\Container;

class Seeder
abstract class Seeder
{
/**
* The container instance.
Expand All @@ -26,10 +26,7 @@ class Seeder
*
* @return void
*/
public function run()
{
//
}
abstract public function run();

/**
* Seed the given connection from the given path.
Expand Down
14 changes: 11 additions & 3 deletions tests/Database/DatabaseSeederTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
use Mockery as m;
use Illuminate\Database\Seeder;

class TestSeeder extends Seeder
{
public function run()
{
//
}
}

class DatabaseSeederTest extends PHPUnit_Framework_TestCase
{
public function tearDown()
Expand All @@ -12,7 +20,7 @@ public function tearDown()

public function testCallResolveTheClassAndCallsRun()
{
$seeder = new Seeder;
$seeder = new TestSeeder;
$seeder->setContainer($container = m::mock('Illuminate\Container\Container'));
$output = m::mock('Symfony\Component\Console\Output\OutputInterface');
$output->shouldReceive('writeln')->once()->andReturn('foo');
Expand All @@ -29,14 +37,14 @@ public function testCallResolveTheClassAndCallsRun()

public function testSetContainer()
{
$seeder = new Seeder;
$seeder = new TestSeeder;
$container = m::mock('Illuminate\Container\Container');
$this->assertEquals($seeder->setContainer($container), $seeder);
}

public function testSetCommand()
{
$seeder = new Seeder;
$seeder = new TestSeeder;
$command = m::mock('Illuminate\Console\Command');
$this->assertEquals($seeder->setCommand($command), $seeder);
}
Expand Down

0 comments on commit 65f69f0

Please sign in to comment.