More API updates, better support for node config edits

This commit is contained in:
Dane Everitt 2018-01-10 23:19:03 -06:00
parent 800e2df6b2
commit cf21fd5a4b
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
21 changed files with 449 additions and 125 deletions

View file

@ -21,29 +21,23 @@ trait MocksRequestException
/**
* Configure the exception mock to work with the Panel's default exception
* handler actions.
*
* @param string $abstract
* @param null $response
*/
public function configureExceptionMock()
protected function configureExceptionMock(string $abstract = RequestException::class, $response = null)
{
$this->getExceptionMock()->shouldReceive('getResponse')->andReturn($this->exceptionResponse);
$this->getExceptionMock($abstract)->shouldReceive('getResponse')->andReturn(value($response));
}
/**
* Return a mocked instance of the request exception.
*
* @param string $abstract
* @return \Mockery\MockInterface
*/
private function getExceptionMock(): MockInterface
protected function getExceptionMock(string $abstract = RequestException::class): MockInterface
{
return $this->exception ?? $this->exception = Mockery::mock(RequestException::class);
}
/**
* Set the exception response.
*
* @param mixed $response
*/
protected function setExceptionResponse($response)
{
$this->exceptionResponse = $response;
return $this->exception ?? $this->exception = Mockery::mock($abstract);
}
}