Exemplo n.º 1
0
<?php

namespace Disclosure\Test;

use Disclosure\Injector;
use Disclosure\NotFoundException;
use Demo;
use Gentry\Property;
use Gentry\Group;
use Disclosure\Container;
$container = new Container();
$container->register(function (&$foo, &$bar, &$baz) {
    $foo = new Demo\BasicInjection1();
    $bar = new Demo\BasicInjection2();
    $baz = new Demo\BasicInjection3();
});
$container->register(function (&$fizz) {
    $fizz = new Demo\DeepInjection();
});
/**
 * Injector should inject requested classes
 */
class InjectorTest
{
    /**
     * {0}::$foo is a BasicInjection1
     */
    public function fooIsSet(Demo\Basic $foo)
    {
        (yield new Demo\BasicInjection1());
    }