/** * test load services * * @covers Phossa\Di\Container::load */ public function testLoadServices() { $this->object->setResolver(new Parameter($this->data)); $call = function ($a) { return $a; }; // id => [ callable(), arguments[] ] $service = ['services' => ['test' => [$call, ['${test1}']]]]; $this->object->load($service); $this->assertTrue('x2' == $this->object->get('test')); }
/** * Readme example 5.4, load map from file * * @covers Phossa\Di\Container::get */ public function testGet13() { // turn off autowiring $container = new Container(); $container->set('cache.class', 'Phossa\\Cache\\CachePool'); // map a interface to a classname $container->load(__DIR__ . '/definition.map.php'); $container->get('\\Phossa\\Cache\\TestMap'); }