public function testFluentInterface() { $comment = new Services_Akismet2_Comment(); // setField() $newComment = $comment->setField('test', 'test'); $this->assertSame($comment, $newComment); // setFields() $newComment = $comment->setFields(array('test', 'test')); $this->assertSame($comment, $newComment); // setType() $newComment = $comment->setType('test'); $this->assertSame($comment, $newComment); // setAuthor() $newComment = $comment->setAuthor('test'); $this->assertSame($comment, $newComment); // setAuthorEmail() $newComment = $comment->setAuthorEmail('test'); $this->assertSame($comment, $newComment); // setAuthorUrl() $newComment = $comment->setAuthorUrl('test'); $this->assertSame($comment, $newComment); // setContent() $newComment = $comment->setContent('test'); $this->assertSame($comment, $newComment); // setPostPermalink() $newComment = $comment->setPostPermalink('test'); $this->assertSame($comment, $newComment); // setUserIp() $newComment = $comment->setUserIp('test'); $this->assertSame($comment, $newComment); // setUserAgent() $newComment = $comment->setUserAgent('test'); $this->assertSame($comment, $newComment); // setHttpReferrer() $newComment = $comment->setHttpReferrer('test'); $this->assertSame($comment, $newComment); }
/** * Submits a false-positive comment to the Akismet server * * Use this method to submit comments that are detected as spam but are not * actually spam. * * @param Services_Akismet2_Comment|array $comment the comment that is * <em>not</em> spam. * * @return Services_Akismet2 the Akismet API object. * * @throws Services_Akismet2_HttpException if there is an error * communicating with the Akismet API server. * * @throws Services_Akismet2_InvalidCommentException if the specified * comment is missing required fields. * * @throws Services_Akismet2_InvalidApiKeyException if the provided * API key is not valid. * * @throws InvalidArgumentException if the provided comment is neither an * array not an instanceof Services_Akismet2_Comment. */ public function submitFalsePositive($comment) { if (is_array($comment)) { $comment = new Services_Akismet2_Comment($comment); } if (!$comment instanceof Services_Akismet2_Comment) { throw new InvalidArgumentException('Comment must be either an ' . 'array or an instance of Services_Akismet2_Comment.'); } $this->validateApiKey(); $params = $comment->getPostParameters(); $params['blog'] = $this->blogUri; $this->sendRequest('submit-ham', $params, $this->apiKey); return $this; }