Skip to content
Snippets Groups Projects
Unverified Commit fc653edd authored by Thomas Flori's avatar Thomas Flori
Browse files

prepare migrate test

parent 1833dcf2
No related branches found
No related tags found
No related merge requests found
...@@ -3,16 +3,47 @@ ...@@ -3,16 +3,47 @@
namespace Breyta\Test\Migrations; namespace Breyta\Test\Migrations;
use Breyta\Migrations; use Breyta\Migrations;
use Breyta\Model\Migration;
use Breyta\Test\TestCase; use Breyta\Test\TestCase;
use Mockery as m;
class MigrateTest extends TestCase class MigrateTest extends TestCase
{ {
/** @var m\Mock|\PDOStatement */
protected $statement;
/** @var m\Mock|Migrations */
protected $migrations;
/** @var m\Mock */
protected $resolver;
protected function setUp()
{
parent::setUp();
$resolver = $this->resolver = m::spy(function ($class, ...$args) {
return new $class(...$args);
});
$migrations = $this->migrations = m::mock(Migrations::class, [$this->pdo, __DIR__ . '/../Example', $resolver])
->makePartial();
$migrations->shouldReceive('getStatus')->with()
->andReturn((object)[
'migrations' => [
Migration::createInstance([
'file' => '@breyta/CreateMigrationTable.php',
'status' => 'done'
]),
],
'count' => 0,
])->byDefault();
}
/** @test */ /** @test */
public function returnsSuccessAsBoolean() public function returnsSuccessAsBoolean()
{ {
$migrations = new Migrations($this->pdo, __DIR__ . '/../Example'); $result = $this->migrations->migrate();
$result = $migrations->migrate();
self::assertTrue($result); self::assertTrue($result);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment