Example #1
0
 public function testDelegate()
 {
     $injectorMock = Mockery::mock('Auryn\\Injector');
     $injectorMock->shouldReceive('delegate')->with('foo', 'callableFn')->once();
     $params = new InjectionParams();
     $params->delegate('foo', 'callableFn');
     $params->addToInjector($injectorMock);
 }
Example #2
0
 /**
  * Helper function to allow template rendering to be easier.
  * @param $templateName
  * @param array $sharedObjects
  * @return Executable
  */
 public static function renderTemplateExecutable($templateName, InjectionParams $injectionParams = null)
 {
     if ($injectionParams === null) {
         $injectionParams = new InjectionParams();
     }
     $fn = function (Jig $jigRender) use($templateName, $injectionParams) {
         $className = $jigRender->compile($templateName);
         $injectionParams->alias('Jig\\JigBase', $className);
         $fn = function (Injector $injector) use($className) {
             return $injector->make($className);
         };
         $injectionParams->delegate('Jig\\JigBase', $fn);
         return new Executable(['Tier\\Tier', 'createHtmlBody'], $injectionParams);
     };
     return new Executable($fn);
 }