Exemplo n.º 1
0
<?php

namespace My\simple;

require __DIR__ . '/../../../../../src/greebo/essence/Greebo.php';
\greebo\essence\Greebo::register();
\greebo\essence\Greebo::register(realpath(__DIR__ . '/../..'));
class Bootstrap extends \greebo\conveniences\Bootstrap
{
    function init()
    {
        error_reporting(E_ALL);
        ini_set('display_errors', 'on');
    }
    function setup()
    {
        $container = $this->container();
        $container->vendor = 'My';
        $container->app = 'simple';
    }
}
Exemplo n.º 2
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', true);
require __DIR__ . '/../../src/greebo/essence/Greebo.php';
\greebo\essence\Greebo::register();
$c = new \greebo\essence\Container();
$c->action = function ($c) {
    return function ($c) {
        $c->response->content('<script>alert("hello");</script>');
    };
};
//require dirname(__DIR__).'/../gconveniences.php';
//class template extends \Greebo\Template { function content() { $this->escape('<script>alert("hello");</script>'); }}
//
//$c->controller = function($c) {
//  return function($c) { $c->response->content(call_user_func($c->template, $c)); };
//};
//$c->template = function($c) { return new template($c) };
$g = new \greebo\essence\Greebo($c);
$g->unleash();
Exemplo n.º 3
0
<?php

/*
 * This file is part of the greebo pack.
 *
 * Copyright (c) Szabolcs Sulik <*****@*****.**>
 */
require_once __DIR__ . '/../../src/greebo/essence/Greebo.php';
\greebo\essence\Greebo::register();
\greebo\essence\Greebo::register(__DIR__ . '/../lib');
require_once __DIR__ . '/../lib/lime.php';
Exemplo n.º 4
0
$t->pass('::register() works properly');
class MockResponse extends Response
{
    function send()
    {
    }
}
$container = new Container();
$container->response = function ($c) {
    return new MockResponse($c->event);
};
$container->action = function ($c) use($t) {
    $t->pass('->unleash() calls action callback');
};
$container->event->connect('greebo.startup', function ($c) use($container, $t) {
    $t->pass('->unleash() fire startup properly');
    $t->is_deeply($c, $container, '->__construct() takes Container instance');
});
$container->event->connect('greebo.preexec', function ($c) use($container, $t) {
    $t->pass('->unleash() fire preexec properly');
});
$container->event->connect('greebo.postexec', function ($c) use($container, $t) {
    $t->pass('->unleash() fire postexec properly');
});
$container->event->connect('greebo.shutdown', function ($c) use($container, $t) {
    $t->pass('->unleash() fire shutdown properly');
});
ob_start();
$g = new Greebo($container);
$g->unleash();
ob_end_flush();