Beispiel #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);
 }
Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #4
0
 /**
  * Find the list of routing files
  *
  * @param \phpbb\finder $finder
  * @return null
  */
 public function find_routing_files(\phpbb\finder $finder)
 {
     // We hardcode the path to the core config directory
     // because the finder cannot find it
     $this->routing_files = array_merge($this->routing_files, array('config/routing.yml'), array_keys($finder->directory('/config')->suffix('routing.yml')->find()));
 }