12 use PHPUnit\Framework\TestCase;
18 private $data =
"[{\"author\": [{\"family\": \"Hotho\", \"given\": \"Andreas\"}, {\"family\": \"Benz\", \"given\": \"Dominik\"}], \"title\":\"Book\", \"type\":\"book\"}]";
30 public function setUp()
33 $this->citeProc =
new CiteProc($style,
"de-DE");
34 $this->citeProc->init();
35 $this->context = $this->citeProc->getContext();
36 $this->context->setMode(
"bibliography");
37 $dataList =
new DataList(json_decode($this->data));
38 $this->context->setCitationItems($dataList);
47 $macros = $this->citeProc->getContext()->getMacros();
48 $this->assertTrue(count($macros) > 0);
49 foreach ($macros as $macro) {
50 $this->assertInstanceOf(
"Seboettg\\CiteProc\\Style\\Macro", $macro);
60 $this->assertEquals(
"bibliography", $this->context->getMode());
68 $this->assertTrue($this->citeProc->getContext()->hasCitationItems());
76 foreach ($this->citeProc->getContext()->getCitationItems() as $item) {
77 $this->assertNotNull($item->{
'author'});
78 $this->assertTrue(is_array($item->{
'author'}));
79 $this->assertNotEmpty($item->{
'author'});