Ejemplo n.º 1
0
 public function testTowelGetApps()
 {
     $apps = \Towel\Towel::getApps();
     $this->assertTrue(is_array($apps), 'getApps is not an array');
     $this->assertTrue(count($apps) > 1, 'There should be at least one app');
     foreach ($apps as $app) {
         $this->assertTrue(count($app) == 2, 'Each item in apps must have two items');
         $this->assertTrue(file_exists($app['path']), 'Item path must exists');
         $this->assertTrue(is_dir($app['path']), 'Item path must be a directory');
     }
 }
Ejemplo n.º 2
0
 public function getMigrations()
 {
     $apps = \Towel\Towel::getApps();
     $migrations = array();
     foreach ($apps as $app) {
         $migrationDir = $app['path'] . '/Migrations';
         $migrationFiles = glob($migrationDir . '/m*.php');
         foreach ($migrationFiles as $migrationFile) {
             $migrationFile = basename($migrationFile);
             $migrationClass = str_replace('.php', '', $migrationFile);
             if ($app['name'] == 'Towel') {
                 $migrationClass = '\\' . $app['name'] . '\\Migrations\\' . $migrationClass;
             } else {
                 $migrationClass = '\\Application\\' . $app['name'] . '\\Migrations\\' . $migrationClass;
             }
             $migration = new $migrationClass();
             $migrations[$migrationClass] = $migration;
         }
     }
     return $migrations;
 }