public static function configurePimple(\Pimple $app, array $config) { $skip = array(); $skip['settings'] = isset($config['settings']) ? $config['settings'] : array(); $skip['core'] = $config['core']; if (!isset($skip['core']['debug'])) { $skip['core']['debug'] = false; } $app['debug'] = $skip['core']['debug']; // so lazy developers can do what they want #notElegant #butIEmpathise $skip['di'] = $app; // namespaced configuration $app['skip'] = $skip; // handy bits for the frame work to know about itself! if (isset($config['framework']) && is_array($config['framework'])) { $app['framework'] = $config['framework']; } // configure services if (isset($config['services']) && is_array($config['services'])) { Config::configureServices($app, $config['services']); } }
public function testServiceSetParameter() { $pimple = new \Pimple(); Config::configureServices($pimple, array("test_service1" => array("class" => "Skip\\Tests\\Dummy\\TestModel", "set" => array("dummy_service" => "test_service2")))); // configure dependee service $dep_service = Phake::mock('Skip\\Tests\\Dummy\\TestModel'); $pimple['test_service2'] = $dep_service; // request service $pimple['test_service1']; Phake::verify($dep_service, Phake::times(1))->getData(); }