protected function setResponse($allow, $message)
 {
     $mock = $this->getMock(CleantalkComponent::className(), ['sendRequest'], [['apiKey' => CLEANTALK_TEST_API_KEY]]);
     $mock->expects($this->once())->method('sendRequest')->will($this->returnValue(new CleantalkResponse(['allow' => $allow, 'comment' => $message])));
     Yii::$app->set('antispam', $mock);
 }
Exemplo n.º 2
0
 protected function getSendRequestMock($response)
 {
     $mock = $this->getMock(CleantalkComponent::className(), ['sendRequest'], [['apiKey' => CLEANTALK_TEST_API_KEY]]);
     $mock->expects($this->once())->method('sendRequest')->will($this->returnValue(new CleantalkResponse($response)));
     return $mock;
 }