1 | <?php |
||
19 | class GenericClientTest extends TestCase |
||
20 | { |
||
21 | public function testGetHttpClientMustReturnClientInterfaceInstance() |
||
27 | |||
28 | public function testGetLoggerMustReturnLoggerInterfaceInstance() |
||
34 | |||
35 | public function testEmptyCaptchaIdBeforeFirstSendCaptchaTask() |
||
40 | |||
41 | /** |
||
42 | * @param string $response |
||
43 | * @dataProvider providerCorrectInResponse |
||
44 | */ |
||
45 | public function testSendCaptchaMustReturnCaptchaIdAndStoreLastCaptchaId($response) |
||
52 | |||
53 | /** |
||
54 | * @param string $response |
||
55 | * @dataProvider providerCorrectResResponse |
||
56 | */ |
||
57 | public function testGetCaptchaResultReturnSolvedStringOrFalse($response) |
||
69 | |||
70 | /** |
||
71 | * @param $errorResponse |
||
72 | * @dataProvider providerErrorInResponse |
||
73 | * @expectedException \Rucaptcha\Exception\RuntimeException |
||
74 | */ |
||
75 | public function testSendCaptchaMustThrowRucaptchaExceptionOnErrorResponse($errorResponse) |
||
80 | |||
81 | /** |
||
82 | * @param $errorResponse |
||
83 | * @dataProvider providerErrorResResponse |
||
84 | * @expectedException \Rucaptcha\Exception\RuntimeException |
||
85 | */ |
||
86 | public function testGetCaptchaResultMustThrowRucaptchaExceptionOnErrorResponse($errorResponse) |
||
91 | |||
92 | /* Data providers */ |
||
93 | |||
94 | public function providerCorrectInResponse() |
||
100 | |||
101 | public function providerCorrectResResponse() |
||
108 | |||
109 | public function providerErrorInResponse() |
||
126 | |||
127 | public function providerErrorResResponse() |
||
139 | |||
140 | /* Helpers */ |
||
141 | |||
142 | public static function buildClientWithMockedGuzzle($response) |
||
156 | |||
157 | /** |
||
158 | * Call protected/private method of a class. |
||
159 | * |
||
160 | * @param object &$object Instantiated object that we will run method on. |
||
161 | * @param string $methodName Method name to call |
||
162 | * @param array $parameters Array of parameters to pass into method. |
||
163 | * |
||
164 | * @return mixed Method return. |
||
165 | */ |
||
166 | public function invokeMethod(&$object, $methodName, array $parameters = array()) |
||
174 | } |
||
175 |