Exemplo n.º 1
0
 public function setUp()
 {
     $ioc = Phi::instance();
     $registry = $ioc->make(CommandRegistry::class);
     $registry->register('hello', StubCommand::class);
     $parser = $ioc->make(CommandParser::class);
     $ioc->bind(CommandRegistry::class, $registry);
     $ioc->bind(CommandParser::class, $parser);
     $this->command_parser = $parser;
     $this->execution_parser = $ioc->make(ExecutionParser::class);
     $this->expected_params = new ParameterCollection([new Parameter(new ClassName(Text::class), new Text('name'), new Text('The name of the person to say hello to')), new Parameter(new ClassName(Number::class), new Text('count'), new Text('The number of times to say hello'), null, true)]);
     $this->expected_opts = new OptionCollection([new Option(new Text('caps'), new Text('Whether or not to display text in capitol letters'), new Text('a'))]);
     $this->commands = new ClassName(StubCommand::class);
 }
Exemplo n.º 2
0
$cache = $persist->getDirectory('/cache');
$registry = new Registry($ioc, $cache);
$connection = new RemodelConnection(new PDO('mysql:host=localhost;dbname=test', 'root', ''), new MySqlGrammar(), new MySqlProcessor());
use BapCat\Values\Email;
use BapCat\CoolThing\User;
use BapCat\CoolThing\UserId;
use BapCat\CoolThing\UserGateway;
use BapCat\CoolThing\UserRepository;
use BapCat\CoolThing\UserNotFoundException;
$def = new EntityDefinition(User::class);
$def->required('email', Email::class);
$def->optional('name', Text::class);
$def->timestamps();
$registry->register($def);
$user_repo = new UserRepository(Phi::instance(), new UserGateway($connection));
Phi::instance()->bind(UserRepository::class, $user_repo);
$router = new BapCat\Router\Router($ioc);
$router->get('', '/', function () {
    return 'Test';
});
require __DIR__ . '/TestValidatedRequest.php';
$router->get('', '/landing/:site', function (TestValidatedRequest $test, Text $site) {
    if (!$test->validated) {
        echo "Validation failed!<br>\n";
        foreach ($test->validation_errors as $err) {
            echo "{$err}<br>\n";
        }
        return;
    }
    return "Site: {$site}<br>\nID: {$test->id}<br>\nAP: {$test->ap}<br>\nURL: {$test->url}<br>\n";
});
Exemplo n.º 3
0
 public function setUp()
 {
     $this->phi = Phi::instance();
     $this->phi->flush();
 }
Exemplo n.º 4
0
Arquivo: init.php Projeto: BapCat/Auth
<?php

use BapCat\Persist\Drivers\Local\LocalDriver;
use BapCat\Phi\Phi;
use BapCat\Remodel\Registry;
use BapCat\Remodel\EntityDefinition;
use BapCat\Session\DatabaseSessionServiceProvider;
use BapCat\Session\SessionManager;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\MySqlConnection;
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/DoItUserAuthorizer.php';
$pdo = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$connection = new MySqlConnection($pdo, 'test');
$connection->setFetchMode(PDO::FETCH_ASSOC);
$ioc = Phi::instance();
$ioc->bind(ConnectionInterface::class, $connection);
// Grab filesystem directories
$persist = new LocalDriver(__DIR__ . '/..');
$cache = $persist->getDirectory('/cache');
$registry = new Registry($ioc, $cache);
$sp = new DatabaseSessionServiceProvider($ioc, $registry);
$sp->register();
$sp->boot();
$session = $ioc->make(SessionManager::class);
$session->open();
$auth = new DoItUserAuthorizer($session);
 public function setUp()
 {
     $this->ioc = Phi::instance();
 }
Exemplo n.º 6
0
 public function setUp()
 {
     $this->container = new ServiceContainer(Phi::instance());
 }
Exemplo n.º 7
0
 public function setUp()
 {
     $ioc = Phi::instance();
     $this->router = new Router($ioc);
 }
Exemplo n.º 8
0
 public function setUp()
 {
     Facade::setIoc(Phi::instance());
 }