Commit 0631d191 authored by catch's avatar catch

Issue #1855228 by damiankloip: Move Views core module tests to their respective modules.

parent 881b8a6a
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\Comment\ArgumentUserUIDTest.
* Contains \Drupal\comment\Tests\Views\ArgumentUserUIDTest.
*/
namespace Drupal\views\Tests\Comment;
namespace Drupal\comment\Tests\Views;
/**
* Tests the argument_comment_user_uid handler.
......
......@@ -2,12 +2,13 @@
/**
* @file
* Definition of Drupal\views\Tests\Comment\CommentTestBase.
* Contains \Drupal\comment\Tests\Views\CommentTestBase.
*/
namespace Drupal\views\Tests\Comment;
namespace Drupal\comment\Tests\Views;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* Tests the argument_comment_user_uid handler.
......@@ -19,11 +20,13 @@ abstract class CommentTestBase extends ViewTestBase {
*
* @var array
*/
public static $modules = array('comment');
public static $modules = array('comment', 'comment_test_views');
function setUp() {
parent::setUp();
ViewTestData::importTestViews(get_class($this), array('comment_test_views'));
// Add two users, create a node with the user1 as author and another node
// with user2 as author. For the second node add a comment from user1.
$this->account = $this->drupalCreateUser();
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\Comment\DefaultViewRecentComments.
* Contains \Drupal\comment\Tests\Views\DefaultViewRecentComments.
*/
namespace Drupal\views\Tests\Comment;
namespace Drupal\comment\Tests\Views;
use Drupal\entity\DatabaseStorageController;
use Drupal\views\Tests\ViewTestBase;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\Comment\FilterUserUIDTest.
* Contains \Drupal\comment\Tests\Views\FilterUserUIDTest.
*/
namespace Drupal\views\Tests\Comment;
namespace Drupal\comment\Tests\Views;
/**
* Tests the filter_comment_user_uid handler.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\Comment\WizardTest.
* Contains \Drupal\comment\Tests\Views\WizardTest.
*/
namespace Drupal\views\Tests\Comment;
namespace Drupal\comment\Tests\Views;
use Drupal\views\Tests\Wizard\WizardTestBase;
......
name = Comment test views
description = Provides default views for views comment tests.
package = Testing
version = VERSION
core = 8.x
dependencies[] = comment
dependencies[] = views
hidden = TRUE
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Test\Field\ApiDataTest.
* Contains \Drupal\field\Tests\Views\ApiDataTest.
*/
namespace Drupal\views\Tests\Field;
namespace Drupal\field\Tests\Views;
/**
* Test the produced views_data.
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\views\Test\Field\FieldTestBase.
* Contains \Drupal\field\Tests\Views\FieldTestBase.
*/
/**
......@@ -16,15 +16,23 @@
* - Use relationships between different entity types, for example node and the node author(user).
*/
namespace Drupal\views\Tests\Field;
namespace Drupal\field\Tests\Views;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* Provides some helper methods for testing fieldapi integration into views.
*/
abstract class FieldTestBase extends ViewTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('field_test_views');
/**
* Stores the field definitions used by the test.
* @var array
......@@ -37,6 +45,12 @@ abstract class FieldTestBase extends ViewTestBase {
*/
public $instances;
protected function setUp() {
parent::setUp();
ViewTestData::importTestViews(get_class($this), array('field_test_views'));
}
function setUpFields($amount = 3) {
// Create three fields.
$field_names = array();
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Test\Field\HandlerFieldFieldTest.
* Contains \Drupal\field\Tests\Views\HandlerFieldFieldTest.
*/
namespace Drupal\views\Tests\Field;
namespace Drupal\field\Tests\Views;
use Drupal\views\ViewExecutable;
......
name = User test views
description = Provides default views for views user tests.
package = Testing
version = VERSION
core = 8.x
dependencies[] = views
hidden = TRUE
......@@ -2,10 +2,10 @@
/**
* @file
* Contains Drupal\views\Tests\Language\ArgumentLanguageTest.
* Contains \Drupal\language\Tests\Views\ArgumentLanguageTest.
*/
namespace Drupal\views\Tests\Language;
namespace Drupal\language\Tests\Views;
use Drupal\Core\Language\Language;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains Drupal\views\Tests\Language\FieldLanguageTest.
* Contains \Drupal\language\Tests\Views\FieldLanguageTest.
*/
namespace Drupal\views\Tests\Language;
namespace Drupal\language\Tests\Views;
use Drupal\Core\Language\Language;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains Drupal\views\Tests\Language\FilterLanguageTest.
* Contains \Drupal\language\Tests\Views\FilterLanguageTest.
*/
namespace Drupal\views\Tests\Language;
namespace Drupal\language\Tests\Views;
use Drupal\Core\Language\Language;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains Drupal\views\Tests\Language\LanguageTestBase.
* Contains \Drupal\language\Tests\Views\LanguageTestBase.
*/
namespace Drupal\views\Tests\Language;
namespace Drupal\language\Tests\Views;
use Drupal\views\Tests\ViewUnitTestBase;
use Drupal\Core\Language\Language;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\Node\FieldTypeTest.
* Contains \Drupal\node\Tests\Views\FieldTypeTest.
*/
namespace Drupal\views\Tests\Node;
namespace Drupal\node\Tests\Views;
/**
* Tests the Drupal\node\Plugin\views\field\Type handler.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\Comment\FilterUidRevisionTest.
* Contains \Drupal\node\Tests\Views\FilterUidRevisionTest.
*/
namespace Drupal\views\Tests\Node;
namespace Drupal\node\Tests\Views;
/**
* Tests the node_uid_revision handler.
......
<?php
/**
* @file
* Contains \Drupal\node\Tests\Views\NodeTestBase.
*/
namespace Drupal\node\Tests\Views;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* Base class for all node tests.
*/
abstract class NodeTestBase extends ViewTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('node_test_views');
protected function setUp() {
parent::setUp();
ViewTestData::importTestViews(get_class($this), array('node_test_views'));
}
}
......@@ -2,17 +2,31 @@
/**
* @file
* Definition of Drupal\views\Tests\Node\RevisionRelationships.
* Contains \Drupal\node\Tests\Views\RevisionRelationships.
*/
namespace Drupal\views\Tests\Node;
namespace Drupal\node\Tests\Views;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* Tests basic node_revision table integration into views.
*/
class RevisionRelationships extends ViewTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('node' ,'node_test_views');
protected function setUp() {
parent::setUp();
ViewTestData::importTestViews(get_class($this), array('node_test_views'));
}
/**
* Views used by this test.
*
......
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\views\Tests\Node\StatusExtraTest.
* Contains \Drupal\node\Tests\Views\StatusExtraTest.
*/
namespace Drupal\views\Tests\Node;
namespace Drupal\node\Tests\Views;
/**
* Tests the node.status_extra field handler.
......
name = Node test views
description = Provides default views for views node tests.
package = Testing
version = VERSION
core = 8.x
dependencies[] = node
dependencies[] = views
hidden = TRUE
api_version: '3.0'
base_table: node
core: '8'
description: ''
disabled: '0'
display:
default:
display_options:
fields:
type:
field: type
id: type
table: node
display_plugin: default
display_title: Master
id: default
position: '0'
human_name: ''
name: test_field_type
tag: ''
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\Taxonomy\RelationshipNodeTermDataTest.
* Contains \Drupal\taxonomy\Tests\Views\RelationshipNodeTermDataTest.
*/
namespace Drupal\views\Tests\Taxonomy;
namespace Drupal\taxonomy\Tests\Views;
/**
* Tests the node_term_data relationship handler.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\Taxonomy\RelationshipRepresentativeNode.
* Contains \Drupal\taxonomy\Tests\Views\RelationshipRepresentativeNode.
*/
namespace Drupal\views\Tests\Taxonomy;
namespace Drupal\taxonomy\Tests\Views;
/**
* Tests the representative node relationship for terms.
......
......@@ -2,12 +2,13 @@
/**
* @file
* Definition of Drupal\views\Tests\Taxonomy\TaxonomyTestBase.
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyTestBase.
*/
namespace Drupal\views\Tests\Taxonomy;
namespace Drupal\taxonomy\Tests\Views;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* Base class for all taxonomy tests.
......@@ -19,7 +20,7 @@ abstract class TaxonomyTestBase extends ViewTestBase {
*
* @var array
*/
public static $modules = array('taxonomy');
public static $modules = array('taxonomy', 'taxonomy_test_views');
/**
* Stores the nodes used for the different tests.
......@@ -46,6 +47,8 @@ function setUp() {
parent::setUp();
$this->mockStandardInstall();
ViewTestData::importTestViews(get_class($this), array('taxonomy_test_views'));
$this->term1 = $this->createTerm();
$this->term2 = $this->createTerm();
......
name = Taxonomy test views
description = Provides default views for views taxonomy tests.
package = Testing
version = VERSION
core = 8.x
dependencies[] = taxonomy
dependencies[] = views
hidden = TRUE
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\User\AccessPermissionTest.
* Contains \Drupal\user\Tests\Views\AccessPermissionTest.
*/
namespace Drupal\views\Tests\User;
namespace Drupal\user\Tests\Views;
use Drupal\user\Plugin\views\access\Permission;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\User\AccessRoleTest.
* Contains \Drupal\user\Tests\Views\AccessRoleTest.
*/
namespace Drupal\views\Tests\User;
namespace Drupal\user\Tests\Views;
use Drupal\user\Plugin\views\access\Role;
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\Uses\AccessTestBase.
* Contains \Drupal\user\Tests\Views\AccessTestBase.
*/
namespace Drupal\views\Tests\User;
namespace Drupal\user\Tests\Views;
/**
* A common test base class for the user access plugin tests.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\User\ArgumentDefaultTest.
* Contains \Drupal\user\Tests\Views\ArgumentDefaultTest.
*/
namespace Drupal\views\Tests\User;
namespace Drupal\user\Tests\Views;
/**
* Tests views user argument default plugin.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\User\ArgumentValidateTest.
* Contains \Drupal\user\Tests\Views\ArgumentValidateTest.
*/
namespace Drupal\views\Tests\User;
namespace Drupal\user\Tests\Views;
/**
* Tests views user argument validator plugin.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\User\HandlerArgumentUserUidTest.
* Contains \Drupal\user\Tests\Views\HandlerArgumentUserUidTest.
*/
namespace Drupal\views\Tests\User;
namespace Drupal\user\Tests\Views;
/**
* Tests views user uid argument handler.
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\User\HandlerFieldUserNameTest.
* Contains \Drupal\user\Tests\Views\HandlerFieldUserNameTest.
*/
namespace Drupal\views\Tests\User;
namespace Drupal\user\Tests\Views;
/**
* Tests the field username handler.
......
......@@ -2,12 +2,13 @@
/**
* @file
* Definition of Drupal\views\Tests\User\HandlerFilterUserNameTest.
* Contains \Drupal\user\Tests\Views\HandlerFilterUserNameTest.
*/
namespace Drupal\views\Tests\User;
namespace Drupal\user\Tests\Views;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* Tests the handler of the user: name filter.
......@@ -17,18 +18,18 @@
class HandlerFilterUserNameTest extends ViewTestBase {
/**
* Views used by this test.
* Modules to enable.
*
* @var array
*/
public static $testViews = array('test_user_name');
public static $modules = array('views_ui', 'user_test_views');
/**
* Modules to enable.
* Views used by this test.
*
* @var array
*/
public static $modules = array('views_ui');
public static $testViews = array('test_user_name');
/**
* Accounts used by this test.
......@@ -64,6 +65,8 @@ public static function getInfo() {
protected function setUp() {
parent::setUp();
ViewTestData::importTestViews(get_class($this), array('user_test_views'));
$this->enableViewsTestModule();
$this->accounts = array();
......
......@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\views\Tests\User\RelationshipRepresentativeNode.
* Contains \Drupal\user\Tests\Views\RelationshipRepresentativeNode.
*/
namespace Drupal\views\Tests\User;
namespace Drupal\user\Tests\Views;
/**
* Tests the representative node relationship for users.
......
......@@ -2,18 +2,26 @@
/**
* @file
* Definition of Drupal\views\Tests\User\UserTestBase.
* Contains \Drupal\user\Tests\Views\UserTestBase.
*/
namespace Drupal\views\Tests\User;
namespace Drupal\user\Tests\Views;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* @todo.
*/
abstract class UserTestBase extends ViewTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('user_test_views');
/**
* Users to use during this test.
*
......@@ -31,6 +39,8 @@ abstract class UserTestBase extends ViewTestBase {
protected function setUp() {
parent::setUp();
ViewTestData::importTestViews(get_class($this), array('user_test_views'));
$this->users[] = $this->drupalCreateUser();
$this->users[] = user_load(1);
$this->nodes[] = $this->drupalCreateNode(array('uid' => $this->users[0]->uid));
......
name = User test views
description = Provides default views for views user tests.
package = Testing
version = VERSION
core = 8.x
dependencies[] = user
dependencies[] = views