Exemplo n.º 1
0
 public function testCouldExportInJsonFormat()
 {
     $params = ['date' => new DateTime('10 september 1982')];
     $expectedJsonFormat = json_encode($params);
     $jsonResult = new JsonExporter(BirthDay::box($params, new ResourcesValidator()));
     $this->assertEquals($expectedJsonFormat, $jsonResult->execute());
 }
 public function testIsClassName()
 {
     $birthday = BirthDay::box(['date' => new DateTime('2015')]);
     $propertyTypeExtractor = new PropertyTypeExtractor($birthday);
     $propertyTypeExtractor->setPropertyName('date');
     $this->assertEquals('DateTime', $propertyTypeExtractor->execute());
 }
Exemplo n.º 3
0
 /**
  * @expectedException              RuntimeException
  * @expectedExceptionMessageRegExp #Attribute `.*` must be an object of type DateTime#
  */
 public function testPropertyCouldBeTheRightnObject()
 {
     BirthDay::box(['date' => new DateInterval('P1D')]);
 }