More API updates, better support for node config edits
This commit is contained in:
parent
800e2df6b2
commit
cf21fd5a4b
21 changed files with 449 additions and 125 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue