delete(); parent::tearDownAfterClass(); } public function testGet_feed() { $this->assertInstanceOf('Feed_Adapter', self::$object->get_feed()); $this->assertEquals(self::$feed->get_id(), self::$object->get_feed()->get_id()); } public function testGet_id() { $this->assertTrue(is_int(self::$object->get_id())); } public function testGet_title() { $this->assertEquals(self::$title, self::$object->get_title()); } public function testGet_subtitle() { $this->assertEquals(self::$subtitle, self::$object->get_subtitle()); } public function testSet_title() { $new_titre = 'UNnouveau titre'; self::$object->set_title($new_titre); $this->assertEquals($new_titre, self::$object->get_title()); $new_titre = 'UNnouveau titre encore'; self::$object->set_title($new_titre); $this->assertNotEquals($new_titre, self::$object->get_title()); $this->assertEquals(strip_tags($new_titre), self::$object->get_title()); try { self::$object->set_title(''); $this->fail(); } catch (Exception_InvalidArgument $e) { } } public function testSet_subtitle() { $new_subtitle = 'PROUT ET PROUT'; self::$object->set_subtitle($new_subtitle); $this->assertEquals($new_subtitle, self::$object->get_subtitle()); $new_subtitle = ''; self::$object->set_subtitle($new_subtitle); $this->assertEquals($new_subtitle, self::$object->get_subtitle()); } public function testSet_author_name() { $new_author = 'Tintin et Milou'; self::$object->set_author_name($new_author); $this->assertEquals($new_author, self::$object->get_author_name()); self::$object->set_author_name(self::$author_name); $this->assertEquals(self::$author_name, self::$object->get_author_name()); } public function testSetFeed() { self::$DI['app']['notification.deliverer'] = $this->getMockBuilder('Alchemy\Phrasea\Notification\Deliverer') ->disableOriginalConstructor() ->getMock(); self::$DI['app']['notification.deliverer']->expects($this->atLeastOnce()) ->method('deliver') ->with($this->isInstanceOf('Alchemy\Phrasea\Notification\Mail\MailInfoNewPublication'), $this->equalTo(null)); $new_feed = Feed_Adapter::create(self::$DI['app'], self::$DI['user'], self::$feed_title, self::$feed_subtitle); $publisher = Feed_Publisher_Adapter::getPublisher(self::$DI['app']['phraseanet.appbox'], $new_feed, self::$DI['user']); $entry = Feed_Entry_Adapter::create(self::$DI['app'], self::$feed, $publisher, self::$title, self::$subtitle, self::$author_name, self::$author_email); $this->assertEquals(self::$feed, $entry->get_feed()); $entry->set_feed($new_feed); $this->assertEquals($new_feed, $entry->get_feed()); $new_feed->delete(); } public function testSet_author_email() { $new_email = 'Tintin@herge.be'; self::$object->set_author_email($new_email); $this->assertEquals($new_email, self::$object->get_author_email()); self::$object->set_author_email(self::$author_email); $this->assertEquals(self::$author_email, self::$object->get_author_email()); } public function testGet_publisher() { $this->assertInstanceOf('Feed_Publisher_Adapter', self::$object->get_publisher()); $this->assertEquals(self::$object->get_publisher()->get_user()->get_id(), self::$DI['user']->get_id()); } public function testGet_created_on() { $this->assertInstanceOf('DateTime', self::$object->get_created_on()); } public function testGet_updated_on() { $this->assertInstanceOf('DateTime', self::$object->get_updated_on()); } public function testGet_author_name() { $this->assertEquals(self::$author_name, self::$object->get_author_name()); } public function testGet_author_email() { $this->assertEquals(self::$author_email, self::$object->get_author_email()); } public function testGet_content() { $this->assertTrue(is_array(self::$object->get_content())); $this->assertEquals(0, count(self::$object->get_content())); } public function testLoad_from_id() { $test_entry = Feed_Entry_Adapter::load_from_id(self::$DI['app'], self::$object->get_id()); $this->assertInstanceOf('Feed_Entry_Adapter', $test_entry); $this->assertEquals(self::$object->get_id(), $test_entry->get_id()); } }