public function testInjection() { $c = new Context(); $c->register('logger', 'FakeLogger', array('/path/to/file.log')); $c->register('processor', 'CreditCardProcessor'); $i = new Injector($c); $service = $i->build('BillingService'); $this->assertEquals('BillingService', get_class($service)); }
public function testGet() { $c = new Context(); $c->register('logger', 'FakeLogger', array('/path/to/file.log')); $logger = $c->get('logger'); $this->assertEquals('FakeLogger', get_class($logger)); $this->assertSame($logger, $c->get('logger')); $this->assertEquals('/path/to/file.log', $logger->logFile); }