Update to Drupal 8.0.5. For more information, see https://www.drupal.org/node/2679347

This commit is contained in:
Pantheon Automation 2016-03-02 12:40:24 -08:00 committed by Greg Anderson
parent 2a9f1f148d
commit fd3b12cf27
251 changed files with 5439 additions and 957 deletions

View file

@ -9,7 +9,7 @@ namespace Drupal\dblog\Plugin\rest\resource;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@ -36,7 +36,10 @@ class DBLogResource extends ResourceBase {
* @return \Drupal\rest\ResourceResponse
* The response containing the log entry.
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* Thrown when the log entry was not found.
* @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
* Thrown when no log entry was provided.
*/
public function get($id = NULL) {
if ($id) {
@ -49,6 +52,6 @@ class DBLogResource extends ResourceBase {
throw new NotFoundHttpException(t('Log entry with ID @id was not found', array('@id' => $id)));
}
throw new HttpException(t('No log entry ID was provided'));
throw new BadRequestHttpException(t('No log entry ID was provided'));
}
}

View file

@ -59,5 +59,11 @@ class DbLogResourceTest extends RESTTestBase {
$this->assertResponse(404);
$decoded = Json::decode($response);
$this->assertEqual($decoded['error'], 'Log entry with ID 9999 was not found', 'Response message is correct.');
// Make a bad request (a true malformed request would never be a route match).
$response = $this->httpRequest(Url::fromRoute('rest.dblog.GET.' . $this->defaultFormat, ['id' => 0, '_format' => $this->defaultFormat]), 'GET');
$this->assertResponse(400);
$decoded = Json::decode($response);
$this->assertEqual($decoded['error'], 'No log entry ID was provided', 'Response message is correct.');
}
}