| 1 | <?php |
||
| 16 | class AbstractProviderTestCase extends TestCase |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @param mixed $responseData |
||
| 20 | * @param int $responseCode |
||
| 21 | * @return \PHPUnit_Framework_MockObject_MockObject |
||
| 22 | */ |
||
| 23 | protected function makeIdentityClientResponse($responseData, $responseCode = 200) |
||
| 24 | { |
||
| 25 | $mockedHttpClient = $this->getMockBuilder(\SocialConnect\Common\Http\Client\Curl::class) |
||
| 26 | ->disableProxyingToOriginalMethods() |
||
| 27 | ->getMock(); |
||
| 28 | |||
| 29 | $response = new \SocialConnect\Common\Http\Response( |
||
| 30 | $responseCode, |
||
| 31 | $responseData, |
||
| 32 | [] |
||
| 33 | ); |
||
| 34 | |||
| 35 | $mockedHttpClient->expects($this->once()) |
||
| 36 | ->method('request') |
||
| 37 | ->willReturn($response); |
||
| 38 | |||
| 39 | return $mockedHttpClient; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param object $object |
||
| 44 | * @param string $name |
||
| 45 | * @param array $params |
||
| 46 | * @return mixed |
||
| 47 | */ |
||
| 48 | protected static function callProtectedMethod($object, $name, array $params = []) |
||
| 49 | { |
||
| 50 | $class = new ReflectionClass($object); |
||
| 51 | |||
| 52 | $method = $class->getMethod($name); |
||
| 53 | $method->setAccessible(true); |
||
| 54 | |||
| 55 | return $method->invokeArgs($object, $params); |
||
| 56 | } |
||
| 57 | } |
||
| 58 |