コード例 #1
0
ファイル: UTCTimeTest.php プロジェクト: afk11/phpasn1
 public function testGetBinary()
 {
     $expectedType = chr(Identifier::UTC_TIME);
     $expectedLength = chr(13);
     $object = new UTCTime();
     $now = new \DateTime();
     $now->setTimezone($this->UTC);
     $expectedContent = $now->format('ymdHis') . 'Z';
     $this->assertEquals($expectedType . $expectedLength . $expectedContent, $object->getBinary());
     $dateString = '2012-09-23';
     $object = new UTCTime($dateString);
     $date = new \DateTime($dateString, $this->UTC);
     $expectedContent = $date->format('ymdHis') . 'Z';
     $this->assertEquals($expectedType . $expectedLength . $expectedContent, $object->getBinary());
     $dateString = '1987-01-15 12:12';
     $object = new UTCTime($dateString);
     $date = new \DateTime($dateString, $this->UTC);
     $expectedContent = $date->format('ymdHis') . 'Z';
     $this->assertEquals($expectedType . $expectedLength . $expectedContent, $object->getBinary());
 }