Issue #1875118 by damiankloip, tim.plunkett: Move resource plugins to correct modules.
parent
21fc02cf5c
commit
8ca26dcf34
|
@ -5,11 +5,11 @@
|
|||
* Definition of Drupal\rest\Plugin\rest\resource\DBLogResource.
|
||||
*/
|
||||
|
||||
namespace Drupal\rest\Plugin\rest\resource;
|
||||
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\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
|
@ -25,17 +25,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||
*/
|
||||
class DBLogResource extends ResourceBase {
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\rest\Plugin\ResourceBase::routes().
|
||||
*/
|
||||
public function routes() {
|
||||
// Only expose routes if the dblog module is enabled.
|
||||
if (\Drupal::moduleHandler()->moduleExists('dblog')) {
|
||||
return parent::routes();
|
||||
}
|
||||
return new RouteCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Responds to GET requests.
|
||||
*
|
||||
|
@ -53,7 +42,10 @@ class DBLogResource extends ResourceBase {
|
|||
if (!empty($record)) {
|
||||
return new ResourceResponse($record);
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException(t('Log entry with ID @id was not found', array('@id' => $id)));
|
||||
}
|
||||
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'));
|
||||
}
|
||||
}
|
|
@ -5,22 +5,22 @@
|
|||
* Definition of Drupal\rest\test\DBLogTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\rest\Tests;
|
||||
namespace Drupal\dblog\Tests\Rest;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\rest\Tests\RESTTestBase;
|
||||
|
||||
/**
|
||||
* Tests the Watchdog resource to retrieve log messages.
|
||||
* Tests the Watchdog REST resource to retrieve log messages.
|
||||
*/
|
||||
class DBLogTest extends RESTTestBase {
|
||||
class DbLogResourceTest extends RESTTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('hal', 'rest', 'dblog');
|
||||
public static $modules = array('hal', 'dblog');
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
Loading…
Reference in New Issue