public function register(Application $app) { $app['migrator'] = function ($app) { $migrator = new Migrator(); $migrator->addGlobal('app', $app); return $migrator; }; }
public function testLatest() { $migration = $this->migrator->create(__DIR__ . '/Fixtures'); $this->assertEquals(['0000_00_00_000000_init', '0000_00_00_000001_test1', '0000_00_00_000002_test2', '0000_00_00_000003_test3', '0000_00_00_000004_test4', '0000_00_00_000005_test5'], $migration->get()); $reflectionObject = new ReflectionObject($migration); $loadMethod = $reflectionObject->getMethod('load'); $loadMethod->setAccessible('true'); $files = $loadMethod->invokeArgs($migration, []); $this->assertCount(6, $files); $migration = $this->migrator->create(__DIR__ . '/Fixtures', '0000_00_00_000004_test4'); $reflectionObject = new ReflectionObject($migration); $loadMethod = $reflectionObject->getMethod('load'); $loadMethod->setAccessible('true'); $files = $loadMethod->invokeArgs($migration, ['0000_00_00_000004_test4', null]); $this->assertCount(1, $files); }
public function testGetGlobals() { $this->migrator->addGlobal('app', new \stdClass()); $this->assertArrayHasKey('app', $this->migrator->getGlobals()); }