public function testGetSetState() { $limit = new TimeLimit(60, 'dummy'); $limit->setState(new State('dummy')); $this->assertInstanceOf('\\TyHand\\WorkflowBundle\\Workflow\\State', $limit->getState()); $this->assertEquals('dummy', $limit->getState()->getName()); }
/** * Check if the time limit has passed if one exists * NOTE: this method will return null if the time limit is not set * * @param DateTime $started When the context was placed in the state * * @return State|null Time limit followup state if the limit is passed, null elsewise */ public function hasTimeLimitPassed(\DateTime $started) { if ($this->hasTimeLimit()) { if ($this->timeLimit->isPassed($started)) { return $this->timeLimit->getState(); } else { return null; } } else { return null; // Cant be passed a non-existent time limit } }