Beispiel #1
0
 /**
  * @expectedException \BeerXML\Exception\BadData
  */
 public function testThrowsExceptionOnTruncatedRecordSet()
 {
     $parser = new Recipe();
     $parser->setRecordFactory(new RecordFactory());
     $parser->setXmlString('<RECIPES><RECIPE><NAME>foo</NAME><HOPS><HOP></HOP><OG></OG></RECIPE></RECIPES>');
     $parser->parse();
 }
Beispiel #2
0
 public function testDateIsParsedIntoDateTime()
 {
     $this->parser->setXmlString(file_get_contents(__DIR__ . '/../fixtures/recipe-record.xml'));
     $recipe = $this->parser->parse();
     /** @var $recipe \BeerXML\Record\Recipe */
     $date = $recipe->getDate();
     $this->assertInstanceOf('\\DateTime', $date);
     $this->assertEquals(new \DateTime('2004-01-03'), $date);
 }