/** * This is the same as the testMultipleExecutablesFinishCurrentStage except * that the result produced is a sub-class of the expected result. * @throws TierException */ public function testMultipleExecutablesFinishCurrentStageWithAliasedResult() { $injectionParams = new InjectionParams(); $tierApp = new TierApp($injectionParams); $tierApp->addExpectedProduct('StdClass'); $fn1 = function () { $obj = new \Fixtures\FooResult(); $obj->foo = 'bar'; return $obj; }; $fn2 = function () { throw new \Exception("This should not be reached, "); }; $object = null; $fn3 = function (\StdClass $stdClass) use(&$object) { $object = $stdClass; return TierApp::PROCESS_END; }; // Add two executables to the initial stage. The first one returning // an expected product should stop the other from being executing; $tierApp->addExecutable(0, $fn1); $tierApp->addExecutable(0, $fn2); $tierApp->addExecutable(5, $fn3); $tierApp->executeInternal(); $this->assertObjectHasAttribute('foo', $object); $this->assertEquals($object->foo, 'bar'); }
public function testDuplicateExpectedProduct() { $tierApp = new TierApp(new Injector(), new NullCallback()); $tierApp->addExpectedProduct('StdClass'); $this->setExpectedException('Tier\\TierException'); $tierApp->addExpectedProduct('StdClass'); }
public function testDuplicateExpectedProduct() { $injectionParams = new InjectionParams(); $tierApp = new TierApp($injectionParams); $tierApp->addExpectedProduct('StdClass'); $this->setExpectedException('Tier\\TierException'); $tierApp->addExpectedProduct('StdClass'); }