예제 #1
0
파일: bootstrap.php 프로젝트: CSHH/website
<?php

require_once __DIR__ . '/../vendor/autoload.php';
Tester\Environment::setup();
define('TEMP_DIR', __DIR__ . '/tmp/' . getmypid());
@mkdir(TEMP_DIR);
@mkdir(TEMP_DIR . '/sessions');
$params = array('testingsqlitedb' => TEMP_DIR . '/db.sqlite');
$configurator = new Nette\Configurator();
$configurator->setDebugMode(true);
$configurator->setTempDirectory(TEMP_DIR);
$configurator->addParameters($params);
$configurator->createRobotLoader()->addDirectory(__DIR__ . '/../app')->register();
$configurator->addConfig(__DIR__ . '/../app/config/config.neon');
$configurator->addConfig(__DIR__ . '/config/db.neon');
$container = $configurator->createContainer();
$source = __DIR__ . '/db-image.sqlite';
$target = $params['testingsqlitedb'];
Nette\Utils\FileSystem::copy($source, $target);
return $container;
예제 #2
0
<?php

include __DIR__ . '/../vendor/autoload.php';
$tempDir = __DIR__ . '/temp/' . getmypid();
define('TEMP_DIR', $tempDir);
@mkdir($tempDir, 0777, TRUE);
register_shutdown_function(function () {
    Nette\Utils\FileSystem::delete(__DIR__ . '/temp');
});
예제 #3
0
<?php

require __DIR__ . '/../vendor/autoload.php';
$configurator = new Nette\Configurator();
$configurator->setDebugMode(TRUE);
$logDir = __DIR__ . '/log';
$tempDir = __DIR__ . '/temp';
$fs = new Nette\Utils\FileSystem();
$fs->createDir($logDir);
$fs->createDir($tempDir);
$configurator->enableDebugger($logDir);
$configurator->setTempDirectory($tempDir);
$configurator->addConfig(__DIR__ . '/config.neon');
$container = $configurator->createContainer();
$templateFactory = $container->getByType(\Bazo\TemplateFactory\TemplateFactory::class);
$template = $templateFactory->createTemplate();
$template->setFile(__DIR__ . '/test.latte');
$template->render();