You are here

protected function RestfulSubResourcesCreateEntityTestCase::assertInvalidRequest in RESTful 7

Same name and namespace in other branches
  1. 7.2 tests/RestfulSubResourcesCreateEntityTestCase.test \RestfulSubResourcesCreateEntityTestCase::assertInvalidRequest()

Assert an invalid request fails.

Parameters

string $method: The method name.

string $path: The path.

array $request: The request array.

1 call to RestfulSubResourcesCreateEntityTestCase::assertInvalidRequest()
RestfulSubResourcesCreateEntityTestCase::processRequests in tests/RestfulSubResourcesCreateEntityTestCase.test
Assert valid and invalid requests.

File

tests/RestfulSubResourcesCreateEntityTestCase.test, line 218
Contains RestfulSubResourcesCreateEntityTestCase.

Class

RestfulSubResourcesCreateEntityTestCase
@file Contains RestfulSubResourcesCreateEntityTestCase.

Code

protected function assertInvalidRequest($method = 'post', $path = '', array $request = array()) {
  $handler = $this->handler;
  try {
    $handler
      ->{$method}($path, $request);
    $this
      ->fail('No exception thrown on validation fail on the parent.');
  } catch (\RestfulBadRequestException $e) {
    $this
      ->pass('Correct exception thrown on validation fail on the parent.');
  } catch (\Exception $e) {
    $this
      ->fail('Wrong exception thrown on validation fail on the parent.');
  }
}