public function testSetAuthorUrl() { $c = new ae_CommentModel(); $c->setAuthorUrl('http://example.com:8080'); $this->assertEquals($c->getAuthorUrl(), 'http://example.com:8080'); $c->setAuthorUrl(''); $this->assertTrue($c->getAuthorUrl() === ''); $c->setAuthorUrl('https://127.0.0.1'); $this->assertEquals($c->getAuthorUrl(), 'https://127.0.0.1'); $this->setExpectedException('Exception'); $c->setAuthorUrl('example.com'); }
/** * Get the content of the filter target. * @param {string} $cfTarget Target identifier. * @param {ae_CommentModel} $co The comment. * @return {string} Target content. */ protected static function getTarget($cfTarget, ae_CommentModel $co) { switch ($cfTarget) { case ae_CommentfilterModel::TARGET_CONTENT: $target = $co->getContent(); break; case ae_CommentfilterModel::TARGET_EMAIL: $target = $co->getAuthorEmail(); break; case ae_CommentfilterModel::TARGET_IP: $target = $co->getAuthorIp(); break; case ae_CommentfilterModel::TARGET_NAME: $target = $co->getAuthorName(); break; case ae_CommentfilterModel::TARGET_URL: $target = $co->getAuthorUrl(); break; case ae_CommentfilterModel::TARGET_USERID: $target = $co->getUserId(); break; default: $target = NULL; } return $target; }