Created
May 27, 2016 15:35
-
-
Save pmjones/1e50bcefa227792f1297e17a5523282a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add to the end of FactoryTest | |
public function testSetterCallable() | |
{ | |
$this->factory->setter['Aura\Di\FakeChildClass']['setFake'] = function () { | |
return 'OOPS'; | |
}; | |
$object = $this->factory->newInstance('Aura\Di\FakeChildClass'); | |
$actual = $object->getFake(); | |
$this->assertInstanceOf('Closure', $actual); | |
} |
Totally. I'll test after lunch. Probably just an overtired scope issue :-)
Get some rest man. :-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, you should be able to pass that inner closure by itself to the setter, and the DI system will use that closure itself as the value for the setter. Then you can retain it as a property (or whatever) and invoke it inside the class later. Does that help?