Ejemplo n.º 1
0
 /**
  * @When I try to get the service :serviceId out of the container
  */
 public function iTryToGetTheServiceOutOfTheContainer($serviceId)
 {
     try {
         $this->container->get($serviceId);
     } catch (\Exception $exception) {
         $this->lastExceptionFromContainer = $exception;
     }
 }
Ejemplo n.º 2
0
 public function testCanGetFrontControllerFromDi()
 {
     // ARRANGE
     $container = DiContainer::getInstance();
     // ACT
     $frontController = $container->get('restinpeace.frontcontroller');
     // ASSERT
     $this->assertInstanceOf('\\RestInPeace\\FrontController', $frontController);
 }
Ejemplo n.º 3
0
 /**
  * @expectedException \DirtyNeedle\Exception\CyclicDependencyInDiConfig
  * @expectedExceptionMessage Cyclic dependency found while trying to retrieve "@class-a" from container
  */
 public function testCanDetectCyclicDependencies()
 {
     $this->diIsConfiguredWith('cyclic_dependencies.php');
     $this->diContainer->get('class-a');
 }
Ejemplo n.º 4
0
<?php

require_once __DIR__ . '/../bootstrap.php';
$diContainer = \DirtyNeedle\DiContainer::getInstance();
$diContainer->addConfigFile(DIRTYNEEDLE_TEST_DIR . '/fixtures/config_files/sample_di_config.php');
$dependency = $diContainer->get('class-with-one-dependency');
Ejemplo n.º 5
0
 /**
  * @return InMemoryDataStore
  */
 private function getDataStore()
 {
     $diContainer = DiContainer::getInstance();
     return $diContainer->get('restinpeace-sampleapp.inmemorydatastore');
 }