コード例 #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());
 }
コード例 #2
0
 public function testIsClassName()
 {
     $birthday = BirthDay::box(['date' => new DateTime('2015')]);
     $propertyTypeExtractor = new PropertyTypeExtractor($birthday);
     $propertyTypeExtractor->setPropertyName('date');
     $this->assertEquals('DateTime', $propertyTypeExtractor->execute());
 }
コード例 #3
0
ファイル: ResourceTest.php プロジェクト: sensorario/resources
 /**
  * @expectedException              RuntimeException
  * @expectedExceptionMessageRegExp #Attribute `.*` must be an object of type DateTime#
  */
 public function testPropertyCouldBeTheRightnObject()
 {
     BirthDay::box(['date' => new DateInterval('P1D')]);
 }