|
@@ 5-17 (lines=13) @@
|
| 2 |
|
|
| 3 |
|
class DeCaptchaAbstractTest extends PHPUnit_Framework_TestCase |
| 4 |
|
{ |
| 5 |
|
public function testGetBaseUrl() |
| 6 |
|
{ |
| 7 |
|
$abstract = $this->getMockForAbstractClass(\jumper423\decaptcha\core\DeCaptchaAbstract::class); |
| 8 |
|
// $foo->expects($this->any()) |
| 9 |
|
// ->method("baz") |
| 10 |
|
// ->will($this->returnValue("You called baz!")); |
| 11 |
|
$getBaseUrlCaller = function () { |
| 12 |
|
return $this->getBaseUrl(); |
| 13 |
|
}; |
| 14 |
|
$abstract->domain = 'domain'; |
| 15 |
|
$bound = $getBaseUrlCaller->bindTo($abstract, $abstract); |
| 16 |
|
$this->assertEquals('http://domain/', $bound()); |
| 17 |
|
} |
| 18 |
|
|
| 19 |
|
public function testSetApiKey() |
| 20 |
|
{ |
|
@@ 150-160 (lines=11) @@
|
| 147 |
|
$this->assertEquals(null, $bound(0)); |
| 148 |
|
} |
| 149 |
|
|
| 150 |
|
public function testGetInUrl() |
| 151 |
|
{ |
| 152 |
|
$abstract = $this->getMockForAbstractClass(\jumper423\decaptcha\core\DeCaptchaAbstract::class); |
| 153 |
|
$getInUrlCaller = function () { |
| 154 |
|
return $this->getInUrl(); |
| 155 |
|
}; |
| 156 |
|
$abstract->domain = 'domain'; |
| 157 |
|
$abstract->setApiKey('123456'); |
| 158 |
|
$bound = $getInUrlCaller->bindTo($abstract, $abstract); |
| 159 |
|
$this->assertEquals('http://domain/in.php', $bound()); |
| 160 |
|
} |
| 161 |
|
|
| 162 |
|
/** |
| 163 |
|
* @expectedException \jumper423\decaptcha\core\DeCaptchaErrors |