diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/RestExport.php b/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php similarity index 96% rename from core/modules/views/lib/Drupal/views/Plugin/views/display/RestExport.php rename to core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php index 7185acf..a543a19 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/RestExport.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php @@ -2,15 +2,16 @@ /** * @file - * Contains \Drupal\views\Plugin\views\display\RestExport. + * Contains \Drupal\rest\Plugin\views\display\RestExport. */ -namespace Drupal\views\Plugin\views\display; +namespace Drupal\rest\Plugin\views\display; use Symfony\Component\HttpFoundation\Response; use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; use Drupal\views\ViewExecutable; +use Drupal\views\Plugin\views\display\PathPluginBase; /** * The plugin that handles Data response callbacks for REST resources. @@ -19,7 +20,7 @@ * * @Plugin( * id = "rest_export", - * module = "views", + * module = "rest", * title = @Translation("REST export"), * help = @Translation("Create a REST export resource."), * uses_hook_menu = TRUE, diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/DataEntityRow.php b/core/modules/rest/lib/Drupal/rest/Plugin/views/row/DataEntityRow.php similarity index 80% rename from core/modules/views/lib/Drupal/views/Plugin/views/row/DataEntityRow.php rename to core/modules/rest/lib/Drupal/rest/Plugin/views/row/DataEntityRow.php index dd520d5..779614d 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/row/DataEntityRow.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/views/row/DataEntityRow.php @@ -2,12 +2,13 @@ /** * @file - * Contains \Drupal\views\Plugin\views\row\DataEntityRow. + * Contains \Drupal\rest\Plugin\views\row\DataEntityRow. */ -namespace Drupal\views\Plugin\views\row; +namespace Drupal\rest\Plugin\views\row; use Drupal\views\ViewExecutable; +use Drupal\views\Plugin\views\row\RowPluginBase; use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; @@ -18,7 +19,7 @@ * * @Plugin( * id = "data_entity", - * module = "views", + * module = "rest", * title = @Translation("Entity"), * help = @Translation("Use entities as row data."), * type = "data" diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/DataFieldRow.php b/core/modules/rest/lib/Drupal/rest/Plugin/views/row/DataFieldRow.php similarity index 95% rename from core/modules/views/lib/Drupal/views/Plugin/views/row/DataFieldRow.php rename to core/modules/rest/lib/Drupal/rest/Plugin/views/row/DataFieldRow.php index fa04a17..2fa2950 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/row/DataFieldRow.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/views/row/DataFieldRow.php @@ -2,13 +2,14 @@ /** * @file - * Contains \Drupal\views\Plugin\views\row\DataFieldRow. + * Contains \Drupal\rest\Plugin\views\row\DataFieldRow. */ -namespace Drupal\views\Plugin\views\row; +namespace Drupal\rest\Plugin\views\row; use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\display\DisplayPluginBase; +use Drupal\views\Plugin\views\row\RowPluginBase; use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; @@ -19,7 +20,7 @@ * * @Plugin( * id = "data_field", - * module = "views", + * module = "rest", * title = @Translation("Fields"), * help = @Translation("Use fields as row data."), * type = "data" diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/Serializer.php b/core/modules/rest/lib/Drupal/rest/Plugin/views/style/Serializer.php similarity index 91% rename from core/modules/views/lib/Drupal/views/Plugin/views/style/Serializer.php rename to core/modules/rest/lib/Drupal/rest/Plugin/views/style/Serializer.php index 01dd596..037534f 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/style/Serializer.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/views/style/Serializer.php @@ -2,13 +2,14 @@ /** * @file - * Contains \Drupal\views\Plugin\views\style\Serializer. + * Contains \Drupal\rest\Plugin\views\style\Serializer. */ -namespace Drupal\views\Plugin\views\style; +namespace Drupal\rest\Plugin\views\style; use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\display\DisplayPluginBase; +use Drupal\views\Plugin\views\style\StylePluginBase; use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; @@ -19,7 +20,7 @@ * * @Plugin( * id = "serializer", - * module = "views", + * module = "rest", * title = @Translation("Serializer"), * help = @Translation("Serializes views row data using the Serializer component."), * type = "data" diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleSerializeTest.php b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php similarity index 87% rename from core/modules/views/lib/Drupal/views/Tests/Plugin/StyleSerializeTest.php rename to core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php index 9a987d2..d6083e1 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleSerializeTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php @@ -2,32 +2,35 @@ /** * @file - * Contains \Drupal\views\Tests\Plugin\StyleSerializeTest. + * Contains \Drupal\rest\Tests\Views\StyleSerializerTest. */ -namespace Drupal\views\Tests\Plugin; +namespace Drupal\rest\Tests\Views; + +use Drupal\views\Tests\Plugin\PluginTestBase; +use Drupal\views\Tests\ViewTestData; /** - * Tests the serialize style plugin. + * Tests the serializer style plugin. * * @see \Drupal\views\Plugin\display\Data * @see \Drupal\views\Plugin\style\Serialize */ -class StyleSerializeTest extends PluginTestBase { +class StyleSerializerTest extends PluginTestBase { /** * Modules to enable. * * @var array */ - public static $modules = array('views_ui', 'entity_test', 'jsonld'); + public static $modules = array('views_ui', 'entity_test', 'jsonld', 'rest_test_views'); /** * Views used by this test. * * @var array */ - public static $testViews = array('test_serialize_display_field', 'test_serialize_display_entity'); + public static $testViews = array('test_serializer_display_field', 'test_serializer_display_entity'); /** * A user with administrative privileges to look at test entity and configure views. @@ -45,6 +48,8 @@ public static function getInfo() { protected function setUp() { parent::setUp(); + ViewTestData::importTestViews(get_class($this), array('rest_test_views')); + $this->adminUser = $this->drupalCreateUser(array('administer views', 'administer entity_test content', 'access user profiles', 'view test entity')); // Save some entity_test entities. @@ -60,7 +65,7 @@ protected function setUp() { */ public function testSerializerResponses() { // Test the serialize callback. - $view = views_get_view('test_serialize_display_field'); + $view = views_get_view('test_serializer_display_field'); $view->initDisplay(); $this->executeView($view); @@ -101,7 +106,7 @@ public function testSerializerResponses() { // Test the entity rows. - $view = views_get_view('test_serialize_display_entity'); + $view = views_get_view('test_serializer_display_entity'); $view->initDisplay(); $this->executeView($view); @@ -136,8 +141,8 @@ public function testUIFieldAlias() { $this->drupalLogin($this->adminUser); // Test the UI settings for adding field ID aliases. - $this->drupalGet('admin/structure/views/view/test_serialize_display_field/edit/rest_export_1'); - $row_options = 'admin/structure/views/nojs/display/test_serialize_display_field/rest_export_1/row_options'; + $this->drupalGet('admin/structure/views/view/test_serializer_display_field/edit/rest_export_1'); + $row_options = 'admin/structure/views/nojs/display/test_serializer_display_field/rest_export_1/row_options'; $this->assertLinkByHref($row_options); // Test an empty string for an alias, this should not be used. This also @@ -145,7 +150,7 @@ public function testUIFieldAlias() { $this->drupalPost($row_options, array('row_options[aliases][name]' => ''), t('Apply')); $this->drupalPost(NULL, array(), t('Save')); - $view = views_get_view('test_serialize_display_field'); + $view = views_get_view('test_serializer_display_field'); $view->setDisplay('rest_export_1'); $this->executeView($view); @@ -174,7 +179,7 @@ public function testUIFieldAlias() { $this->drupalPost($row_options, $edit, t('Apply')); $this->drupalPost(NULL, array(), t('Save')); - $view = views_get_view('test_serialize_display_field'); + $view = views_get_view('test_serializer_display_field'); $view->setDisplay('ws_endpoint_1'); $this->executeView($view); diff --git a/core/modules/rest/tests/modules/rest_test_views/rest_test_views.info b/core/modules/rest/tests/modules/rest_test_views/rest_test_views.info new file mode 100644 index 0000000..b529491 --- /dev/null +++ b/core/modules/rest/tests/modules/rest_test_views/rest_test_views.info @@ -0,0 +1,8 @@ +name = REST test views +description = Provides default views for views REST tests. +package = Testing +version = VERSION +core = 8.x +dependencies[] = rest +dependencies[] = views +hidden = TRUE diff --git a/core/modules/rest/tests/modules/rest_test_views/rest_test_views.module b/core/modules/rest/tests/modules/rest_test_views/rest_test_views.module new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/core/modules/rest/tests/modules/rest_test_views/rest_test_views.module @@ -0,0 +1 @@ +