Issue #1855228 by damiankloip: Move Views core module tests to their respective modules.
parent
881b8a6a17
commit
0631d191c7
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests the argument_comment_user_uid handler.
|
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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\ViewTestBase;
|
||||||
|
use Drupal\views\Tests\ViewTestData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the argument_comment_user_uid handler.
|
* Tests the argument_comment_user_uid handler.
|
||||||
|
@ -19,11 +20,13 @@ abstract class CommentTestBase extends ViewTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('comment');
|
public static $modules = array('comment', 'comment_test_views');
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
parent::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
|
// 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.
|
// with user2 as author. For the second node add a comment from user1.
|
||||||
$this->account = $this->drupalCreateUser();
|
$this->account = $this->drupalCreateUser();
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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\entity\DatabaseStorageController;
|
||||||
use Drupal\views\Tests\ViewTestBase;
|
use Drupal\views\Tests\ViewTestBase;
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests the filter_comment_user_uid handler.
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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;
|
use Drupal\views\Tests\Wizard\WizardTestBase;
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
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
|
|
@ -0,0 +1 @@
|
||||||
|
<?php
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Test the produced views_data.
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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).
|
* - 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\ViewTestBase;
|
||||||
|
use Drupal\views\Tests\ViewTestData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides some helper methods for testing fieldapi integration into views.
|
* Provides some helper methods for testing fieldapi integration into views.
|
||||||
*/
|
*/
|
||||||
abstract class FieldTestBase extends ViewTestBase {
|
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.
|
* Stores the field definitions used by the test.
|
||||||
* @var array
|
* @var array
|
||||||
|
@ -37,6 +45,12 @@ abstract class FieldTestBase extends ViewTestBase {
|
||||||
*/
|
*/
|
||||||
public $instances;
|
public $instances;
|
||||||
|
|
||||||
|
protected function setUp() {
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
ViewTestData::importTestViews(get_class($this), array('field_test_views'));
|
||||||
|
}
|
||||||
|
|
||||||
function setUpFields($amount = 3) {
|
function setUpFields($amount = 3) {
|
||||||
// Create three fields.
|
// Create three fields.
|
||||||
$field_names = array();
|
$field_names = array();
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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;
|
use Drupal\views\ViewExecutable;
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = User test views
|
||||||
|
description = Provides default views for views user tests.
|
||||||
|
package = Testing
|
||||||
|
version = VERSION
|
||||||
|
core = 8.x
|
||||||
|
dependencies[] = views
|
||||||
|
hidden = TRUE
|
|
@ -0,0 +1 @@
|
||||||
|
<?php
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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;
|
use Drupal\Core\Language\Language;
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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;
|
use Drupal\Core\Language\Language;
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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;
|
use Drupal\Core\Language\Language;
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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\views\Tests\ViewUnitTestBase;
|
||||||
use Drupal\Core\Language\Language;
|
use Drupal\Core\Language\Language;
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests the Drupal\node\Plugin\views\field\Type handler.
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests the node_uid_revision handler.
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?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
|
* @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\ViewTestBase;
|
||||||
|
use Drupal\views\Tests\ViewTestData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests basic node_revision table integration into views.
|
* Tests basic node_revision table integration into views.
|
||||||
*/
|
*/
|
||||||
class RevisionRelationships extends ViewTestBase {
|
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.
|
* Views used by this test.
|
||||||
*
|
*
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests the node.status_extra field handler.
|
|
@ -0,0 +1,8 @@
|
||||||
|
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
|
|
@ -0,0 +1 @@
|
||||||
|
<?php
|
|
@ -0,0 +1,20 @@
|
||||||
|
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
|
* @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.
|
* Tests the node_term_data relationship handler.
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests the representative node relationship for terms.
|
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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\ViewTestBase;
|
||||||
|
use Drupal\views\Tests\ViewTestData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all taxonomy tests.
|
* Base class for all taxonomy tests.
|
||||||
|
@ -19,7 +20,7 @@ abstract class TaxonomyTestBase extends ViewTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('taxonomy');
|
public static $modules = array('taxonomy', 'taxonomy_test_views');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the nodes used for the different tests.
|
* Stores the nodes used for the different tests.
|
||||||
|
@ -46,6 +47,8 @@ abstract class TaxonomyTestBase extends ViewTestBase {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->mockStandardInstall();
|
$this->mockStandardInstall();
|
||||||
|
|
||||||
|
ViewTestData::importTestViews(get_class($this), array('taxonomy_test_views'));
|
||||||
|
|
||||||
$this->term1 = $this->createTerm();
|
$this->term1 = $this->createTerm();
|
||||||
$this->term2 = $this->createTerm();
|
$this->term2 = $this->createTerm();
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
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
|
|
@ -0,0 +1 @@
|
||||||
|
<?php
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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;
|
use Drupal\user\Plugin\views\access\Permission;
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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;
|
use Drupal\user\Plugin\views\access\Role;
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* A common test base class for the user access plugin tests.
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests views user argument default plugin.
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests views user argument validator plugin.
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests views user uid argument handler.
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests the field username handler.
|
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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\ViewTestBase;
|
||||||
|
use Drupal\views\Tests\ViewTestData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the handler of the user: name filter.
|
* Tests the handler of the user: name filter.
|
||||||
|
@ -16,6 +17,13 @@ use Drupal\views\Tests\ViewTestBase;
|
||||||
*/
|
*/
|
||||||
class HandlerFilterUserNameTest extends ViewTestBase {
|
class HandlerFilterUserNameTest extends ViewTestBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modules to enable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $modules = array('views_ui', 'user_test_views');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Views used by this test.
|
* Views used by this test.
|
||||||
*
|
*
|
||||||
|
@ -23,13 +31,6 @@ class HandlerFilterUserNameTest extends ViewTestBase {
|
||||||
*/
|
*/
|
||||||
public static $testViews = array('test_user_name');
|
public static $testViews = array('test_user_name');
|
||||||
|
|
||||||
/**
|
|
||||||
* Modules to enable.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public static $modules = array('views_ui');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accounts used by this test.
|
* Accounts used by this test.
|
||||||
*
|
*
|
||||||
|
@ -64,6 +65,8 @@ class HandlerFilterUserNameTest extends ViewTestBase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
ViewTestData::importTestViews(get_class($this), array('user_test_views'));
|
||||||
|
|
||||||
$this->enableViewsTestModule();
|
$this->enableViewsTestModule();
|
||||||
|
|
||||||
$this->accounts = array();
|
$this->accounts = array();
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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.
|
* Tests the representative node relationship for users.
|
|
@ -2,18 +2,26 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @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\ViewTestBase;
|
||||||
|
use Drupal\views\Tests\ViewTestData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo.
|
* @todo.
|
||||||
*/
|
*/
|
||||||
abstract class UserTestBase extends ViewTestBase {
|
abstract class UserTestBase extends ViewTestBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modules to enable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $modules = array('user_test_views');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Users to use during this test.
|
* Users to use during this test.
|
||||||
*
|
*
|
||||||
|
@ -31,6 +39,8 @@ abstract class UserTestBase extends ViewTestBase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
ViewTestData::importTestViews(get_class($this), array('user_test_views'));
|
||||||
|
|
||||||
$this->users[] = $this->drupalCreateUser();
|
$this->users[] = $this->drupalCreateUser();
|
||||||
$this->users[] = user_load(1);
|
$this->users[] = user_load(1);
|
||||||
$this->nodes[] = $this->drupalCreateNode(array('uid' => $this->users[0]->uid));
|
$this->nodes[] = $this->drupalCreateNode(array('uid' => $this->users[0]->uid));
|
|
@ -0,0 +1,8 @@
|
||||||
|
name = User test views
|
||||||
|
description = Provides default views for views user tests.
|
||||||
|
package = Testing
|
||||||
|
version = VERSION
|
||||||
|
core = 8.x
|
||||||
|
dependencies[] = user
|
||||||
|
dependencies[] = views
|
||||||
|
hidden = TRUE
|
|
@ -0,0 +1 @@
|
||||||
|
<?php
|
|
@ -1,16 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* Definition of Drupal\views\Tests\Node\NodeTestBase.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Drupal\views\Tests\Node;
|
|
||||||
|
|
||||||
use Drupal\views\Tests\ViewTestBase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for all node tests.
|
|
||||||
*/
|
|
||||||
abstract class NodeTestBase extends ViewTestBase {
|
|
||||||
}
|
|
|
@ -31,7 +31,7 @@ abstract class ViewTestBase extends WebTestBase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
ViewTestData::importTestViews(get_class($this));
|
ViewTestData::importTestViews(get_class($this), array('views_test_config'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,12 +26,11 @@ class ViewTestData {
|
||||||
* The name of the test class.
|
* The name of the test class.
|
||||||
* @param array $modules
|
* @param array $modules
|
||||||
* (optional) The module directories to look in for test views.
|
* (optional) The module directories to look in for test views.
|
||||||
* The views_test_config module will always be checked.
|
* Defaults to an empty array.
|
||||||
*
|
*
|
||||||
* @see config_install_default_config()
|
* @see config_install_default_config()
|
||||||
*/
|
*/
|
||||||
public static function importTestViews($class, $modules = array()) {
|
public static function importTestViews($class, $modules = array()) {
|
||||||
$modules[] = 'views_test_config';
|
|
||||||
$views = array();
|
$views = array();
|
||||||
while ($class) {
|
while ($class) {
|
||||||
if (property_exists($class, 'testViews')) {
|
if (property_exists($class, 'testViews')) {
|
||||||
|
@ -48,6 +47,10 @@ class ViewTestData {
|
||||||
);
|
);
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
$config_dir = drupal_get_path('module', $module) . '/test_views';
|
$config_dir = drupal_get_path('module', $module) . '/test_views';
|
||||||
|
if (!is_dir($config_dir) || !module_exists($module)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$source_storage = new FileStorage($config_dir);
|
$source_storage = new FileStorage($config_dir);
|
||||||
foreach ($source_storage->listAll() as $config_name) {
|
foreach ($source_storage->listAll() as $config_name) {
|
||||||
list(, , $id) = explode('.', $config_name);
|
list(, , $id) = explode('.', $config_name);
|
||||||
|
|
|
@ -42,7 +42,7 @@ abstract class ViewUnitTestBase extends DrupalUnitTestBase {
|
||||||
}
|
}
|
||||||
$query->execute();
|
$query->execute();
|
||||||
|
|
||||||
ViewTestData::importTestViews(get_class($this));
|
ViewTestData::importTestViews(get_class($this), array('views_test_config'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue