diff --git a/mollom.drupal.inc b/mollom.drupal.inc index d5ffe7d..a2eaa99 100644 --- a/mollom.drupal.inc +++ b/mollom.drupal.inc @@ -314,6 +314,21 @@ class MollomDrupalTest extends MollomDrupal { $this->saveConfiguration('publicKey', $this->publicKey); $this->saveConfiguration('privateKey', $this->privateKey); } + + /** + * Overrides Mollom::createCaptcha(). + * + * Temporary fix to show proper image CAPTCHAs when testing mode is enabled. + * + * @todo Remove after REST Testing API has been fixed. + */ + public function createCaptcha(array $data = array()) { + $result = parent::createCaptcha($data); + if (isset($data['type']) && $data['type'] === 'image' && isset($result['url']) && strpos($result['url'], 'some-url-to-a-captcha') !== FALSE) { + $result['url'] = '//rest.mollom.com/' . self::API_VERSION . '/captcha/image/test.png'; + } + return $result; + } } /**