public function testInitWithConstructorData() { $cite = new Cite(); $this->assertEquals('', $cite->getAuthor()); $this->assertEquals('', $cite->getText()); $this->assertEquals('', $cite->getTitle()); $cite = new Cite(array('author' => ' Foo Bar ', 'text' => " A \tstring with\nlinebreaks. ", 'title' => 'A Title')); $this->assertEquals('Foo Bar', $cite->getAuthor()); $this->assertEquals('A string with linebreaks.', $cite->getText()); $this->assertEquals('A Title', $cite->getTitle()); $data = new stdClass(); $data->author = ' Foo Bar '; $data->text = " A \tstring with\nlinebreaks. "; $cite = new Cite($data); $this->assertEquals('Foo Bar', $cite->getAuthor()); $this->assertEquals('A string with linebreaks.', $cite->getText()); $this->assertEquals('', $cite->getTitle()); }