Registers a {@link Factory} or closure to be invoked on the first lookup
public factory ( $key, $factory ) |
public function testRegisteringAClosureAsAFactory() { $registry = new Registry(); $registry->factory('my_key', function () { return (object) array('test' => 'blargh'); }); $this->assertTrue($registry->isRegistered('my_key')); $this->assertEquals($registry->lookup('my_key')->test, 'blargh'); }