Skip to content
Permalink
Browse files

modern bootstrap

  • Loading branch information...
dg committed Dec 3, 2018
1 parent b1b8a1d commit 5dafea621fc38338d0678dc75ed3c21dc433066b
Showing with 58 additions and 48 deletions.
  1. +40 −0 app/Booting.php
  2. +0 −24 app/bootstrap.php
  3. +6 −2 bin/create-user.php
  4. +3 −0 composer.json
  5. +5 −2 tests/{ExampleTest.phpt → ExampleTest.php}
  6. +0 −18 tests/bootstrap.php
  7. +4 −2 www/index.php
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace App;
use Nette\Configurator;
class Booting
{
public static function boot(): Configurator
{
$configurator = new Configurator;
//$configurator->setDebugMode('23.75.345.200'); // enable for your remote IP
$configurator->enableTracy(__DIR__ . '/../log');
$configurator->setTimeZone('Europe/Prague');
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()
->addDirectory(__DIR__)
->register();
$configurator
->addConfig(__DIR__ . '/config/config.neon')
->addConfig(__DIR__ . '/config/config.local.neon');
return $configurator;
}
public static function bootForTests(): Configurator
{
$configurator = self::boot();
\Tester\Environment::setup();
return $configurator;
}
}

This file was deleted.

Oops, something went wrong.
@@ -2,6 +2,12 @@
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
$container = App\Booting::boot()
->createContainer();
if (!isset($_SERVER['argv'][3])) {
echo '
Add new user to database.
@@ -13,8 +19,6 @@
[, $name, $email, $password] = $_SERVER['argv'];
$container = require __DIR__ . '/../app/bootstrap.php';
/** @var App\Model\UserManager $manager */
$manager = $container->getByType(App\Model\UserManager::class);
try {
@@ -36,6 +36,9 @@
"require-dev": {
"nette/tester": "^2.0"
},
"autoload": {
"classmap": ["app/Booting.php"]
},
"minimum-stability": "dev",
"config": {
"platform": {
@@ -2,13 +2,13 @@
declare(strict_types=1);
namespace Test;
namespace App\Tests;
use Nette;
use Tester;
use Tester\Assert;
$container = require __DIR__ . '/bootstrap.php';
require __DIR__ . '/../vendor/autoload.php';
class ExampleTest extends Tester\TestCase
@@ -34,5 +34,8 @@ public function testSomething()
}
$container = \App\Booting::bootForTests()
->createContainer();
$test = new ExampleTest($container);
$test->run();

This file was deleted.

Oops, something went wrong.
@@ -2,7 +2,9 @@
declare(strict_types=1);
$container = require __DIR__ . '/../app/bootstrap.php';
require __DIR__ . '/../vendor/autoload.php';
$container->getByType(Nette\Application\Application::class)
App\Booting::boot()
->createContainer()
->getByType(Nette\Application\Application::class)
->run();

0 comments on commit 5dafea6

Please sign in to comment.
You can’t perform that action at this time.