1<?php 2require_once('..' . DIRECTORY_SEPARATOR . 'ZoteroEntry.php'); 3 4class ZoteroEntryTest extends PHPUnit_Framework_TestCase 5{ 6 const ID = "ABC"; 7 const CITE_KEY = "Macke2012"; 8 const TITLE = "Zotero Plugin Documentation"; 9 const AUTHOR = "Stefan Macke"; 10 const DATE = "2012"; 11 12 /** 13 * @var ZoteroEntry 14 */ 15 private $e; 16 17 public function setUp() 18 { 19 $this->e = new ZoteroEntry(self::ID); 20 $this->e->setAuthor(self::AUTHOR); 21 $this->e->setCiteKey(self::CITE_KEY); 22 $this->e->setDate(self::DATE); 23 $this->e->setTitle(self::TITLE); 24 } 25 26 public function testAttributes() 27 { 28 $this->assertEquals(self::ID, $this->e->getZoteroId()); 29 $this->assertEquals(self::AUTHOR, $this->e->getAuthor()); 30 $this->assertEquals(self::CITE_KEY, $this->e->getCiteKey()); 31 $this->assertEquals(self::DATE, $this->e->getDate()); 32 $this->assertEquals(self::TITLE, $this->e->getTitle()); 33 } 34 35 public function testShortInfo() 36 { 37 $this->assertEquals(self::AUTHOR . ": " . self::TITLE . " (" . self::DATE . ")", $this->e->getShortInfo()); 38 $this->assertEquals("pre " . self::AUTHOR . " - " . self::TITLE . " [" . self::DATE . "]", $this->e->getShortInfo("pre " . ZoteroEntry::AUTHOR_PLACEHOLDER . " - " . ZoteroEntry::TITLE_PLACEHOLDER . " [" . ZoteroEntry::DATE_PLACEHOLDER . "]")); 39 } 40} 41?> 42