本文整理汇总了PHP中Alchemy\Phrasea\Application::bindRoutes方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::bindRoutes方法的具体用法?PHP Application::bindRoutes怎么用?PHP Application::bindRoutes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alchemy\Phrasea\Application
的用法示例。
在下文中一共展示了Application::bindRoutes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInstall
/**
* @covers Alchemy\Phrasea\Setup\Installer
*/
public function testInstall()
{
$app = new Application('test');
$app->bindRoutes();
$parser = new Parser();
$connDatas = $parser->parse(file_get_contents(__DIR__ . '/../../../../../config/configuration.yml'));
$credentials = $connDatas['main']['database'];
$config = __DIR__ . '/configuration.yml';
$compiled = __DIR__ . '/configuration.yml.php';
@unlink($config);
@unlink($compiled);
$app['configuration.store'] = new Configuration(new Yaml(), new Compiler(), $config, $compiled, true);
$abConn = self::$DI['app']['dbal.provider']->get(['host' => 'localhost', 'port' => 3306, 'user' => $credentials['user'], 'password' => $credentials['password'], 'dbname' => 'ab_unitTests']);
$abConn->connect();
$dbConn = self::$DI['app']['dbal.provider']->get(['host' => 'localhost', 'port' => 3306, 'user' => $credentials['user'], 'password' => $credentials['password'], 'dbname' => 'db_unitTests']);
$dbConn->connect();
$template = 'en';
$dataPath = __DIR__ . '/../../../../../datas/';
$installer = new Installer($app);
$installer->install(uniqid('admin') . '@example.com', 'sdfsdsd', $abConn, 'http://local.phrasea.test.installer/', $dataPath, $dbConn, $template);
$this->assertTrue($app['configuration.store']->isSetup());
$this->assertTrue($app['phraseanet.configuration-tester']->isUpToDate());
$databoxes = $app['phraseanet.appbox']->get_databoxes();
$databox = array_pop($databoxes);
$this->assertContains('<path>' . realpath($dataPath) . '/db_unitTests/subdefs</path>', $databox->get_structure());
$conf = $app['configuration.store']->getConfig();
$this->assertArrayHasKey('main', $conf);
$this->assertArrayHasKey('key', $conf['main']);
$this->assertGreaterThan(10, strlen($conf['main']['key']));
@unlink($config);
@unlink($compiled);
}
示例2: testInstall
public function testInstall()
{
$app = new Application(Application::ENV_TEST);
\phrasea::reset_sbasDatas($app['phraseanet.appbox']);
\phrasea::reset_baseDatas($app['phraseanet.appbox']);
$app->bindRoutes();
$parser = new Parser();
$config = $parser->parse(file_get_contents(__DIR__ . '/../../../../../config/configuration.yml'));
$credentials = $config['main']['database'];
$configFile = __DIR__ . '/configuration.yml';
$compiledFile = __DIR__ . '/configuration.yml.php';
@unlink($configFile);
@unlink($compiledFile);
$app['configuration.store'] = $app->share(function () use($configFile, $compiledFile) {
return new Configuration(new Yaml(), new Compiler(), $configFile, $compiledFile, true);
});
$app['conf'] = $app->share(function () use($app) {
return new PropertyAccess($app['configuration.store']);
});
$app['phraseanet.appbox'] = $app->share(function () use($app) {
return new \appbox($app);
});
$abInfo = ['host' => $credentials['host'], 'port' => $credentials['port'], 'user' => $credentials['user'], 'password' => $credentials['password'], 'dbname' => 'ab_setup_test'];
$abConn = $app['dbal.provider']($abInfo);
$dbConn = $app['dbal.provider'](['host' => $credentials['host'], 'port' => $credentials['port'], 'user' => $credentials['user'], 'password' => $credentials['password'], 'dbname' => 'db_setup_test']);
$key = $app['orm.add']($abInfo);
$app['orm.ems.default'] = $key;
$dataPath = __DIR__ . '/../../../../../datas/';
$installer = new Installer($app);
$installer->install(uniqid('admin') . '@example.com', 'sdfsdsd', $abConn, 'http://local.phrasea.test.installer/', $dataPath, $dbConn, 'en');
$this->assertTrue($app['configuration.store']->isSetup());
$this->assertTrue($app['phraseanet.configuration-tester']->isUpToDate());
$databox = current($app->getDataboxes());
$this->assertContains('<path>' . realpath($dataPath) . '/db_setup_test/subdefs</path>', $databox->get_structure());
$conf = $app['configuration.store']->getConfig();
$this->assertArrayHasKey('main', $conf);
$this->assertArrayHasKey('key', $conf['main']);
$this->assertGreaterThan(10, strlen($conf['main']['key']));
@unlink($configFile);
@unlink($compiledFile);
$app['connection.pool.manager']->closeAll();
}
示例3: elseif
if (!$app['phraseanet.configuration-tester']->isInstalled()) {
if (!$app['phraseanet.configuration-tester']->isBlank()) {
if ('setup_upgrade_instructions' !== $app['request']->attributes->get('_route')) {
return $app->redirectPath('setup_upgrade_instructions');
}
}
} elseif (!$app['phraseanet.configuration-tester']->isBlank()) {
return $app->redirectPath('homepage');
}
} else {
if (false === strpos($request->getPathInfo(), '/include/minify')) {
$app['firewall']->requireSetup();
}
}
}, Application::EARLY_EVENT);
$app->bindRoutes();
if (PhraseaApplication::ENV_DEV === $app->getEnvironment()) {
$app->register($p = new WebProfilerServiceProvider(), ['profiler.cache_dir' => $app['cache.path'] . '/profiler']);
$app->mount('/_profiler', $p);
if ($app['phraseanet.configuration-tester']->isInstalled()) {
$app->register(new DoctrineProfilerServiceProvider());
$app['db'] = $app->share(function (PhraseaApplication $app) {
return $app['orm.em']->getConnection();
});
}
}
$app['dispatcher'] = $app->share($app->extend('dispatcher', function (EventDispatcherInterface $dispatcher, PhraseaApplication $app) {
$dispatcher->addSubscriber(new BridgeExceptionSubscriber($app));
$dispatcher->addSubscriber(new FirewallSubscriber());
$dispatcher->addSubscriber(new JsonRequestSubscriber());
$dispatcher->addSubscriber(new DebuggerSubscriber($app));