/**
  * @return TodoDeadline
  */
 public function deadline()
 {
     if (!$this->deadline) {
         $this->deadline = TodoDeadline::fromString($this->payload['deadline']);
     }
     return $this->deadline;
 }
 /**
  * @test
  * @dataProvider getDeadlines
  */
 public function it_correctly_validates_the_deadline($deadline, $inThePast)
 {
     $deadline = TodoDeadline::fromString($deadline);
     $deadlineInThePast = $deadline->isInThePast();
     if ($inThePast) {
         $this->assertTrue($deadlineInThePast);
     } else {
         $this->assertFalse($deadlineInThePast);
     }
 }
Esempio n. 3
0
 /**
  * @test
  * @return Todo $todo
  * @depends it_marks_an_open_todo_as_expired
  */
 public function it_unmarks_an_expired_todo_when_deadline_is_added(Todo $todo)
 {
     $userId = $todo->assigneeId();
     $deadline = TodoDeadline::fromString('1 day');
     $todo->addDeadline($userId, $deadline);
     $events = $this->popRecordedEvent($todo);
     $this->assertEquals(2, count($events));
     $this->assertInstanceOf(TodoWasUnmarkedAsExpired::class, $events[1]);
     return $todo;
 }
Esempio n. 4
0
 /**
  * @test
  * @expectedException \Prooph\ProophessorDo\Model\Todo\Exception\TodoNotOpen
  * @depends it_adds_a_deadline_to_todo
  */
 public function it_throws_an_exception_if_todo_is_closed(Todo $todo)
 {
     $todo->markAsDone();
     $todo->addDeadline($todo->assigneeId(), TodoDeadline::fromString('2047-12-11 12:00:00'));
 }
 /**
  * @return TodoDeadline
  */
 public function deadline()
 {
     return TodoDeadline::fromString($this->payload['deadline']);
 }