/** * Test entity getters & setters. */ public function testGettersSetters() { $entity = new PostMeta(); $post = new Post(); $post->setTitle('post title'); $entity->setPost($post); $entity->setKey('fake key'); $entity->setValue('fake value'); $this->assertEquals('post title', $entity->getPost()->getTitle()); $this->assertEquals('fake key', $entity->getKey()); $this->assertEquals('fake value', $entity->getValue()); }
/** * Test entity getters & setters. */ public function testGettersSetters() { $entity = new Comment(); $entity->setAgent('agent'); $entity->setApproved('approved'); $entity->setAuthor('author'); $entity->setAuthorEmail('*****@*****.**'); $entity->setAuthorIp('1.2.3.4'); $entity->setAuthorUrl('http://author.com'); $entity->setContent('content'); $date = new \DateTime(); $entity->setDate($date); $entity->setDateGmt($date); $entity->setKarma(2); $parent = new Comment(); $parent->setContent('parent content'); $entity->setParent($parent); $post = new Post(); $post->setTitle('post title'); $entity->setPost($post); $entity->setType('type'); $user = new User(); $user->setDisplayName('author name'); $entity->setUser($user); $this->assertEquals('agent', $entity->getAgent()); $this->assertEquals('approved', $entity->getApproved()); $this->assertEquals('author', $entity->getAuthor()); $this->assertEquals('*****@*****.**', $entity->getAuthorEmail()); $this->assertEquals('1.2.3.4', $entity->getAuthorIp()); $this->assertEquals('http://author.com', $entity->getAuthorUrl()); $this->assertEquals('content', $entity->getContent()); $this->assertEquals($date, $entity->getDate()); $this->assertEquals($date, $entity->getDateGmt()); $this->assertEquals(2, $entity->getKarma()); $this->assertEquals('parent content', $entity->getParent()->getContent()); $this->assertEquals('post title', $entity->getPost()->getTitle()); $this->assertEquals('type', $entity->getType()); $this->assertEquals('author name', $entity->getUser()->getDisplayName()); }