Exemplo n.º 1
0
 public function test_find_from_extension()
 {
     $files = $this->finder->extension_directory('/type')->find_from_extension('vendor2/foo', dirname(__FILE__) . '/ext/vendor2/foo/');
     $classes = $this->finder->get_classes_from_files($files);
     sort($classes);
     $this->assertEquals(array('\\vendor2\\foo\\type\\alternative', '\\vendor2\\foo\\type\\dummy\\empty'), $classes);
 }
Exemplo n.º 2
0
 /**
  * Get the list of migration files from this extension
  *
  * @return array
  */
 protected function get_migration_file_list()
 {
     if ($this->migrations !== false) {
         return $this->migrations;
     }
     // Only have the finder search in this extension path directory
     $migrations = $this->extension_finder->extension_directory('/migrations')->find_from_extension($this->extension_name, $this->extension_path);
     $migrations = $this->extension_finder->get_classes_from_files($migrations);
     $this->migrator->set_migrations($migrations);
     $migrations = $this->migrator->get_migrations();
     return $migrations;
 }
Exemplo n.º 3
0
 /**
  * Get the list of migration files from this extension
  *
  * @return array
  */
 protected function get_migration_file_list()
 {
     if ($this->migrations !== false) {
         return $this->migrations;
     }
     // Only have the finder search in this extension path directory
     $migrations = $this->extension_finder->extension_directory('/migrations')->find_from_extension($this->extension_name, $this->extension_path);
     $migrations = $this->extension_finder->get_classes_from_files($migrations);
     // Unset classes that do not exist or do not extend the
     // abstract class phpbb\db\migration\migration
     foreach ($migrations as $key => $migration) {
         if (class_exists($migration)) {
             $reflector = new \ReflectionClass($migration);
             if ($reflector->implementsInterface('\\phpbb\\db\\migration\\migration_interface') && $reflector->isInstantiable()) {
                 continue;
             }
         }
         unset($migrations[$key]);
     }
     return $migrations;
 }