コード例 #1
0
ファイル: TierAppTest.php プロジェクト: Zvax/Tier
 public function testReturnArrayError()
 {
     $injectionParams = new InjectionParams();
     $tierApp = new TierApp($injectionParams);
     $fn1 = function () {
         $executables = [];
         $executables[] = "This is not an execuable";
         return $executables;
     };
     $fnEnd = function () {
         return TierApp::PROCESS_END;
     };
     $tierApp->addExecutable(0, $fn1);
     $tierApp->addExecutable(10, $fnEnd);
     $this->setExpectedException('Tier\\InvalidReturnException');
     $tierApp->executeInternal();
 }
コード例 #2
0
ファイル: TierAppTest.php プロジェクト: danack/tier
 public function testReturnInjectionParams()
 {
     $tierApp = new TierApp(new Injector(), new NullCallback());
     $addInjectionParamsFn = function () {
         $injectionParams = new InjectionParams();
         $injectionParams->alias('Fixtures\\FooInterface', 'Fixtures\\FooImplementation');
         return $injectionParams;
     };
     // When tier tries to instantiate this, it will fail if the alias
     // hasn't been added.
     $requiresInterfaceFn = function (\Fixtures\FooInterface $foo) {
         return TierApp::PROCESS_END;
     };
     $tierApp->addExecutable(10, $addInjectionParamsFn);
     $tierApp->addExecutable(20, $requiresInterfaceFn);
     $tierApp->executeInternal();
 }
コード例 #3
0
ファイル: TierAppTest.php プロジェクト: atawsports2/Tier
 /**
  * This just covers a line in TierApp::hasExpectedProductBeenProduced
  * @throws TierException
  */
 public function testUnknownExpectedProduct()
 {
     $injectionParams = new InjectionParams();
     $tierApp = new TierApp($injectionParams);
     $fn1 = function () {
         return \Tier\TierApp::PROCESS_CONTINUE;
     };
     $fn2 = function () {
         return \Tier\TierApp::PROCESS_END;
     };
     $tierApp->addExpectedProduct('StdClass');
     $executable = new Executable($fn2, null, null, 'UnknownClass');
     $tierApp->addExecutable(0, $fn1);
     $tierApp->addExecutable(2, $executable);
     $tierApp->executeInternal();
 }