Beispiel #1
0
 private function prepareContainer($class, $configFiles)
 {
     $tempDir = __DIR__ . '/../temp';
     foreach (Finder::findFiles('*')->exclude('.gitignore')->from($tempDir . '/cache') as $file) {
         unlink((string) $file);
     }
     $configurator = new \Nette\Config\Configurator();
     $configurator->setTempDirectory($tempDir);
     foreach ($configFiles as $file) {
         $configurator->addConfig($file, FALSE);
     }
     $configurator->addParameters(array('fixturesDir' => __DIR__ . '/../fixtures', 'tempDir' => $tempDir, 'container' => array('class' => $class)));
     $extension = new \WebLoader\Nette\Extension();
     $extension->install($configurator);
     $this->container = $configurator->createContainer();
 }
Beispiel #2
0
 /**
  * @return \TestPresenter
  */
 private function createPresenter()
 {
     $url = new \Nette\Http\UrlScript('http://localhost/');
     $url->setScriptPath('/');
     $configurator = new \Nette\Config\Configurator();
     $configurator->addConfig(__DIR__ . '/config.neon');
     \Nella\Doctrine\Config\Extension::register($configurator);
     $container = $configurator->setTempDirectory(TEMP_DIR)->createContainer();
     $container->removeService('httpRequest');
     $container->addService('httpRequest', new \Nette\Http\Request($url));
     $application = $container->getService('application');
     $application->router[] = new \Nette\Application\Routers\SimpleRouter();
     $presenter = new TestPresenter($container);
     $presenter->invalidLinkMode = $presenter::INVALID_LINK_WARNING;
     $presenter->autoCanonicalize = FALSE;
     return $presenter;
 }
Beispiel #3
0
<?php

// Load Nette Framework or autoloader generated by Composer
require __DIR__ . '/../../vendor/autoload.php';
$configurator = new Nette\Config\Configurator();
// Enable Nette Debugger for error visualisation & logging
$configurator->setDebugMode(true);
$configurator->enableDebugger(__DIR__);
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__);
$configurator->createRobotLoader()->addDirectory(__DIR__)->addDirectory(__DIR__ . '/../../src')->register();
// Create Dependency Injection container from config.neon file
$configurator->addConfig(__DIR__ . '/config/config.neon');
return $configurator->createContainer();
Beispiel #4
0
<?php

// Load Nette Framework or autoloader generated by Composer
require __DIR__ . '/../libs/autoload.php';
$configurator = new Nette\Config\Configurator();
// Enable Nette Debugger for error visualisation & logging
//$configurator->setDebugMode(TRUE);
$configurator->enableDebugger(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()->addDirectory(__DIR__)->addDirectory(__DIR__ . '/../libs')->register();
// Create Dependency Injection container from config.neon file
$configurator->addConfig(__DIR__ . '/config/config.neon');
$configurator->addConfig(__DIR__ . '/config/config.local.neon', $configurator::NONE);
// none section
$container = $configurator->createContainer();
return $container;
Beispiel #5
0
 * Copyright (c) 2008, 2009 Lukáš Hroch (http://soundake.info)
 *
 *
 * @copyright  Copyright (c) 2008, 2009 Lukáš Hroch
 * @category   Nannou
 * @package    Nannou
 * @version    $Id: file.php 49 2009-02-27 14:55:11Z soundake $
 */
require LIBS_DIR . '/Nette/loader.php';
// Configure application
$configurator = new Nette\Config\Configurator();
// Enable Nette Debugger for error visualisation & logging
$configurator->setProductionMode(false);
$configurator->enableDebugger(__DIR__ . '/../../log', "*****@*****.**");
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../../temp');
$configurator->createRobotLoader()->addDirectory(LIBS_DIR)->addDirectory(APP_DIR)->register();
// Create Dependency Injection container from config.neon file
//$configurator->addConfig(__DIR__ . '/../config/config.neon');
$configurator->addConfig(__DIR__ . '/../config/config.neon', $configurator::DEVELOPMENT);
$container = $configurator->createContainer();
dibi::connect($container->parameters['database']);
$key = (string) $_REQUEST['key'];
$res = dibi::query("SELECT * FROM [file] WHERE [file.code] = %s", $key)->fetch();
$sourcepath = FILESTORAGE_DIR . '/' . $res['filepath'];
$fn = $res['orig_name'];
$fs = @filesize($sourcepath);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"{$fn}\"");
header("Content-length: {$fs}");
readfile($sourcepath);
Beispiel #6
0
include __DIR__ . '/unit/BaseTestCase.php';
include __DIR__ . '/integration/BaseIntegrationTestCase.php';
// configure environment
Tester\Helpers::setup();
class_alias('Tester\\Assert', 'Assert');
date_default_timezone_set('UTC');
// create temporary directory
define('TEMP_DIR', __DIR__ . '/../temp/cache/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid()));
Tester\Helpers::purge(TEMP_DIR);
$_SERVER = array_intersect_key($_SERVER, array_flip(array('PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv')));
$_SERVER['REQUEST_TIME'] = 1234567890;
$_ENV = $_GET = $_POST = array();
if (extension_loaded('xdebug')) {
    xdebug_disable();
    Tester\CodeCoverage\Collector::start(__DIR__ . '/coverage.dat');
}
function id($val)
{
    return $val;
}
function run(Tester\TestCase $testCase)
{
    $testCase->run(isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : NULL);
}
$configurator = new Nette\Config\Configurator();
$configurator->setDebugMode(FALSE);
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()->addDirectory(__DIR__ . '/../app')->register();
$configurator->addConfig(__DIR__ . '/../app/config/config.neon', false);
$configurator->addConfig(__DIR__ . '/config.tests.neon', false);
return $configurator->createContainer();
Beispiel #7
0
// Load Nette Framework
require LIBS_DIR . '/autoload.php';
// Configure application
$configurator = new Nette\Config\Configurator();
//$configurator->onCompile[] = function ($configurator, $compiler) {
//    $compiler->addExtension('gettextTranslator', new GettextTranslator\DI\Extension);
//};
// Enable Nette Debugger for error visualisation & logging
$configurator->setDebugMode();
$configurator->enableDebugger(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()->addDirectory(APP_DIR)->register();
//Extras\Debug\ComponentTreePanel::register();
// Create Dependency Injection container from config.neon file
$configurator->addConfig(CONFIG_DIR . '/config.neon');
//$configurator->addConfig(CONFIG_DIR . '/config2.neon');
$loader = new Nette\Config\Loader();
$serverName = $_SERVER['SERVER_NAME'];
//dump($serverName);
//die();
$selectedModuleNs = NULL;
$selectedHost = NULL;
$selectedProjectPath = NULL;
$selectedFile = NULL;
// detect project
foreach (Nette\Utils\Finder::findDirectories('*Module')->in(APP_DIR . '/FrontModule') as $projectPath => $file) {
    // read project config
    $projectFile = $projectPath . '/config/project.neon';
    $configFile = $projectPath . '/config/config.neon';
    //dump($file->getBaseName());
Beispiel #8
0
<?php

// Load Nette Framework or autoloader generated by Composer
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../libs/extensions.php';
umask(0);
mb_internal_encoding('UTF-8');
$configurator = new Nette\Config\Configurator();
// Enable Nette Debugger for error visualisation & logging
$configurator->setDebugMode(FALSE);
$configurator->enableDebugger(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()->addDirectory(__DIR__)->addDirectory(__DIR__ . '/../libs')->register();
// Create Dependency Injection container from config.neon file
$configurator->addConfig(__DIR__ . '/config/config.neon', 'production');
$container = $configurator->createContainer();
return $container;
<?php

// Load Nette Framework or autoloader generated by Composer
require __DIR__ . '/../libs/autoload.php';
$configurator = new Nette\Config\Configurator();
// Enable Nette Debugger for error visualisation & logging
//$configurator->setDebugMode(TRUE);
$configurator->enableDebugger(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()->addDirectory(__DIR__)->addDirectory(__DIR__ . '/../libs')->register();
// Create Dependency Injection container from config.neon file
$configurator->addConfig(__DIR__ . '/config/config.neon', \Nette\Configurator::AUTO);
$configurator->addConfig(__DIR__ . '/config/config.local.neon', $configurator::NONE);
// none section
$container = $configurator->createContainer();
// TODO: Move to separate file?
// <MultipleFileUploadControl>
// Setup MultipleFileUpload
MultipleFileUpload\MultipleFileUpload::register();
// Optional step: register custom user interfaces
// Registrator accepts instance of class or class name
// As defaults is used this:
//MultipleFileUpload\MultipleFileUpload::getUIRegistrator()
//	->clear() // removed default registered interfaces
//
//	->register('MultipleFileUpload\UI\HTML4SingleUpload')
//
//	and select one of these:
//	->register('MultipleFileUpload\UI\Uploadify');
//	->register('MultipleFileUpload\UI\SwfUpload');