|
@@ 76-85 (lines=10) @@
|
| 73 |
|
* @expectedException \jumper423\decaptcha\core\DeCaptchaErrors |
| 74 |
|
* @expectedExceptionCode 16 |
| 75 |
|
*/ |
| 76 |
|
public function testGetFilePathErrorFileNotFound() |
| 77 |
|
{ |
| 78 |
|
$abstract = $this->getMockForAbstractClass(\jumper423\decaptcha\core\DeCaptchaAbstract::class); |
| 79 |
|
$abstract->errorLang = \jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU; |
| 80 |
|
$getFilePathCaller = function ($val) { |
| 81 |
|
return $this->getFilePath($val); |
| 82 |
|
}; |
| 83 |
|
$bound = $getFilePathCaller->bindTo($abstract, $abstract); |
| 84 |
|
$bound(__DIR__ . '/data/Captcha1.jpg'); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
/** |
| 88 |
|
* @expectedException \jumper423\decaptcha\core\DeCaptchaErrors |
|
@@ 92-101 (lines=10) @@
|
| 89 |
|
* @expectedExceptionMessage Файл не загрузился: https://upload.wikimedia.org/wikipedia/commons/6/69/Captcha46.jpg123 |
| 90 |
|
* @expectedExceptionCode 15 |
| 91 |
|
*/ |
| 92 |
|
public function testGetFilePathErrorFileIsNotLoaded() |
| 93 |
|
{ |
| 94 |
|
$abstract = $this->getMockForAbstractClass(\jumper423\decaptcha\core\DeCaptchaAbstract::class); |
| 95 |
|
$abstract->errorLang = \jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU; |
| 96 |
|
$getFilePathCaller = function ($val) { |
| 97 |
|
return $this->getFilePath($val); |
| 98 |
|
}; |
| 99 |
|
$bound = $getFilePathCaller->bindTo($abstract, $abstract); |
| 100 |
|
$bound('https://upload.wikimedia.org/wikipedia/commons/6/69/Captcha46.jpg123'); |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
public function testGetResponse() |
| 104 |
|
{ |
|
@@ 166-175 (lines=10) @@
|
| 163 |
|
* @expectedException \jumper423\decaptcha\core\DeCaptchaErrors |
| 164 |
|
* @expectedExceptionCode 4 |
| 165 |
|
*/ |
| 166 |
|
public function testIsError() |
| 167 |
|
{ |
| 168 |
|
$abstract = $this->getMockForAbstractClass(\jumper423\decaptcha\core\DeCaptchaAbstract::class); |
| 169 |
|
$abstract->errorLang = \jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU; |
| 170 |
|
$isErrorCaller = function ($val) { |
| 171 |
|
return $this->isError($val); |
| 172 |
|
}; |
| 173 |
|
$bound = $isErrorCaller->bindTo($abstract, $abstract); |
| 174 |
|
$bound('ERROR_IP_NOT_ALLOWED'); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
public function testIsErrorNot() |
| 178 |
|
{ |
|
@@ 177-186 (lines=10) @@
|
| 174 |
|
$bound('ERROR_IP_NOT_ALLOWED'); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
public function testIsErrorNot() |
| 178 |
|
{ |
| 179 |
|
$abstract = $this->getMockForAbstractClass(\jumper423\decaptcha\core\DeCaptchaAbstract::class); |
| 180 |
|
$abstract->errorLang = \jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU; |
| 181 |
|
$isErrorCaller = function ($val) { |
| 182 |
|
return $this->isError($val); |
| 183 |
|
}; |
| 184 |
|
$bound = $isErrorCaller->bindTo($abstract, $abstract); |
| 185 |
|
$this->assertNull($bound('BALANCE:56')); |
| 186 |
|
} |
| 187 |
|
} |