protected function prepare(array $config = [])
 {
     $provider = new DoctrineProvider($config);
     $container = new Container();
     $container->addServiceProvider($provider);
     $this->provider = $provider;
     $this->container = $container;
 }
Example #2
0
 /**
  * @param ContainerInterface $container
  */
 public function __construct(ContainerInterface $container = null)
 {
     if (null === $container) {
         $container = new Container();
         $container->addServiceProvider(new ServiceProvider());
     }
     $this->router = new Router();
     $this->serviceContainer = $container;
     $this->viewManager = $container->get(View\Manager::class);
 }
Example #3
0
 protected function setUp()
 {
     $doctrine = new DoctrineProvider(['connection' => ['driver' => 'pdo_sqlite', 'memory' => true]]);
     $container = new Container();
     $container->addServiceProvider($doctrine);
     $provider = new OAuth2Provider();
     $provider->setContainer($container);
     $provider->register();
     $this->container = $container;
     $this->provider = $provider;
 }
Example #4
0
 public function testProvider()
 {
     $container = new Container();
     $container->addServiceProvider($this->provider);
     $this->provider->setContainer($container);
     $this->assertTrue($this->provider->provides(View\Manager::class));
     $this->provider->register();
     $this->assertTrue($container->isRegistered(View\Manager::class));
     $this->assertInstanceOf(Handler\ErrorInterface::class, $container->get(Handler\ErrorInterface::class));
     $this->assertInstanceOf(Handler\NotFoundInterface::class, $container->get(Handler\NotFoundInterface::class));
     $this->assertInstanceOf(Router::class, $container->get(Router::class));
     $this->assertInstanceOf(View\Manager::class, $container->get(View\Manager::class));
 }