コード例 #1
0
ファイル: common_helper_route.php プロジェクト: Voxel37/phpbb
 protected function generate_route_objects()
 {
     $this->request = new phpbb_mock_request();
     $this->request->overwrite('SCRIPT_NAME', $this->get_uri(), \phpbb\request\request_interface::SERVER);
     $this->request->overwrite('SCRIPT_FILENAME', $this->get_script_name(), \phpbb\request\request_interface::SERVER);
     $this->request->overwrite('REQUEST_URI', $this->get_base_uri(), \phpbb\request\request_interface::SERVER);
     $this->request->overwrite('SERVER_NAME', 'localhost', \phpbb\request\request_interface::SERVER);
     $this->request->overwrite('SERVER_PORT', '80', \phpbb\request\request_interface::SERVER);
     $this->symfony_request = new \phpbb\symfony_request($this->request);
     $this->filesystem = new \phpbb\filesystem();
     $this->phpbb_path_helper = new \phpbb\path_helper($this->symfony_request, $this->filesystem, $this->request, $phpbb_root_path, $phpEx);
     $finder = new \phpbb\finder(new \phpbb\filesystem(), dirname(__FILE__) . '/', new phpbb_mock_cache());
     $finder->set_extensions(array_keys($this->extension_manager->all_enabled()));
     $this->provider = new \phpbb\controller\provider();
     $this->provider->find_routing_files($finder);
     $this->provider->find(dirname(__FILE__) . '/');
     // Set correct current phpBB root path
     $this->root_path = $this->get_phpbb_root_path();
 }
コード例 #2
0
 public static function setUpBeforeClass()
 {
     global $phpbb_root_path, $phpEx;
     $setup_extensions = static::setup_extensions();
     $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx);
     $finder->core_path('phpbb/db/migration/data/');
     if (!empty($setup_extensions)) {
         $finder->set_extensions($setup_extensions)->extension_directory('/migrations');
     }
     $classes = $finder->get_classes();
     $schema_sha1 = sha1(serialize($classes));
     self::$schema_file = __DIR__ . '/../tmp/' . $schema_sha1 . '.json';
     self::$install_schema_file = __DIR__ . '/../../phpBB/install/schemas/schema.json';
     if (!file_exists(self::$schema_file)) {
         global $table_prefix;
         $db = new \phpbb\db\driver\sqlite();
         $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, new \phpbb\db\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix);
         file_put_contents(self::$schema_file, json_encode($schema_generator->get_schema()));
     }
     copy(self::$schema_file, self::$install_schema_file);
     parent::setUpBeforeClass();
 }
コード例 #3
0
ファイル: pagination_test.php プロジェクト: Voxel37/phpbb
 public function setUp()
 {
     parent::setUp();
     global $phpbb_dispatcher;
     $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
     $this->user = $this->getMock('\\phpbb\\user', array(), array('\\phpbb\\datetime'));
     $this->user->expects($this->any())->method('lang')->will($this->returnCallback(array($this, 'return_callback_implode')));
     $filesystem = new \phpbb\filesystem();
     $manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array());
     $finder = new \phpbb\finder($filesystem, dirname(__FILE__) . '/', new phpbb_mock_cache());
     $finder->set_extensions(array_keys($manager->all_enabled()));
     $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
     $provider = new \phpbb\controller\provider();
     $provider->find_routing_files($finder);
     $provider->find(dirname(__FILE__) . '/');
     $request = new phpbb_mock_request();
     $request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER);
     $request->overwrite('SCRIPT_FILENAME', 'app.php', \phpbb\request\request_interface::SERVER);
     $request->overwrite('REQUEST_URI', '/app.php', \phpbb\request\request_interface::SERVER);
     $symfony_request = new \phpbb\symfony_request($request);
     $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $provider, $manager, $symfony_request, $request, $filesystem, '', 'php', dirname(__FILE__) . '/');
     $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper, $phpbb_dispatcher);
 }
コード例 #4
0
ファイル: manager.php プロジェクト: Tarendai/spring-website
 /**
  * Instantiates a \phpbb\finder.
  *
  * @param bool $use_all_available Should we load all extensions, or just enabled ones
  * @return \phpbb\finder An extension finder instance
  */
 public function get_finder($use_all_available = false)
 {
     $finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
     if ($use_all_available) {
         $finder->set_extensions(array_keys($this->all_available()));
     } else {
         $finder->set_extensions(array_keys($this->all_enabled()));
     }
     return $finder;
 }