/**
  * @param      $propertyName
  * @param bool $includeTime
  * @return string
  */
 protected function getFormattedDateTime($propertyName, $includeTime = false)
 {
     if (property_exists(get_class($this), $propertyName) && isset($this->{$propertyName}) && $this->{$propertyName} instanceof \DateTime) {
         if (true === $includeTime) {
             return $this->{$propertyName}->format(OPGDateFormat::getDateTimeFormat());
         } else {
             return $this->{$propertyName}->format(OPGDateFormat::getDateFormat());
         }
     }
     return '';
 }
 public function testGetSetRejectedDateString()
 {
     $expected = (new \DateTime())->format(OPGDateFormat::getDateFormat()) . ' 00:00:01';
     $mock = $this->getMockedClass();
     $this->assertEmpty($mock->getDateAsString('rejectedDate'));
     $this->assertTrue($mock->setDateFromString('', 'rejectedDate') instanceof CaseItem);
     $this->assertEmpty($mock->getDateAsString('rejectedDate'));
     $this->assertTrue($mock->setDateFromString($expected, 'rejectedDate') instanceof CaseItem);
     $this->assertEquals($expected, $mock->getDateTimeAsString('rejectedDate'));
 }
 /**
  * @return string
  */
 public function getDateOfDeathString()
 {
     if (!empty($this->dateOfDeath)) {
         return $this->dateOfDeath->format(OPGDateFormat::getDateFormat());
     }
     return '';
 }
 public function testDateFormat()
 {
     $expected = 'd/m/Y';
     $this->assertEquals($expected, OPGDateFormat::getDateFormat());
 }
 public function testGetsetNoticeGivenDateValidString()
 {
     $expected = date(OPGDateFormat::getDateFormat());
     $this->na->setNoticeGivenDateString($expected);
     $this->assertEquals($expected, $this->na->getNoticeGivenDateString());
 }
 public function testGetSetCompletedDateNulls()
 {
     $expectedDate = new \DateTime();
     $this->assertEmpty($this->task->getCompletedDate());
     $this->task->setCompletedDate();
     $this->assertEquals($expectedDate->format(OPGDateFormat::getDateFormat()), $this->task->getCompletedDate()->format(OPGDateFormat::getDateFormat()));
 }
 public function testSetGetNotifiedDateString()
 {
     $expected = date(OPGDateFormat::getDateFormat());
     $this->attorney->setLpaPartCSignatureDateString($expected);
     $this->assertEquals($expected, $this->attorney->getLpaPartCSignatureDateString());
 }
 public function testGetSetEpaDonorNoticeGivenDateFromString()
 {
     $expected = date(OPGDateFormat::getDateFormat());
     $this->assertEmpty($this->epa->getDateAsString('epaDonorNoticeGivenDate'));
     $this->epa->setdateFromString($expected, 'epaDonorNoticeGivenDate');
     $this->assertEquals($expected, $this->epa->getDateAsString('epaDonorNoticeGivenDate'));
 }
 /**
  * @expectedException \Opg\Common\Model\Entity\Exception\InvalidDateFormatException
  */
 public function testGetSetPaymentDate()
 {
     $expectedDateTime = new \DateTime();
     $expectedDateTimeString = $expectedDateTime->format(DateFormat::getDateFormat());
     $this->assertNull($this->paymentType->getPaymentDate());
     $this->assertEmpty($this->paymentType->getDateAsString('paymentDate'));
     $this->assertEquals($expectedDateTime, $this->paymentType->setPaymentDate($expectedDateTime)->getPaymentDate());
     $this->assertEquals($expectedDateTimeString, $this->paymentType->setDateFromString($expectedDateTimeString, 'paymentDate')->getDateAsString('paymentDate'));
     $this->paymentType->setDateFromString('Last thursday around 3pm', 'paymentDate');
 }
 public function testGetSetSigningOnBehalfDate()
 {
     $expectedDate = new \DateTime();
     $expectedDateString = $expectedDate->format(OPGDateFormat::getDateFormat());
     $this->assertTrue($this->poa->setSigningOnBehalfDate() instanceof PowerOfAttorney);
     $this->assertEmpty($this->poa->getSigningOnBehalfDate());
     $this->assertTrue($this->poa->setSigningOnBehalfDateString('') instanceof PowerOfAttorney);
     $this->assertEmpty($this->poa->getSigningOnBehalfDateString());
     $this->assertTrue($this->poa->setSigningOnBehalfDate($expectedDate) instanceof PowerOfAttorney);
     $this->assertEquals($expectedDate, $this->poa->getSigningOnBehalfDate());
     $this->assertEquals($expectedDateString, $this->poa->getSigningOnBehalfDateString());
     $this->assertTrue($this->poa->setSigningOnBehalfDateString($expectedDateString) instanceof PowerOfAttorney);
     $this->assertEquals($expectedDateString, $this->poa->getSigningOnBehalfDateString());
 }
 /**
  * @return string
  */
 public function getDateClosedString()
 {
     if (!empty($this->dateClosed)) {
         return $this->getDateClosed()->format(DateFormat::getDateFormat());
     }
     return '';
 }
 public function testSetGetNotifiedDateString()
 {
     $expected = date(OPGDateFormat::getDateFormat());
     $this->notifiedPerson->setDateFromString($expected, 'noticeGivenDate');
     $this->assertEquals($expected, $this->notifiedPerson->getDateAsString('noticeGivenDate'));
 }
 public function testGetSetDateOfDeathValidString()
 {
     $expected = date(OPGDateFormat::getDateFormat());
     $this->person->setDateOfDeathString($expected);
     $this->assertEquals($expected, $this->person->getDateOfDeathString());
 }
 /**
  * @return string
  */
 public function getLifeSustainingTreatmentSignatureDateBString()
 {
     if (!empty($this->lifeSustainingTreatmentSignatureDateB)) {
         return $this->lifeSustainingTreatmentSignatureDateB->format(OPGDateFormat::getDateFormat());
     }
     return '';
 }
 /**
  * @param \DateTime $activeDate
  *
  * @return Task
  */
 public function setActiveDate(\DateTime $activeDate = null)
 {
     if (is_null($activeDate)) {
         $activeDate = OPGDateFormat::createDateTime(date(OPGDateFormat::getDateFormat() . ' 00:00:00'));
     }
     $this->activeDate = $activeDate;
     return $this;
 }