diff --git a/core/modules/views/lib/Drupal/views/Tests/BasicTest.php b/core/modules/views/lib/Drupal/views/Tests/BasicTest.php index 5464adc27be9..f90cf64df3cc 100644 --- a/core/modules/views/lib/Drupal/views/Tests/BasicTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/BasicTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests; */ class BasicTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view', 'test_simple_argument'); + public static function getInfo() { return array( 'name' => 'Basic query tests', @@ -101,56 +108,8 @@ class BasicTest extends ViewUnitTestBase { * Tests simple argument. */ public function testSimpleArgument() { - $view = views_get_view('test_view'); - $view->setDisplay(); - - // Add a argument. - $view->displayHandlers['default']->overrideOption('arguments', array( - 'age' => array( - 'default_action' => 'ignore', - 'style_plugin' => 'default_summary', - 'style_options' => array(), - 'wildcard' => 'all', - 'wildcard_substitution' => 'All', - 'title' => '', - 'breadcrumb' => '', - 'default_argument_type' => 'fixed', - 'default_argument' => '', - 'validate' => array( - 'type' => 'none', - 'fail' => 'not found', - ), - 'break_phrase' => 0, - 'not' => 0, - 'id' => 'age', - 'table' => 'views_test_data', - 'field' => 'age', - 'validate_user_argument_type' => 'uid', - 'validate_user_roles' => array( - '2' => 0, - ), - 'relationship' => 'none', - 'default_options_div_prefix' => '', - 'default_argument_user' => 0, - 'default_argument_fixed' => '', - 'default_argument_php' => '', - 'validate_argument_node_type' => array( - 'page' => 0, - 'story' => 0, - ), - 'validate_argument_node_access' => 0, - 'validate_argument_nid_type' => 'nid', - 'validate_argument_vocabulary' => array(), - 'validate_argument_type' => 'tid', - 'validate_argument_transform' => 0, - 'validate_user_restrict_roles' => 0, - 'validate_argument_php' => '', - ) - )); - - $saved_view = clone $view; - // Execute with a view + $view = views_get_view('test_simple_argument'); $view->setArguments(array(27)); $this->executeView($view); @@ -171,7 +130,7 @@ class BasicTest extends ViewUnitTestBase { )); // Test "show all" if no argument is present. - $view = $saved_view->cloneView(); + $view = views_get_view('test_simple_argument'); $this->executeView($view); // Build the expected result. diff --git a/core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php b/core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php index 8410b5d3ece8..6494b907ad4b 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\Comment; */ class ArgumentUserUIDTest extends CommentTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_comment_user_uid'); + public static function getInfo() { return array( 'name' => 'Comment: User UID Argument', @@ -21,7 +28,8 @@ class ArgumentUserUIDTest extends CommentTestBase { } function testCommentUserUIDTest() { - $this->executeView($this->view, array($this->account->uid)); + $view = views_get_view('test_comment_user_uid'); + $this->executeView($view, array($this->account->uid)); $result_set = array( array( 'nid' => $this->node_user_posted->nid, @@ -30,8 +38,8 @@ class ArgumentUserUIDTest extends CommentTestBase { 'nid' => $this->node_user_commented->nid, ), ); - $this->column_map = array('nid' => 'nid'); - $this->assertIdenticalResultset($this->view, $result_set, $this->column_map); + $column_map = array('nid' => 'nid'); + $this->assertIdenticalResultset($view, $result_set, $column_map); } } diff --git a/core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php index a855afe47f30..c51e0f17014d 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/CommentTestBase.php @@ -42,11 +42,4 @@ abstract class CommentTestBase extends ViewTestBase { entity_create('comment', $comment)->save(); } - /** - * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). - */ - protected function getBasicView() { - return $this->createViewFromConfig('test_comment_user_uid'); - } - } diff --git a/core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php b/core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php index 00ba08cabc6e..271711ff90c4 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php @@ -14,6 +14,13 @@ namespace Drupal\views\Tests\Comment; */ class FilterUserUIDTest extends CommentTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_comment_user_uid'); + public static function getInfo() { return array( 'name' => 'Comment: User UID Filter', @@ -23,7 +30,9 @@ class FilterUserUIDTest extends CommentTestBase { } function testCommentUserUIDTest() { - $this->view->setItem('default', 'argument', 'uid_touch', NULL); + $view = views_get_view('test_comment_user_uid'); + $view->setDisplay(); + $view->setItem('default', 'argument', 'uid_touch', NULL); $options = array( 'id' => 'uid_touch', @@ -31,8 +40,8 @@ class FilterUserUIDTest extends CommentTestBase { 'field' => 'uid_touch', 'value' => array($this->loggedInUser->uid), ); - $this->view->addItem('default', 'filter', 'node', 'uid_touch', $options); - $this->executeView($this->view, array($this->account->uid)); + $view->addItem('default', 'filter', 'node', 'uid_touch', $options); + $this->executeView($view, array($this->account->uid)); $result_set = array( array( 'nid' => $this->node_user_posted->nid, @@ -42,7 +51,7 @@ class FilterUserUIDTest extends CommentTestBase { ), ); $this->column_map = array('nid' => 'nid'); - $this->assertIdenticalResultset($this->view, $result_set, $this->column_map); + $this->assertIdenticalResultset($view, $result_set, $this->column_map); } } diff --git a/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php index a950621d4694..0a0c07c65dfa 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php @@ -14,6 +14,12 @@ use Drupal\views\Tests\ViewTestBase; */ class FieldEntityTest extends ViewTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_field_get_entity'); /** * Modules to enable. diff --git a/core/modules/views/lib/Drupal/views/Tests/Field/HandlerFieldFieldTest.php b/core/modules/views/lib/Drupal/views/Tests/Field/HandlerFieldFieldTest.php index 89c2baa7c032..8f294dd7323a 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Field/HandlerFieldFieldTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Field/HandlerFieldFieldTest.php @@ -7,6 +7,8 @@ namespace Drupal\views\Tests\Field; +use Drupal\views\ViewExecutable; + /** * Tests the field_field handler. * @TODO @@ -17,6 +19,13 @@ namespace Drupal\views\Tests\Field; */ class HandlerFieldFieldTest extends FieldTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view_fieldapi'); + public $nodes; public static function getInfo() { @@ -27,6 +36,9 @@ class HandlerFieldFieldTest extends FieldTestBase { ); } + /** + * @todo. + */ protected function setUp() { parent::setUp(); @@ -59,19 +71,21 @@ class HandlerFieldFieldTest extends FieldTestBase { $this->nodes[$i] = $this->drupalCreateNode($edit); } - - foreach ($this->fields as $key => $field) { - $this->view->display_handler->display['display_options']['fields'][$field['field_name']]['id'] = $field['field_name']; - $this->view->display_handler->display['display_options']['fields'][$field['field_name']]['table'] = 'field_data_' . $field['field_name']; - $this->view->display_handler->display['display_options']['fields'][$field['field_name']]['field'] = $field['field_name']; - } } /** - * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). + * Sets up the testing view with random field data. + * + * @param \Drupal\views\ViewExecutable $view + * The view to add field data to. */ - protected function getBasicView() { - return $this->createViewFromConfig('test_view_fieldapi'); + protected function prepareView(ViewExecutable $view) { + $view->initDisplay(); + foreach ($this->fields as $key => $field) { + $view->display_handler->options['fields'][$field['field_name']]['id'] = $field['field_name']; + $view->display_handler->options['fields'][$field['field_name']]['table'] = 'field_data_' . $field['field_name']; + $view->display_handler->options['fields'][$field['field_name']]['field'] = $field['field_name']; + } } public function testFieldRender() { @@ -81,7 +95,8 @@ class HandlerFieldFieldTest extends FieldTestBase { } public function _testSimpleFieldRender() { - $view = $this->getView(); + $view = views_get_view('test_view_fieldapi'); + $this->prepareView($view); $this->executeView($view); // Tests that the rendered fields match the actual value of the fields. @@ -99,7 +114,8 @@ class HandlerFieldFieldTest extends FieldTestBase { * Tests that fields with formatters runs as expected. */ public function _testFormatterSimpleFieldRender() { - $view = $this->getView(); + $view = views_get_view('test_view_fieldapi'); + $this->prepareView($view); $view->displayHandlers['default']->options['fields'][$this->fields[0]['field_name']]['type'] = 'text_trimmed'; $view->displayHandlers['default']->options['fields'][$this->fields[0]['field_name']]['settings'] = array( 'trim_length' => 3, @@ -115,11 +131,11 @@ class HandlerFieldFieldTest extends FieldTestBase { } public function _testMultipleFieldRender() { - $view = $this->getView(); + $view = views_get_view('test_view_fieldapi'); $field_name = $this->fields[3]['field_name']; // Test delta limit. - $view->initDisplay(); + $this->prepareView($view); $view->displayHandlers['default']->options['fields'][$field_name]['group_rows'] = TRUE; $view->displayHandlers['default']->options['fields'][$field_name]['delta_limit'] = 3; $this->executeView($view); @@ -141,7 +157,7 @@ class HandlerFieldFieldTest extends FieldTestBase { $view->destroy(); // Test delta limit + offset - $view->initDisplay(); + $this->prepareView($view); $view->displayHandlers['default']->options['fields'][$field_name]['group_rows'] = TRUE; $view->displayHandlers['default']->options['fields'][$field_name]['delta_limit'] = 3; $view->displayHandlers['default']->options['fields'][$field_name]['delta_offset'] = 1; @@ -160,7 +176,7 @@ class HandlerFieldFieldTest extends FieldTestBase { $view->destroy(); // Test delta limit + reverse. - $view->initDisplay(); + $this->prepareView($view); $view->displayHandlers['default']->options['fields'][$field_name]['delta_offset'] = 0; $view->displayHandlers['default']->options['fields'][$field_name]['group_rows'] = TRUE; $view->displayHandlers['default']->options['fields'][$field_name]['delta_limit'] = 3; @@ -181,7 +197,7 @@ class HandlerFieldFieldTest extends FieldTestBase { $view->destroy(); // Test delta first last. - $view->initDisplay(); + $this->prepareView($view); $view->displayHandlers['default']->options['fields'][$field_name]['group_rows'] = TRUE; $view->displayHandlers['default']->options['fields'][$field_name]['delta_limit'] = 0; $view->displayHandlers['default']->options['fields'][$field_name]['delta_first_last'] = TRUE; @@ -199,7 +215,7 @@ class HandlerFieldFieldTest extends FieldTestBase { $view->destroy(); // Test delta limit + custom seperator. - $view->initDisplay(); + $this->prepareView($view); $view->displayHandlers['default']->options['fields'][$field_name]['delta_first_last'] = FALSE; $view->displayHandlers['default']->options['fields'][$field_name]['delta_limit'] = 3; $view->displayHandlers['default']->options['fields'][$field_name]['group_rows'] = TRUE; diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTest.php index 68ee28dbfa82..7d3269042fa7 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTest.php @@ -15,6 +15,13 @@ namespace Drupal\views\Tests\Handler; */ class AreaTest extends HandlerTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_example_area'); + /** * Modules to enable. * diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php index f8f78af30552..43b807e1978b 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php @@ -16,6 +16,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class AreaTextTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Area: Text', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentNullTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentNullTest.php index bead17a8dc91..cf3cda6a0ac2 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentNullTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentNullTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class ArgumentNullTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Argument: Null', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentStringTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentStringTest.php index d2a2e5593410..b0098f3b6023 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentStringTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentStringTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\Handler; */ class ArgumentStringTest extends HandlerTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_glossary'); + public static function getInfo() { return array( 'name' => 'Argument: String', @@ -35,7 +42,7 @@ class ArgumentStringTest extends HandlerTestBase { } } - $view = $this->createViewFromConfig('test_glossary'); + $view = views_get_view('test_glossary'); $this->executeView($view); $count_field = 'nid'; diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldBooleanTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldBooleanTest.php index 6b75e28ae813..eadd129b89da 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldBooleanTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldBooleanTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FieldBooleanTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Field: Boolean', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCounterTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCounterTest.php index ac325c396590..ce5599af01c5 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCounterTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCounterTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FieldCounterTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Field: Counter', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCustomTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCustomTest.php index 1b78cf98cf03..41b0611d753c 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCustomTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCustomTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FieldCustomTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Field: Custom', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldDateTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldDateTest.php index 6e01162d7699..e6a279cd0806 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldDateTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldDateTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FieldDateTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Field: Date', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldFileSizeTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldFileSizeTest.php index 9755e62b5020..fd6b524551ab 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldFileSizeTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldFileSizeTest.php @@ -16,6 +16,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FieldFileSizeTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Field: File size', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php index 2624923a933a..bb735f0b2cf3 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php @@ -16,6 +16,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FieldUnitTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view', 'test_field_tokens', 'test_field_output'); + protected $column_map = array( 'views_test_data_name' => 'name', ); diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUrlTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUrlTest.php index 8239ab918531..55336b02b250 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUrlTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUrlTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FieldUrlTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Field: URL', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldWebTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldWebTest.php index f1b919ab607f..9d8c66e11c0a 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldWebTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldWebTest.php @@ -14,6 +14,13 @@ namespace Drupal\views\Tests\Handler; */ class FieldWebTest extends HandlerTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view', 'test_field_classes', 'test_field_output', 'test_click_sort'); + protected $column_map = array( 'views_test_data_name' => 'name', ); diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldXssTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldXssTest.php index d018e16199d7..832b7f146e7c 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldXssTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldXssTest.php @@ -16,6 +16,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FieldXssTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Field: XSS', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterCombineTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterCombineTest.php index d23263815edd..1ec96fa77c97 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterCombineTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterCombineTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FilterCombineTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + protected $column_map = array( 'views_test_data_name' => 'name', 'views_test_data_job' => 'job', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterDateTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterDateTest.php index 226bce3c026f..036896f946db 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterDateTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterDateTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\Handler; */ class FilterDateTest extends HandlerTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_filter_date_between'); + /** * Modules to enable. * @@ -41,14 +48,22 @@ class FilterDateTest extends HandlerTestBase { ); } + /** + * Runs other test methods. + */ + protected function testDateFilter() { + $this->_testOffset(); + $this->_testBetween(); + $this->_testUiValidation(); + } + /** * Test the general offset functionality. */ - function testOffset() { - $saved_view = $this->createViewFromConfig('test_filter_date_between'); + protected function _testOffset() { + $view = views_get_view('test_filter_date_between'); // Test offset for simple operator. - $view = $this->getView($saved_view); $view->initHandlers(); $view->filter['created']->operator = '>'; $view->filter['created']->value['type'] = 'offset'; @@ -58,9 +73,9 @@ class FilterDateTest extends HandlerTestBase { array('nid' => $this->nodes[3]->nid), ); $this->assertIdenticalResultset($view, $expected_result, $this->map); + $view->destroy(); // Test offset for between operator. - $view = $this->getView($saved_view); $view->initHandlers(); $view->filter['created']->operator = 'between'; $view->filter['created']->value['type'] = 'offset'; @@ -76,11 +91,10 @@ class FilterDateTest extends HandlerTestBase { /** * Tests the filter operator between/not between. */ - function testBetween() { - $saved_view = $this->createViewFromConfig('test_filter_date_between'); + protected function _testBetween() { + $view = views_get_view('test_filter_date_between'); // Test between with min and max. - $view = $this->getView($saved_view); $view->initHandlers(); $view->filter['created']->operator = 'between'; $view->filter['created']->value['min'] = format_date(150000, 'custom', 'Y-m-d H:s'); @@ -90,9 +104,9 @@ class FilterDateTest extends HandlerTestBase { array('nid' => $this->nodes[1]->nid), ); $this->assertIdenticalResultset($view, $expected_result, $this->map); + $view->destroy(); // Test between with just max. - $view = $this->getView($saved_view); $view->initHandlers(); $view->filter['created']->operator = 'between'; $view->filter['created']->value['max'] = format_date(250000, 'custom', 'Y-m-d H:s'); @@ -102,9 +116,9 @@ class FilterDateTest extends HandlerTestBase { array('nid' => $this->nodes[1]->nid), ); $this->assertIdenticalResultset($view, $expected_result, $this->map); + $view->destroy(); // Test not between with min and max. - $view = $this->getView($saved_view); $view->initHandlers(); $view->filter['created']->operator = 'not between'; $view->filter['created']->value['min'] = format_date(150000, 'custom', 'Y-m-d H:s'); @@ -116,9 +130,9 @@ class FilterDateTest extends HandlerTestBase { array('nid' => $this->nodes[3]->nid), ); $this->assertIdenticalResultset($view, $expected_result, $this->map); + $view->destroy(); // Test not between with just max. - $view = $this->getView($saved_view); $view->initHandlers(); $view->filter['created']->operator = 'not between'; $view->filter['created']->value['max'] = format_date(150000, 'custom', 'Y-m-d H:s'); @@ -134,9 +148,8 @@ class FilterDateTest extends HandlerTestBase { /** * Make sure the validation callbacks works. */ - function testUiValidation() { - $view = $this->createViewFromConfig('test_filter_date_between'); - $view->save(); + protected function _testUiValidation() { + $view = views_get_view('test_filter_date_between'); $this->drupalLogin($this->drupalCreateUser(array('administer views', 'administer site configuration'))); menu_router_rebuild(); diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterEqualityTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterEqualityTest.php index 7a9da1f5ef1b..f97d5811277e 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterEqualityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterEqualityTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FilterEqualityTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + protected $column_map = array( 'views_test_data_name' => 'name', ); diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterInOperatorTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterInOperatorTest.php index b8c7fbc308a8..d0ea7006de19 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterInOperatorTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterInOperatorTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FilterInOperatorTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + protected $column_map = array( 'views_test_data_name' => 'name', 'views_test_data_age' => 'age', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterNumericTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterNumericTest.php index 0b9d379c4e4b..8343b7fecfd3 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterNumericTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterNumericTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FilterNumericTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + protected $column_map = array( 'views_test_data_name' => 'name', 'views_test_data_age' => 'age', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php index 6c212c2b76a7..f6963cefb6a1 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class FilterStringTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + protected $column_map = array( 'views_test_data_name' => 'name', ); diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAliasTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAliasTest.php index 26e3e036a3a6..29d146c18690 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAliasTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAliasTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class HandlerAliasTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_filter', 'test_alias'); + public static function getInfo() { return array( 'name' => 'Handler alias tests', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php index 00d6b3e2dd7b..28cc00c21a5b 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php @@ -16,6 +16,13 @@ use Drupal\views\Plugin\views\HandlerBase; */ class HandlerTest extends ViewTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view', 'test_view_handler_weight', 'test_handler_relationships', 'test_handler_test_access', 'test_filter_in_operator_ui'); + /** * Modules to enable. * @@ -263,7 +270,8 @@ class HandlerTest extends ViewTestBase { * Tests the relationship method on the base class. */ public function testSetRelationship() { - $view = $this->createViewFromConfig('test_handler_relationships'); + $view = views_get_view('test_handler_relationships'); + $view->setDisplay(); // Setup a broken relationship. $view->addItem('default', 'relationship', $this->randomName(), $this->randomName(), array(), 'broken_relationship'); // Setup a valid relationship. @@ -301,7 +309,7 @@ class HandlerTest extends ViewTestBase { * @see Drupal\views\Plugin\views\HandlerBase::placeholder() */ public function testPlaceholder() { - $view = $this->getView(); + $view = views_get_view('test_view'); $view->initHandlers(); $view->initQuery(); diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/RelationshipTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/RelationshipTest.php index 2bff02b6aa69..f36abee3092e 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/RelationshipTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/RelationshipTest.php @@ -16,6 +16,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class RelationshipTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + /** * Maps between the key in the expected result and the query result. * diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/SortDateTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/SortDateTest.php index 1070f50f6395..2a37a9ccd895 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/SortDateTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/SortDateTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class SortDateTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Sort: Date', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/SortRandomTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/SortRandomTest.php index 9e82185427ca..a8aedf4769b3 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/SortRandomTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/SortRandomTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class SortRandomTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Sort: Random', diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/SortTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/SortTest.php index dd40d0ffbff6..66b9936b7ba4 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/SortTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/SortTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class SortTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Sort: Generic', diff --git a/core/modules/views/lib/Drupal/views/Tests/Language/ArgumentLanguageTest.php b/core/modules/views/lib/Drupal/views/Tests/Language/ArgumentLanguageTest.php index 13cb149687e5..dc14e8f1d485 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Language/ArgumentLanguageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Language/ArgumentLanguageTest.php @@ -16,6 +16,13 @@ use Drupal\Core\Language\Language; */ class ArgumentLanguageTest extends LanguageTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Argument: Language', @@ -28,8 +35,9 @@ class ArgumentLanguageTest extends LanguageTestBase { * Tests the language argument. */ public function testArgument() { + $view = views_get_view('test_view'); foreach (array('en' => 'John', 'xx-lolspeak' => 'George') as $langcode => $name) { - $view = $this->getView(); + $view->setDisplay(); $view->displayHandlers['default']->overrideOption('arguments', array( 'langcode' => array( 'id' => 'langcode', diff --git a/core/modules/views/lib/Drupal/views/Tests/Language/FieldLanguageTest.php b/core/modules/views/lib/Drupal/views/Tests/Language/FieldLanguageTest.php index 0fbe8d4c08e0..1c3c8d415331 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Language/FieldLanguageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Language/FieldLanguageTest.php @@ -16,6 +16,13 @@ use Drupal\Core\Language\Language; */ class FieldLanguageTest extends LanguageTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Field: Language', @@ -28,7 +35,8 @@ class FieldLanguageTest extends LanguageTestBase { * Tests the language field. */ public function testField() { - $view = $this->getView(); + $view = views_get_view('test_view'); + $view->setDisplay(); $view->displayHandlers['default']->overrideOption('fields', array( 'langcode' => array( 'id' => 'langcode', diff --git a/core/modules/views/lib/Drupal/views/Tests/Language/FilterLanguageTest.php b/core/modules/views/lib/Drupal/views/Tests/Language/FilterLanguageTest.php index a2c99cc03aaf..de1d093b5324 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Language/FilterLanguageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Language/FilterLanguageTest.php @@ -16,6 +16,13 @@ use Drupal\Core\Language\Language; */ class FilterLanguageTest extends LanguageTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Filter: Language', @@ -28,8 +35,9 @@ class FilterLanguageTest extends LanguageTestBase { * Tests the language filter. */ public function testFilter() { + $view = views_get_view('test_view'); foreach (array('en' => 'John', 'xx-lolspeak' => 'George') as $langcode => $name) { - $view = $this->getView(); + $view->setDisplay(); $view->displayHandlers['default']->overrideOption('filters', array( 'langcode' => array( 'id' => 'langcode', diff --git a/core/modules/views/lib/Drupal/views/Tests/Language/LanguageTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Language/LanguageTestBase.php index 94d5a29d7945..c5f7c7b5e412 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Language/LanguageTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/Language/LanguageTestBase.php @@ -7,25 +7,18 @@ namespace Drupal\views\Tests\Language; -use Drupal\views\Tests\ViewTestBase; +use Drupal\views\Tests\ViewUnitTestBase; use Drupal\Core\Language\Language; /** * Defines the base class for all Language handler tests. */ -abstract class LanguageTestBase extends ViewTestBase { - - /** - * Modules to enable. - * - * @var array - */ - public static $modules = array('language'); +abstract class LanguageTestBase extends ViewUnitTestBase { protected function setUp() { parent::setUp(); - $this->enableViewsTestModule(); + $this->enableModules(array('system', 'language')); // Create another language beside English. $language = new Language(array('langcode' => 'xx-lolspeak', 'name' => 'Lolspeak')); diff --git a/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php index bbc998dd6e96..9034e7507c32 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests; */ class ModuleTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view_status'); + public static function getInfo() { return array( 'name' => 'Views Module tests', diff --git a/core/modules/views/lib/Drupal/views/Tests/Node/FieldTypeTest.php b/core/modules/views/lib/Drupal/views/Tests/Node/FieldTypeTest.php index 3c52c22a959f..9aad9affdfcd 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Node/FieldTypeTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Node/FieldTypeTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\Node; */ class FieldTypeTest extends NodeTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_field_type'); + public static function getInfo() { return array( 'name' => 'Node: Node Type field', @@ -31,17 +38,9 @@ class FieldTypeTest extends NodeTestBase { 'node_type' => 'node_type', ); - $view = $this->getView(); - $view->preview(); + $view = views_get_view('test_field_type'); $this->executeView($view); $this->assertIdenticalResultset($view, $expected_result, $column_map, 'The correct node type was displayed.'); } - /** - * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). - */ - protected function getBasicView() { - return $this->createViewFromConfig('test_field_type'); - } - } diff --git a/core/modules/views/lib/Drupal/views/Tests/Node/FilterUidRevisionTest.php b/core/modules/views/lib/Drupal/views/Tests/Node/FilterUidRevisionTest.php index 2b2718113032..01192fa20fb0 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Node/FilterUidRevisionTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Node/FilterUidRevisionTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\Node; */ class FilterUidRevisionTest extends NodeTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_filter_node_uid_revision'); + public static function getInfo() { return array( 'name' => 'Node: User has revision Filter', diff --git a/core/modules/views/lib/Drupal/views/Tests/Node/RevisionRelationships.php b/core/modules/views/lib/Drupal/views/Tests/Node/RevisionRelationships.php index c501bd50d8c4..a8780c819293 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Node/RevisionRelationships.php +++ b/core/modules/views/lib/Drupal/views/Tests/Node/RevisionRelationships.php @@ -13,6 +13,13 @@ use Drupal\views\Tests\ViewTestBase; */ class RevisionRelationships extends ViewTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_node_revision_nid', 'test_node_revision_vid'); + public static function getInfo() { return array( 'name' => 'Node: Revision integration', @@ -37,7 +44,7 @@ class RevisionRelationships extends ViewTestBase { ); // Here should be two rows. - $view_nid = $this->createViewFromConfig('test_node_revision_nid'); + $view_nid = views_get_view('test_node_revision_nid'); $this->executeView($view_nid, array($node->nid)); $resultset_nid = array( array( @@ -54,7 +61,7 @@ class RevisionRelationships extends ViewTestBase { $this->assertIdenticalResultset($view_nid, $resultset_nid, $column_map); // There should be only one row with active revision 2. - $view_vid = $this->createViewFromConfig('test_node_revision_vid'); + $view_vid = views_get_view('test_node_revision_vid'); $this->executeView($view_vid, array($node->nid)); $resultset_vid = array( array( diff --git a/core/modules/views/lib/Drupal/views/Tests/Node/StatusExtraTest.php b/core/modules/views/lib/Drupal/views/Tests/Node/StatusExtraTest.php index 4cade1e6f0e0..fb132a768d9b 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Node/StatusExtraTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Node/StatusExtraTest.php @@ -14,6 +14,13 @@ namespace Drupal\views\Tests\Node; */ class StatusExtraTest extends NodeTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_status_extra'); + public static function getInfo() { return array( 'name' => 'Node: Status extra filter', diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php index 066e648c48e7..b4c5118888ee 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php @@ -15,6 +15,13 @@ namespace Drupal\views\Tests\Plugin; */ class AccessTest extends PluginTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_access_none', 'test_access_static', 'test_access_dynamic'); + public static function getInfo() { return array( 'name' => 'Access', @@ -43,7 +50,8 @@ class AccessTest extends PluginTestBase { * Tests none access plugin. */ function testAccessNone() { - $view = $this->createViewFromConfig('test_access_none'); + $view = views_get_view('test_access_none'); + $view->setDisplay(); $this->assertTrue($view->display_handler->access($this->admin_user), t('Admin-Account should be able to access the view everytime')); $this->assertTrue($view->display_handler->access($this->web_user)); @@ -60,7 +68,8 @@ class AccessTest extends PluginTestBase { * @see Drupal\views_test\Plugin\views\access\StaticTest */ function testStaticAccessPlugin() { - $view = $this->createViewFromConfig('test_access_static'); + $view = views_get_view('test_access_static'); + $view->setDisplay(); $access_plugin = $view->display_handler->getPlugin('access'); @@ -88,7 +97,8 @@ class AccessTest extends PluginTestBase { * @see Drupal\views_test\Plugin\views\access\DyamicTest */ function testDynamicAccessPlugin() { - $view = $this->createViewFromConfig('test_access_dynamic'); + $view = views_get_view('test_access_dynamic'); + $view->setDisplay(); $argument1 = $this->randomName(); $argument2 = $this->randomName(); state()->set('test_dynamic_access_argument1', $argument1); diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentDefaultTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentDefaultTest.php index 6c9e12088721..312e5dfc6af7 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentDefaultTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentDefaultTest.php @@ -15,6 +15,13 @@ use Drupal\views_test_data\Plugin\views\argument_default\ArgumentDefaultTest as */ class ArgumentDefaultTest extends PluginTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view', 'test_argument_default_fixed', 'test_argument_default_current_user'); + /** * Modules to enable. * @@ -22,13 +29,6 @@ class ArgumentDefaultTest extends PluginTestBase { */ public static $modules = array('views_ui'); - /** - * A random string used in the default views. - * - * @var string - */ - protected $random; - public static function getInfo() { return array( 'name' => 'Argument default', @@ -38,8 +38,6 @@ class ArgumentDefaultTest extends PluginTestBase { } protected function setUp() { - $this->random = $this->randomString(); - parent::setUp(); $this->enableViewsTestModule(); @@ -112,16 +110,18 @@ class ArgumentDefaultTest extends PluginTestBase { * Tests fixed default argument. */ function testArgumentDefaultFixed() { - $view = $this->getView(); - $view->preExecute(); + $random = $this->randomName(); + $view = views_get_view('test_argument_default_fixed'); + $view->setDisplay(); + $options = $view->display_handler->getOption('arguments'); + $options['null']['default_argument_options']['argument'] = $random; + $view->display_handler->overrideOption('arguments', $options); $view->initHandlers(); - $this->assertEqual($view->argument['null']->get_default_argument(), $this->random, 'Fixed argument should be used by default.'); + $this->assertEqual($view->argument['null']->get_default_argument(), $random, 'Fixed argument should be used by default.'); // Make sure that a normal argument provided is used - $view = $this->getView(); - - $random_string = $this->randomString(); + $random_string = $this->randomName(); $view->executeDisplay('default', array($random_string)); $this->assertEqual($view->args[0], $random_string, 'Provided argument should be used.'); @@ -137,13 +137,4 @@ class ArgumentDefaultTest extends PluginTestBase { */ //function testArgumentDefaultNode() {} - /** - * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). - */ - protected function getBasicView() { - $view = $this->createViewFromConfig('test_argument_default_fixed'); - $view->displayHandlers['default']->display['display_options']['arguments']['null']['default_argument_options']['argument'] = $this->random; - return $view; - } - } diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentValidatorTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentValidatorTest.php index b08277fed6b4..9402109ca752 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentValidatorTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentValidatorTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\ViewUnitTestBase; */ class ArgumentValidatorTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view_argument_validate_php', 'test_view_argument_validate_numeric'); + public static function getInfo() { return array( 'name' => 'Argument validator', diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTest.php index 58bf75151f29..204dfbb2895f 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/CacheTest.php @@ -16,6 +16,13 @@ use Drupal\views\ViewExecutable; */ class CacheTest extends PluginTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view', 'test_cache'); + public static function getInfo() { return array( 'name' => 'Cache', @@ -30,54 +37,6 @@ class CacheTest extends PluginTestBase { $this->enableViewsTestModule(); } - /** - * Build and return a basic view of the views_test_data table. - * - * @return Drupal\views\ViewExecutable - */ - protected function getBasicView() { - // Create the basic view. - $view = $this->createViewFromConfig('test_view'); - $view->storage->addDisplay('default'); - $view->storage->set('base_table', 'views_test_data'); - - // Set up the fields we need. - $display = $view->storage->newDisplay('default', 'Master', 'default'); - $display->overrideOption('fields', array( - 'id' => array( - 'id' => 'id', - 'table' => 'views_test_data', - 'field' => 'id', - 'relationship' => 'none', - ), - 'name' => array( - 'id' => 'name', - 'table' => 'views_test_data', - 'field' => 'name', - 'relationship' => 'none', - ), - 'age' => array( - 'id' => 'age', - 'table' => 'views_test_data', - 'field' => 'age', - 'relationship' => 'none', - ), - )); - - // Set up the sort order. - $display->overrideOption('sorts', array( - 'id' => array( - 'order' => 'ASC', - 'id' => 'id', - 'table' => 'views_test_data', - 'field' => 'id', - 'relationship' => 'none', - ), - )); - - return $view; - } - /** * Tests time based caching. * @@ -85,7 +44,8 @@ class CacheTest extends PluginTestBase { */ function testTimeCaching() { // Create a basic result which just 2 results. - $view = $this->getView(); + $view = views_get_view('test_cache'); + $view->setDisplay(); $view->display_handler->overrideOption('cache', array( 'type' => 'time', 'options' => array( @@ -107,7 +67,8 @@ class CacheTest extends PluginTestBase { drupal_write_record('views_test_data', $record); // The Result should be the same as before, because of the caching. - $view = $this->getView(); + $view = views_get_view('test_cache'); + $view->setDisplay(); $view->display_handler->overrideOption('cache', array( 'type' => 'time', 'options' => array( @@ -128,7 +89,8 @@ class CacheTest extends PluginTestBase { */ function testNoneCaching() { // Create a basic result which just 2 results. - $view = $this->getView(); + $view = views_get_view('test_cache'); + $view->setDisplay(); $view->display_handler->overrideOption('cache', array( 'type' => 'none', 'options' => array() @@ -148,7 +110,8 @@ class CacheTest extends PluginTestBase { drupal_write_record('views_test_data', $record); // The Result changes, because the view is not cached. - $view = $this->getView(); + $view = views_get_view('test_cache'); + $view->setDisplay(); $view->display_handler->overrideOption('cache', array( 'type' => 'none', 'options' => array() @@ -166,7 +129,8 @@ class CacheTest extends PluginTestBase { // Create a view with output caching enabled. // Some hook_views_pre_render in views_test_data.module adds the test css/js file. // so they should be added to the css/js storage. - $view = $this->getView(); + $view = views_get_view('test_view'); + $view->setDisplay(); $view->storage->set('name', 'test_cache_header_storage'); $view->display_handler->overrideOption('cache', array( 'type' => 'time', @@ -179,8 +143,9 @@ class CacheTest extends PluginTestBase { unset($view->pre_render_called); drupal_static_reset('drupal_add_css'); drupal_static_reset('drupal_add_js'); + $view->destroy(); - $view = $this->getView($view); + $view->setDisplay(); $view->preview(); $css = drupal_add_css(); $css_path = drupal_get_path('module', 'views_test_data') . '/views_cache.test.css'; @@ -199,13 +164,15 @@ class CacheTest extends PluginTestBase { drupal_add_css($system_css_path); $system_js_path = drupal_get_path('module', 'system') . '/system.cron.js'; drupal_add_js($system_js_path); + $view->destroy(); - $view = $this->getView($view); + $view->setDisplay(); $view->preview(); drupal_static_reset('drupal_add_css'); drupal_static_reset('drupal_add_js'); + $view->destroy(); - $view = $this->getView($view); + $view->setDisplay(); $view->preview(); $css = drupal_add_css(); diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayExtenderTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayExtenderTest.php index 90eee0610aa0..3ab1a9bd0498 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayExtenderTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayExtenderTest.php @@ -16,6 +16,13 @@ use Drupal\views\Tests\Plugin\PluginTestBase; */ class DisplayExtenderTest extends PluginTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Display extender', @@ -30,7 +37,6 @@ class DisplayExtenderTest extends PluginTestBase { $this->enableViewsTestModule(); } - /** * Test display extenders. */ @@ -38,7 +44,7 @@ class DisplayExtenderTest extends PluginTestBase { config('views.settings')->set('display_extenders', array('display_extender_test'))->save(); $this->assertEqual(count(views_get_enabled_display_extenders()), 1, 'Make sure that there is only one enabled display extender.'); - $view = $this->getBasicView(); + $view = views_get_view('test_view'); $view->initDisplay(); $this->assertEqual(count($view->display_handler->extender), 1, 'Make sure that only one extender is initialized.'); @@ -51,4 +57,5 @@ class DisplayExtenderTest extends PluginTestBase { $view->execute(); $this->assertTrue($display_extender->testState['query'], 'Make sure the display extender was able to react on query.'); } + } diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php index cdab4f793e70..59267bf04de6 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php @@ -14,6 +14,13 @@ namespace Drupal\views\Tests\Plugin; */ class DisplayFeedTest extends PluginTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_feed_display'); + /** * Modules to enable. * diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayPageTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayPageTest.php index 417126cf2adf..49ed01cdeb9a 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayPageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayPageTest.php @@ -16,6 +16,13 @@ use Drupal\views\Tests\Plugin\PluginTestBase; */ class DisplayPageTest extends PluginTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_page_display'); + public static function getInfo() { return array( 'name' => 'Display: Page plugin', diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php index b071b9ed7857..eb85ca01c837 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php @@ -14,6 +14,13 @@ use Drupal\views_test_data\Plugin\views\display\DisplayTest as DisplayTestPlugin */ class DisplayTest extends PluginTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_filter_groups'); + /** * Modules to enable. * @@ -111,7 +118,7 @@ class DisplayTest extends PluginTestBase { * Tests the overriding of filter_groups. */ public function testFilterGroupsOverriding() { - $view = $this->createViewFromConfig('test_filter_groups'); + $view = views_get_view('test_filter_groups'); $view->initDisplay(); // mark is as overridden, yes FALSE, means overridden. diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php index d10309e7533c..1276bd931798 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php @@ -14,6 +14,13 @@ use Drupal\views\Tests\UI\UITestBase; */ class ExposedFormTest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_reset_button', 'test_exposed_admin_ui'); + /** * Modules to enable. * diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/FilterTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/FilterTest.php index 82bb4a6b3d8d..7eb5d3e5f5e8 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/FilterTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/FilterTest.php @@ -16,6 +16,13 @@ use Drupal\views_test_data\Plugin\views\filter\FilterTest as FilterPlugin; */ class FilterTest extends PluginTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_filter'); + /** * Modules to enable. * diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php index 6aa64c51c5d1..66c12969ffca 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\Plugin; */ class PagerTest extends PluginTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_store_pager_settings', 'test_pager_none', 'test_pager_some', 'test_pager_full', 'test_view_pager_full_zero_items_per_page'); + /** * Modules to enable. * @@ -56,7 +63,7 @@ class PagerTest extends PluginTestBase { $this->assertText('Mini', 'Changed pager plugin, should change some text'); // Test behaviour described in http://drupal.org/node/652712#comment-2354400 - $view = $this->createViewFromConfig('test_store_pager_settings'); + $view = views_get_view('test_store_pager_settings'); // Make it editable in the admin interface. $view->save(); @@ -109,13 +116,13 @@ class PagerTest extends PluginTestBase { for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); } - $view = $this->getView(); + $view = views_get_view('test_pager_none'); $this->executeView($view); $this->assertEqual(count($view->result), 11, 'Make sure that every item is returned in the result'); // Setup and test a offset. - $view = $this->getView(); - + $view = views_get_view('test_pager_none'); + $view->setDisplay(); $pager = array( 'type' => 'none', 'options' => array( @@ -133,48 +140,35 @@ class PagerTest extends PluginTestBase { $this->assertEqual($view->pager->get_items_per_page(), 0); } - /** - * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). - */ - protected function getBasicView() { - return $this->createViewFromConfig('test_pager_none'); - } - public function testViewTotalRowsWithoutPager() { - $this->createNodes(23); - - $this->view->get_total_rows = TRUE; - $this->executeView($this->view); - - $this->assertEqual($this->view->total_rows, 23, "'total_rows' is calculated when pager type is 'none' and 'get_total_rows' is TRUE."); - } - - public function createNodes($count) { - if ($count >= 0) { - for ($i = 0; $i < $count; $i++) { - $this->drupalCreateNode(); - } + for ($i = 0; $i < 23; $i++) { + $this->drupalCreateNode(); } + + $view = views_get_view('test_pager_none'); + $view->get_total_rows = TRUE; + $this->executeView($view); + + $this->assertEqual($view->total_rows, 23, "'total_rows' is calculated when pager type is 'none' and 'get_total_rows' is TRUE."); } /** * Tests the some pager plugin. */ public function testLimit() { - $saved_view = $this->createViewFromConfig('test_pager_some'); - // Create 11 nodes and make sure that everyone is returned. // We create 11 nodes, because the default pager plugin had 10 items per page. for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); } - $view = $saved_view->cloneView(); + + $view = views_get_view('test_pager_some'); $this->executeView($view); $this->assertEqual(count($view->result), 5, 'Make sure that only a certain count of items is returned'); // Setup and test a offset. - $view = $this->getView($saved_view); - + $view = views_get_view('test_pager_some'); + $view->setDisplay(); $pager = array( 'type' => 'none', 'options' => array( @@ -195,20 +189,19 @@ class PagerTest extends PluginTestBase { * Tests the normal pager. */ public function testNormalPager() { - $saved_view = $this->createViewFromConfig('test_pager_full'); - // Create 11 nodes and make sure that everyone is returned. // We create 11 nodes, because the default pager plugin had 10 items per page. for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); } - $view = $saved_view->cloneView(); + + $view = views_get_view('test_pager_full'); $this->executeView($view); $this->assertEqual(count($view->result), 5, 'Make sure that only a certain count of items is returned'); // Setup and test a offset. - $view = $this->getView($saved_view); - + $view = views_get_view('test_pager_full'); + $view->setDisplay(); $pager = array( 'type' => 'full', 'options' => array( @@ -221,7 +214,7 @@ class PagerTest extends PluginTestBase { $this->assertEqual(count($view->result), 3, 'Make sure that only a certain count of items is returned'); // Test items per page = 0 - $view = $this->createViewFromConfig('test_view_pager_full_zero_items_per_page'); + $view = views_get_view('test_view_pager_full_zero_items_per_page'); $this->executeView($view); $this->assertEqual(count($view->result), 11, 'All items are return'); @@ -230,8 +223,8 @@ class PagerTest extends PluginTestBase { // Test items per page = 0. // Setup and test a offset. - $view = $this->getView($saved_view); - + $view = views_get_view('test_pager_full'); + $view->setDisplay(); $pager = array( 'type' => 'full', 'options' => array( @@ -255,7 +248,7 @@ class PagerTest extends PluginTestBase { for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); } - $view = $this->createViewFromConfig('test_pager_full'); + $view = views_get_view('test_pager_full'); $this->executeView($view); $view->use_ajax = TRUE; // force the value again here $view->pager = NULL; @@ -267,7 +260,8 @@ class PagerTest extends PluginTestBase { * Test the api functions on the view object. */ function testPagerApi() { - $view = $this->createViewFromConfig('test_pager_full'); + $view = views_get_view('test_pager_full'); + $view->setDisplay(); // On the first round don't initialize the pager. $this->assertEqual($view->getItemsPerPage(), NULL, 'If the pager is not initialized and no manual override there is no items per page.'); diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/QueryTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/QueryTest.php index 6ba11246689a..2d495ff5aa58 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/QueryTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/QueryTest.php @@ -7,13 +7,20 @@ namespace Drupal\views\Tests\Plugin; -use Drupal\views\Tests\ViewTestBase; +use Drupal\views\Tests\ViewUnitTestBase; use Drupal\views_test_data\Plugin\views\query\QueryTest as QueryTestPlugin; /** * Tests query plugins. */ -class QueryTest extends ViewTestBase { +class QueryTest extends ViewUnitTestBase { + + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); public static function getInfo() { return array( @@ -23,12 +30,6 @@ class QueryTest extends ViewTestBase { ); } - protected function setUp() { - parent::setUp(); - - $this->enableViewsTestModule(); - } - protected function viewsData() { $data = parent::viewsData(); $data['views_test_data']['table']['base']['query_id'] = 'query_test'; @@ -48,13 +49,17 @@ class QueryTest extends ViewTestBase { * Tests the ViewExecutable::initQuery method. */ public function _testInitQuery() { - $view = $this->getBasicView(); + $view = views_get_view('test_view'); + $view->setDisplay(); + $view->initQuery(); $this->assertTrue($view->query instanceof QueryTestPlugin, 'Make sure the right query plugin got instantiated.'); } public function _testQueryExecute() { - $view = $this->getBasicView(); + $view = views_get_view('test_view'); + $view->setDisplay(); + $view->initQuery(); $view->query->setAllItems($this->dataSet()); diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleMappingTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleMappingTest.php index 832dbb2acefd..c0db658f8945 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleMappingTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleMappingTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\Plugin; */ class StyleMappingTest extends StyleTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_style_mapping'); + public static function getInfo() { return array( 'name' => 'Style: Mapping', @@ -33,8 +40,8 @@ class StyleMappingTest extends StyleTestBase { $view = views_get_view('test_style_mapping'); $output = $this->mappedOutputHelper($view); $this->assertTrue(strpos($output, 'job') === FALSE, 'The job field is added to the view but not in the mapping.'); + $view->destroy(); - $view = views_get_view('test_style_mapping'); $view->setDisplay(); $view->displayHandlers['default']->options['style']['options']['mapping']['name_field'] = 'job'; $output = $this->mappedOutputHelper($view); diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php index d5c83d9d6744..2cc6c3ea0a96 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php @@ -18,6 +18,13 @@ use Drupal\views_test_data\Plugin\views\style\StyleTest as StyleTestPlugin; */ class StyleTest extends ViewTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + /** * Stores the SimpleXML representation of the output. * diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleUnformattedTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleUnformattedTest.php index 6a1645c0837f..5348fbc76ab5 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleUnformattedTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleUnformattedTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\Plugin; */ class StyleUnformattedTest extends StyleTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Style: Unformatted', diff --git a/core/modules/views/lib/Drupal/views/Tests/QueryGroupByTest.php b/core/modules/views/lib/Drupal/views/Tests/QueryGroupByTest.php index cb5416be3092..509aca565393 100644 --- a/core/modules/views/lib/Drupal/views/Tests/QueryGroupByTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/QueryGroupByTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests; */ class QueryGroupByTest extends ViewTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_group_by_in_filters', 'test_aggregate_count', 'test_group_by_count'); + public static function getInfo() { return array( 'name' => 'Groupby', @@ -43,7 +50,7 @@ class QueryGroupByTest extends ViewTestBase { $this->drupalCreateNode($node_2); $this->drupalCreateNode($node_2); - $view = $this->createViewFromConfig('test_aggregate_count'); + $view = views_get_view('test_aggregate_count'); $this->executeView($view); $this->assertEqual(count($view->result), 2, 'Make sure the count of items is right.'); @@ -86,7 +93,8 @@ class QueryGroupByTest extends ViewTestBase { $this->drupalCreateNode($node_2); $this->drupalCreateNode($node_2); - $view = $this->createViewFromConfig('test_group_by_count'); + $view = views_get_view('test_group_by_count'); + $view->setDisplay(); $view->displayHandlers['default']->options['fields']['nid']['group_type'] = $group_by; $this->executeView($view); @@ -107,7 +115,6 @@ class QueryGroupByTest extends ViewTestBase { $this->GroupByTestHelper('sum', array(10, 18)); } - function testGroupByAverage() { $this->GroupByTestHelper('avg', array(2.5, 6)); } @@ -133,17 +140,11 @@ class QueryGroupByTest extends ViewTestBase { $this->drupalCreateNode($node_1); } - $this->executeView($this->view); + $view = views_get_view('test_group_by_in_filters'); + $this->executeView($view); - $this->assertTrue(strpos($this->view->build_info['query'], 'GROUP BY'), t('Make sure that GROUP BY is in the query')); - $this->assertTrue(strpos($this->view->build_info['query'], 'HAVING'), t('Make sure that HAVING is in the query')); - } - - /** - * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). - */ - protected function getBasicView() { - return $this->createViewFromConfig('test_group_by_in_filters'); + $this->assertTrue(strpos($view->build_info['query'], 'GROUP BY'), 'Make sure that GROUP BY is in the query'); + $this->assertTrue(strpos($view->build_info['query'], 'HAVING'), 'Make sure that HAVING is in the query'); } } diff --git a/core/modules/views/lib/Drupal/views/Tests/Taxonomy/RelationshipNodeTermDataTest.php b/core/modules/views/lib/Drupal/views/Tests/Taxonomy/RelationshipNodeTermDataTest.php index f9c4bad385f4..02809dfffd68 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Taxonomy/RelationshipNodeTermDataTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Taxonomy/RelationshipNodeTermDataTest.php @@ -7,19 +7,17 @@ namespace Drupal\views\Tests\Taxonomy; -use Drupal\views\Tests\ViewTestBase; - /** * Tests the node_term_data relationship handler. */ class RelationshipNodeTermDataTest extends TaxonomyTestBase { /** - * The vocabulary for the test. + * Views used by this test. * - * @var Drupal\taxonomy\Vocabulary + * @var array */ - protected $vocabulary; + public static $testViews = array('test_taxonomy_node_term_data'); public static function getInfo() { return array( @@ -30,7 +28,8 @@ class RelationshipNodeTermDataTest extends TaxonomyTestBase { } function testViewsHandlerRelationshipNodeTermData() { - $this->executeView($this->view, array($this->term1->tid, $this->term2->tid)); + $view = views_get_view('test_taxonomy_node_term_data'); + $this->executeView($view, array($this->term1->tid, $this->term2->tid)); $resultset = array( array( 'nid' => $this->nodes[0]->nid, @@ -40,14 +39,7 @@ class RelationshipNodeTermDataTest extends TaxonomyTestBase { ), ); $this->column_map = array('nid' => 'nid'); - $this->assertIdenticalResultset($this->view, $resultset, $this->column_map); - } - - /** - * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). - */ - protected function getBasicView() { - return $this->createViewFromConfig('test_taxonomy_node_term_data'); + $this->assertIdenticalResultset($view, $resultset, $this->column_map); } } diff --git a/core/modules/views/lib/Drupal/views/Tests/Taxonomy/RelationshipRepresentativeNode.php b/core/modules/views/lib/Drupal/views/Tests/Taxonomy/RelationshipRepresentativeNode.php index 70a9c99f454e..6954b750de60 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Taxonomy/RelationshipRepresentativeNode.php +++ b/core/modules/views/lib/Drupal/views/Tests/Taxonomy/RelationshipRepresentativeNode.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\Taxonomy; */ class RelationshipRepresentativeNode extends TaxonomyTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_groupwise_term'); + public static function getInfo() { return array( 'name' => 'Taxonomy: Representative Node Relationship', diff --git a/core/modules/views/lib/Drupal/views/Tests/TokenReplaceTest.php b/core/modules/views/lib/Drupal/views/Tests/TokenReplaceTest.php index bcc1a1c56c8c..c3c24b1267fd 100644 --- a/core/modules/views/lib/Drupal/views/Tests/TokenReplaceTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/TokenReplaceTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests; */ class TokenReplaceTest extends ViewUnitTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_tokens'); + public static function getInfo() { return array( 'name' => 'View core token replacement', diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/DefaultViewsTest.php index 590bc6ef937a..a96172bfccf7 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/DefaultViewsTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\UI; */ class DefaultViewsTest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view_status'); + public static function getInfo() { return array( 'name' => 'Default views functionality', diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayExtenderUITest.php b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayExtenderUITest.php index 8c610504df99..c56e59c61056 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayExtenderUITest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayExtenderUITest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\UI; */ class DisplayExtenderUITest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Display extender: UI', @@ -26,7 +33,7 @@ class DisplayExtenderUITest extends UITestBase { public function testDisplayExtenderUI() { config('views.settings')->set('display_extenders', array('display_extender_test'))->save(); - $view = $this->getView(); + $view = views_get_view('test_view'); $view_edit_url = "admin/structure/views/view/{$view->storage->get('name')}/edit"; $display_option_url = 'admin/structure/views/nojs/display/test_view/default/test_extender_test_option'; diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayPath.php b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayPath.php index 7e2f548dfcdc..3664f280b8e7 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayPath.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayPath.php @@ -14,6 +14,13 @@ namespace Drupal\views\Tests\UI; */ class DisplayPath extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Display Path: UI', diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayTest.php index a3dc979c5eca..c2416a30fb77 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\UI; */ class DisplayTest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_display'); + public static function getInfo() { return array( 'name' => 'Display tests', diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/GroupByTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/GroupByTest.php index f0abbf7c8bd5..070ad0785ca5 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/GroupByTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/GroupByTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\UI; */ class GroupByTest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_views_groupby_save'); + public static function getInfo() { return array( 'name' => 'Group By functionality', diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php index 808776ca9c30..7793608f2205 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php @@ -16,6 +16,13 @@ use Drupal\views\ViewExecutable; */ class HandlerTest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Handler test', diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/PreviewTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/PreviewTest.php index 7a673284bce5..407667f2d9ed 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/PreviewTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/PreviewTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\UI; */ class PreviewTest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_preview'); + public static function getInfo() { return array( 'name' => 'Preview functionality', diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/QueryTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/QueryTest.php index 83f0bfa23180..f4e1b3636e88 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/QueryTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/QueryTest.php @@ -15,6 +15,13 @@ use Drupal\views_test_data\Plugin\views\query\QueryTest as QueryTestPlugin; */ class QueryTest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Query: UI', diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/RedirectTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/RedirectTest.php index 75e38c3d8a07..d4dd0838b494 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/RedirectTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/RedirectTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\UI; */ class RedirectTest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view', 'test_redirect_view'); + public static function getInfo() { return array( 'name' => 'Redirect', @@ -24,10 +31,11 @@ class RedirectTest extends UITestBase { * Tests the redirecting. */ public function testRedirect() { - $view = $this->getBasicView(); + $view_name = 'test_view'; + $view = views_get_view($view_name); $random_destination = $this->randomName(); - $edit_path = "admin/structure/views/view/{$view->storage->get('name')}/edit"; + $edit_path = "admin/structure/views/view/$view_name/edit"; $this->drupalPost($edit_path, array(), t('Save') , array('query' => array('destination' => $random_destination))); $this->assertUrl($random_destination, array(), 'Make sure the user got redirected to the expected page defined in the destination.'); @@ -35,12 +43,13 @@ class RedirectTest extends UITestBase { // Setup a view with a certain page display path. If you change the path // but have the old url in the destination the user should be redirected to // the new path. - $view = views_get_view('test_redirect_view'); + $view_name = 'test_redirect_view'; + $view = views_get_view($view_name); $random_destination = $this->randomName(); $new_path = $this->randomName(); - $edit_path = "admin/structure/views/view/{$view->storage->get('name')}/edit"; - $path_edit_path = "admin/structure/views/nojs/display/{$view->storage->get('name')}/page_1/path"; + $edit_path = "admin/structure/views/view/$view_name/edit"; + $path_edit_path = "admin/structure/views/nojs/display/$view_name/page_1/path"; $this->drupalPost($path_edit_path, array('path' => $new_path), t('Apply')); $this->drupalPost($edit_path, array(), t('Save'), array('query' => array('destination' => 'test-redirect-view'))); diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/RowUITest.php b/core/modules/views/lib/Drupal/views/Tests/UI/RowUITest.php index 579dab2dbcaa..2b42157d4fd6 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/RowUITest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/RowUITest.php @@ -14,6 +14,13 @@ namespace Drupal\views\Tests\UI; */ class RowUITest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Row: UI', @@ -26,11 +33,12 @@ class RowUITest extends UITestBase { * Tests changing the row plugin and changing some options of a row. */ public function testRowUI() { - $view = $this->getView(); - $view_edit_url = "admin/structure/views/view/{$view->storage->get('name')}/edit"; + $view_name = 'test_view'; + $view = views_get_view($view_name); + $view_edit_url = "admin/structure/views/view/$view_name/edit"; - $row_plugin_url = "admin/structure/views/nojs/display/{$view->storage->get('name')}/default/row"; - $row_options_url = "admin/structure/views/nojs/display/{$view->storage->get('name')}/default/row_options"; + $row_plugin_url = "admin/structure/views/nojs/display/$view_name/default/row"; + $row_options_url = "admin/structure/views/nojs/display/$view_name/default/row_options"; $this->drupalGet($row_plugin_url); $this->assertFieldByName('row', 'fields', 'The default row plugin selected in the UI should be fields.'); @@ -51,7 +59,7 @@ class RowUITest extends UITestBase { $this->drupalPost($view_edit_url, array(), t('Save')); $this->assertLink(t('Test row plugin'), 0, 'Make sure the test row plugin is shown in the UI'); - $view = views_get_view($view->storage->get('name')); + $view = views_get_view($view_name); $view->initDisplay(); $row = $view->display_handler->getOption('row'); $this->assertEqual($row['type'], 'test_row', 'Make sure that the test_row got saved as used row plugin.'); diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/StorageTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/StorageTest.php index 31157640b587..1fbec1fec075 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/StorageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/StorageTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\UI; */ class StorageTest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Storage properties', @@ -26,9 +33,10 @@ class StorageTest extends UITestBase { * @see views_ui_edit_details_form */ public function testDetails() { - $view = $this->getBasicView(); + $view_name = 'test_view'; + $view = views_get_view($view_name); - $path = "admin/structure/views/nojs/edit-details/{$view->storage->get('name')}"; + $path = "admin/structure/views/nojs/edit-details/$view_name"; $edit = array( 'human_name' => $this->randomName(), 'tag' => $this->randomName(), @@ -37,8 +45,8 @@ class StorageTest extends UITestBase { $this->drupalPost($path, $edit, t('Apply')); $this->drupalPost(NULL, array(), t('Save')); - $view = views_get_view($view->storage->get('name')); + $view = views_get_view($view_name); foreach (array('human_name', 'tag', 'description') as $property) { $this->assertEqual($view->storage->get($property), $edit[$property], format_string('Make sure the property @property got probably saved.', array('@property' => $property))); } diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/StyleUITest.php b/core/modules/views/lib/Drupal/views/Tests/UI/StyleUITest.php index 252f67a5aa2c..034f4633846a 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/StyleUITest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/StyleUITest.php @@ -14,6 +14,13 @@ namespace Drupal\views\Tests\UI; */ class StyleUITest extends UITestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + public static function getInfo() { return array( 'name' => 'Style: UI', @@ -26,11 +33,12 @@ class StyleUITest extends UITestBase { * Tests changing the style plugin and changing some options of a style. */ public function testStyleUI() { - $view = $this->getView(); - $view_edit_url = "admin/structure/views/view/{$view->storage->get('name')}/edit"; + $view_name = 'test_view'; + $view = views_get_view($view_name); + $view_edit_url = "admin/structure/views/view/$view_name/edit"; - $style_plugin_url = "admin/structure/views/nojs/display/{$view->storage->get('name')}/default/style"; - $style_options_url = "admin/structure/views/nojs/display/{$view->storage->get('name')}/default/style_options"; + $style_plugin_url = "admin/structure/views/nojs/display/$view_name/default/style"; + $style_options_url = "admin/structure/views/nojs/display/$view_name/default/style_options"; $this->drupalGet($style_plugin_url); $this->assertFieldByName('style', 'default', 'The default style plugin selected in the UI should be unformatted list.'); @@ -51,7 +59,7 @@ class StyleUITest extends UITestBase { $this->drupalPost($view_edit_url, array(), t('Save')); $this->assertLink(t('Test style plugin'), 0, 'Make sure the test style plugin is shown in the UI'); - $view = views_get_view($view->storage->get('name')); + $view = views_get_view($view_name); $view->initDisplay(); $style = $view->display_handler->getOption('style'); $this->assertEqual($style['type'], 'test_style', 'Make sure that the test_style got saved as used style plugin.'); diff --git a/core/modules/views/lib/Drupal/views/Tests/User/AccessPermissionTest.php b/core/modules/views/lib/Drupal/views/Tests/User/AccessPermissionTest.php index 302979bb5505..62a88c16a7ed 100644 --- a/core/modules/views/lib/Drupal/views/Tests/User/AccessPermissionTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/AccessPermissionTest.php @@ -16,6 +16,13 @@ use Drupal\user\Plugin\views\access\Permission; */ class AccessPermissionTest extends AccessTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_access_perm'); + public static function getInfo() { return array( 'name' => 'User: Access permission', @@ -24,12 +31,12 @@ class AccessPermissionTest extends AccessTestBase { ); } - /** * Tests perm access plugin. */ function testAccessPerm() { - $view = $this->createViewFromConfig('test_access_perm'); + $view = views_get_view('test_access_perm'); + $view->setDisplay(); $access_plugin = $view->display_handler->getPlugin('access'); $this->assertTrue($access_plugin instanceof Permission, 'Make sure the right class got instantiated.'); diff --git a/core/modules/views/lib/Drupal/views/Tests/User/AccessRoleTest.php b/core/modules/views/lib/Drupal/views/Tests/User/AccessRoleTest.php index 16bcf6dc995b..319918b28620 100644 --- a/core/modules/views/lib/Drupal/views/Tests/User/AccessRoleTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/AccessRoleTest.php @@ -16,6 +16,13 @@ use Drupal\user\Plugin\views\access\Role; */ class AccessRoleTest extends AccessTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_access_role'); + public static function getInfo() { return array( 'name' => 'User: Access role', @@ -28,7 +35,8 @@ class AccessRoleTest extends AccessTestBase { * Tests role access plugin. */ function testAccessRole() { - $view = $this->createViewFromConfig('test_access_role'); + $view = views_get_view('test_access_role'); + $view->setDisplay(); $view->displayHandlers['default']->options['access']['options']['role'] = array( $this->normalRole => $this->normalRole, @@ -37,7 +45,6 @@ class AccessRoleTest extends AccessTestBase { $access_plugin = $view->display_handler->getPlugin('access'); $this->assertTrue($access_plugin instanceof Role, 'Make sure the right class got instantiated.'); - $this->assertTrue($view->display_handler->access($this->adminUser), t('Admin-Account should be able to access the view everytime')); $this->assertFalse($view->display_handler->access($this->webUser)); $this->assertTrue($view->display_handler->access($this->normalUser)); diff --git a/core/modules/views/lib/Drupal/views/Tests/User/ArgumentDefaultTest.php b/core/modules/views/lib/Drupal/views/Tests/User/ArgumentDefaultTest.php index bdaf38257341..85d84e26318c 100644 --- a/core/modules/views/lib/Drupal/views/Tests/User/ArgumentDefaultTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/ArgumentDefaultTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\User; */ class ArgumentDefaultTest extends UserTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_plugin_argument_default_current_user'); + public static function getInfo() { return array( 'name' => 'User: Argument default', @@ -31,20 +38,13 @@ class ArgumentDefaultTest extends UserTestBase { drupal_save_session(FALSE); $user = $account; - $this->view->preExecute(); - $this->view->initHandlers(); + $view = views_get_view('test_plugin_argument_default_current_user'); + $view->initHandlers(); - $this->assertEqual($this->view->argument['null']->get_default_argument(), $account->uid, 'Uid of the current user is used.'); + $this->assertEqual($view->argument['null']->get_default_argument(), $account->uid, 'Uid of the current user is used.'); // Switch back. $user = $admin; drupal_save_session(TRUE); } - /** - * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). - */ - protected function getBasicView() { - return $this->createViewFromConfig('test_plugin_argument_default_current_user'); - } - } diff --git a/core/modules/views/lib/Drupal/views/Tests/User/ArgumentValidateTest.php b/core/modules/views/lib/Drupal/views/Tests/User/ArgumentValidateTest.php index 95e035d64f81..acaee793bb65 100644 --- a/core/modules/views/lib/Drupal/views/Tests/User/ArgumentValidateTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/ArgumentValidateTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\User; */ class ArgumentValidateTest extends UserTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view_argument_validate_user'); + public static function getInfo() { return array( 'name' => 'User: Argument validator', @@ -76,7 +83,8 @@ class ArgumentValidateTest extends UserTestBase { } function view_argument_validate_user($argtype) { - $view = $this->createViewFromConfig('test_view_argument_validate_user'); + $view = views_get_view('test_view_argument_validate_user'); + $view->setDisplay(); $view->displayHandlers['default']->options['arguments']['null']['validate_options']['type'] = $argtype; $view->preExecute(); $view->initHandlers(); diff --git a/core/modules/views/lib/Drupal/views/Tests/User/HandlerArgumentUserUidTest.php b/core/modules/views/lib/Drupal/views/Tests/User/HandlerArgumentUserUidTest.php index 8f5dce50ec47..c09e7f00979e 100644 --- a/core/modules/views/lib/Drupal/views/Tests/User/HandlerArgumentUserUidTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/HandlerArgumentUserUidTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\User; */ class HandlerArgumentUserUidTest extends UserTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_user_uid_argument'); + public static function getInfo() { return array( 'name' => 'User: Uid Argument', diff --git a/core/modules/views/lib/Drupal/views/Tests/User/HandlerFieldUserNameTest.php b/core/modules/views/lib/Drupal/views/Tests/User/HandlerFieldUserNameTest.php index 7a28fef0025a..a0add02ab118 100644 --- a/core/modules/views/lib/Drupal/views/Tests/User/HandlerFieldUserNameTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/HandlerFieldUserNameTest.php @@ -14,6 +14,13 @@ namespace Drupal\views\Tests\User; */ class HandlerFieldUserNameTest extends UserTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_views_handler_field_user_name'); + public static function getInfo() { return array( 'name' => 'User: Name Field', @@ -22,8 +29,8 @@ class HandlerFieldUserNameTest extends UserTestBase { ); } - function testUserName() { - $view = $this->getView(); + public function testUserName() { + $view = views_get_view('test_views_handler_field_user_name'); $this->executeView($view); $view->row_index = 0; @@ -53,11 +60,4 @@ class HandlerFieldUserNameTest extends UserTestBase { $this->assertIdentical($render, $anon_name , 'For user0 it should use the configured anonymous text if overwrite_anonymous is checked.'); } - /** - * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). - */ - protected function getBasicView() { - return $this->createViewFromConfig('test_views_handler_field_user_name'); - } - } diff --git a/core/modules/views/lib/Drupal/views/Tests/User/HandlerFilterUserNameTest.php b/core/modules/views/lib/Drupal/views/Tests/User/HandlerFilterUserNameTest.php index df23db25190a..9fec6064ce6d 100644 --- a/core/modules/views/lib/Drupal/views/Tests/User/HandlerFilterUserNameTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/HandlerFilterUserNameTest.php @@ -16,6 +16,13 @@ use Drupal\views\Tests\ViewTestBase; */ class HandlerFilterUserNameTest extends ViewTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_user_name'); + /** * Modules to enable. * diff --git a/core/modules/views/lib/Drupal/views/Tests/User/RelationshipRepresentativeNode.php b/core/modules/views/lib/Drupal/views/Tests/User/RelationshipRepresentativeNode.php index a46965c3107f..a130ce7a584f 100644 --- a/core/modules/views/lib/Drupal/views/Tests/User/RelationshipRepresentativeNode.php +++ b/core/modules/views/lib/Drupal/views/Tests/User/RelationshipRepresentativeNode.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests\User; */ class RelationshipRepresentativeNode extends UserTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_groupwise_user'); + public static function getInfo() { return array( 'name' => 'User: Representative Node Relationship', diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewElementTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewElementTest.php index 3ea578e84f45..b82a200d8c04 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewElementTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewElementTest.php @@ -12,6 +12,13 @@ namespace Drupal\views\Tests; */ class ViewElementTest extends ViewTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_view'); + /** * The raw render data array to use in tests. * @@ -48,7 +55,8 @@ class ViewElementTest extends ViewTestBase { * Tests the rendered output and form output of a view element. */ public function testViewElement() { - $view = $this->getBasicView(); + $view = views_get_view('test_view'); + $view->setDisplay(); // Set the content as our rendered array. $render = $this->render; diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php index 9fb3fbcbb0dc..d6b011edd29a 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php @@ -18,6 +18,13 @@ use Drupal\views\Plugin\views\display\Page; */ class ViewExecutableTest extends ViewTestBase { + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = array('test_destroy', 'test_executable_displays'); + /** * Modules to enable. * @@ -63,13 +70,12 @@ class ViewExecutableTest extends ViewTestBase { * Tests the initDisplay() and initHandlers() methods. */ public function testInitMethods() { - $view = $this->getBasicView(); + $view = views_get_view('test_destroy'); $view->initDisplay(); $this->assertTrue($view->display_handler instanceof DefaultDisplay, 'Make sure a reference to the current display handler is set.'); $this->assertTrue($view->displayHandlers['default'] instanceof DefaultDisplay, 'Make sure a display handler is created for each display.'); - $view = $this->getBasicView(); $view->destroy(); $view->initHandlers(); @@ -88,25 +94,18 @@ class ViewExecutableTest extends ViewTestBase { $this->assertTrue($view->displayHandlers['default'] instanceof DefaultDisplay, 'Make sure a display handler is created for each display.'); } - /** - * Overrides Drupal\views\Tests\ViewTestBase::getBasicView(). - */ - protected function getBasicView() { - return $this->createViewFromConfig('test_destroy'); - } - /** * Tests the generation of the executable object. */ public function testConstructing() { - $view = $this->getView(); + views_get_view('test_destroy'); } /** * Tests the accessing of values on the object. */ public function testProperties() { - $view = $this->getView(); + $view = views_get_view('test_destroy'); foreach ($this->executableProperties as $property) { $this->assertTrue(isset($view->{$property})); } @@ -148,27 +147,18 @@ class ViewExecutableTest extends ViewTestBase { $view->setDisplay('page_2'); $this->assertEqual($view->current_display, 'page_2', 'If setDisplay is called with a valid display id the appropriate display should be used.'); $this->assertEqual(spl_object_hash($view->display_handler), spl_object_hash($view->displayHandlers['page_2'])); - - } /** * Tests the deconstructor to be sure that every kind of heavy objects are removed. */ function testDestroy() { - $view = $this->getView(); + $view = views_get_view('test_destroy'); $view->preview(); $view->destroy(); $this->assertViewDestroy($view); - - // Manipulate the display variable to test a previous bug. - $view = $this->getView(); - $view->preview(); - - $view->destroy(); - $this->assertViewDestroy($view); } function assertViewDestroy($view) { @@ -216,11 +206,12 @@ class ViewExecutableTest extends ViewTestBase { // Test a view with multiple displays. // Validating a view shouldn't change the active display. // @todo Create an extra validation view. - $this->view->setDisplay('page_1'); + $view = views_get_view('test_destroy'); + $view->setDisplay('page_1'); - $this->view->validate(); + $view->validate(); - $this->assertEqual('page_1', $this->view->current_display, "The display should be constant while validating"); + $this->assertEqual('page_1', $view->current_display, "The display should be constant while validating"); // @todo Write real tests for the validation. // In general the following things could be tested: diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php index d477524ee772..36282632f7a7 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php @@ -26,19 +26,12 @@ abstract class ViewTestBase extends WebTestBase { * * @var array */ - public static $modules = array('views'); - - /** - * The view to use for the test. - * - * @var Drupal\views\ViewExecutable - */ - protected $view; + public static $modules = array('views', 'views_test_config'); protected function setUp() { parent::setUp(); - $this->view = $this->getBasicView(); + ViewTestData::importTestViews(get_class($this)); } /** @@ -64,9 +57,6 @@ abstract class ViewTestBase extends WebTestBase { } $query->execute(); $this->checkPermissions(array(), TRUE); - - // Reset the test view, in case it was dependent on the test data module. - $this->view = $this->getBasicView(); } /** @@ -254,58 +244,4 @@ abstract class ViewTestBase extends WebTestBase { return ViewTestData::dataSet(); } - /** - * Builds and returns a basic view of the views_test_data table. - * - * @return Drupal\views\ViewExecutable - * The built view object. - */ - protected function getBasicView() { - return $this->createViewFromConfig('test_view'); - } - - /** - * Creates a new View instance by creating it directly from config data. - * - * @param string $view_name - * The name of the test view to create. - * - * @return Drupal\views\ViewExecutable - * A View instance. - */ - protected function createViewFromConfig($view_name) { - if (!module_exists('views_test_config')) { - module_enable(array('views_test_config')); - } - - $data = config("views.view.$view_name")->get(); - - $view = entity_create('view', $data); - $view = $view->get('executable'); - $view->setDisplay(); - - return $view; - } - - /** - * Clones the view used in this test and sets the default display. - * - * @param Drupal\views\Plugin\Core\Entity\View $original_view - * (optional) The view to clone. If not specified, the default view for the - * test will be used. - * - * @return Drupal\views\ViewExecutable - * A clone of the view. - */ - protected function getView($original_view = NULL) { - if (isset($original_view)) { - $view = $original_view->cloneView(); - } - else { - $view = $this->view->cloneView(); - } - $view->setDisplay(); - return $view; - } - } diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewTestData.php b/core/modules/views/lib/Drupal/views/Tests/ViewTestData.php index 6a2d87c9437c..e8c99e3a8cc6 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewTestData.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestData.php @@ -7,6 +7,8 @@ namespace Drupal\views\Tests; +use Drupal\Core\Config\FileStorage; + /** * Provides tests view data and the base test schema with sample data records. * @@ -17,6 +19,50 @@ namespace Drupal\views\Tests; */ class ViewTestData { + /** + * Imports test views from config. + * + * @param string $class + * The name of the test class. + * @param array $modules + * (optional) The module directories to look in for test views. + * The views_test_config module will always be checked. + * + * @see config_install_default_config() + */ + public static function importTestViews($class, $modules = array()) { + $modules[] = 'views_test_config'; + $views = array(); + while ($class) { + if (property_exists($class, 'testViews')) { + $views = array_merge($views, $class::$testViews); + } + $class = get_parent_class($class); + } + if (!empty($views)) { + $target_storage = drupal_container()->get('config.storage'); + $config_changes = array( + 'delete' => array(), + 'create' => array(), + 'change' => array(), + ); + foreach ($modules as $module) { + $config_dir = drupal_get_path('module', $module) . '/test_views'; + $source_storage = new FileStorage($config_dir); + foreach ($source_storage->listAll() as $config_name) { + list(, , $id) = explode('.', $config_name); + if (in_array($id, $views)) { + $config_changes['create'][] = $config_name; + } + } + } + if (!empty($config_changes['create'])) { + $remaining_changes = config_import_invoke_owner($config_changes, $source_storage, $target_storage); + config_sync_changes($remaining_changes, $source_storage, $target_storage); + } + } + } + /** * Returns the schema definition. */ diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php index 6cec8db2a7f7..356346db3b28 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php @@ -41,8 +41,9 @@ abstract class ViewUnitTestBase extends DrupalUnitTestBase { $query->values($record); } $query->execute(); - } + ViewTestData::importTestViews(get_class($this)); + } /** * Verifies that a result set returned by a View matches expected values. diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_access_dynamic.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_access_dynamic.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_access_dynamic.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_access_dynamic.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_access_none.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_access_none.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_access_none.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_access_none.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_access_perm.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_access_perm.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_access_perm.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_access_perm.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_access_role.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_access_role.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_access_role.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_access_role.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_access_static.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_access_static.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_access_static.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_access_static.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_aggregate_count.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_aggregate_count.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_aggregate_count.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_aggregate_count.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_alias.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_alias.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_alias.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_alias.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_argument_default_current_user.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_argument_default_current_user.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_argument_default_current_user.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_argument_default_current_user.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_argument_default_fixed.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_argument_default_fixed.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_argument_default_fixed.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_argument_default_fixed.yml diff --git a/core/modules/views/tests/views_test_config/test_views/views.view.test_cache.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_cache.yml new file mode 100644 index 000000000000..b15a64a53745 --- /dev/null +++ b/core/modules/views/tests/views_test_config/test_views/views.view.test_cache.yml @@ -0,0 +1,42 @@ +api_version: '3.0' +base_table: views_test_data +core: '8' +description: '' +disabled: '0' +display: + default: + display_plugin: default + id: default + display_title: Master + position: '0' + display_options: + fields: + id: + id: id + table: views_test_data + field: id + relationship: none + name: + id: name + table: views_test_data + field: name + relationship: none + age: + id: age + table: views_test_data + field: age + relationship: none + defaults: + fields: '0' + sorts: '0' + sorts: + id: + order: ASC + id: id + table: views_test_data + field: id + relationship: none +human_name: '' +name: test_cache +tag: '' +base_field: nid diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_click_sort.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_click_sort.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_click_sort.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_click_sort.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_comment_user_uid.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_comment_user_uid.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_comment_user_uid.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_comment_user_uid.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_destroy.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_destroy.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_destroy.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_destroy.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_display.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_display.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_display.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_display.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_example_area.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_example_area.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_example_area.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_example_area.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_executable_displays.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_executable_displays.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_executable_displays.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_executable_displays.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_exposed_admin_ui.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_exposed_admin_ui.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_exposed_admin_ui.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_exposed_admin_ui.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_exposed_form.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_exposed_form.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_exposed_form.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_exposed_form.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_feed_display.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_feed_display.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_feed_display.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_feed_display.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_field_classes.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_field_classes.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_field_classes.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_field_classes.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_field_get_entity.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_field_get_entity.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_field_get_entity.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_field_get_entity.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_field_output.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_field_output.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_field_output.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_field_output.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_field_tokens.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_field_tokens.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_field_tokens.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_field_tokens.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_field_type.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_field_type.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_field_type.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_field_type.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_filter.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_filter.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_filter.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_filter.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_filter_date_between.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_filter_date_between.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_filter_date_between.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_filter_date_between.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_filter_group_override.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_filter_group_override.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_filter_group_override.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_filter_group_override.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_filter_groups.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_filter_groups.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_filter_groups.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_filter_groups.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_filter_in_operator_ui.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_filter_in_operator_ui.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_filter_in_operator_ui.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_filter_in_operator_ui.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_filter_node_uid_revision.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_filter_node_uid_revision.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_filter_node_uid_revision.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_filter_node_uid_revision.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_glossary.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_glossary.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_glossary.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_glossary.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_group_by_count.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_group_by_count.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_group_by_count.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_group_by_count.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_group_by_in_filters.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_group_by_in_filters.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_group_by_in_filters.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_group_by_in_filters.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_groupwise_term.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_groupwise_term.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_groupwise_term.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_groupwise_term.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_groupwise_user.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_groupwise_user.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_groupwise_user.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_groupwise_user.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_handler_relationships.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_handler_relationships.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_handler_relationships.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_handler_relationships.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_handler_test_access.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_handler_test_access.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_handler_test_access.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_handler_test_access.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_node_revision_nid.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_node_revision_nid.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_node_revision_nid.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_node_revision_nid.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_node_revision_vid.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_node_revision_vid.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_node_revision_vid.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_node_revision_vid.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_page_display.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_page_display.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_page_display.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_page_display.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_pager_full.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_pager_full.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_pager_full.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_pager_full.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_pager_none.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_pager_none.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_pager_none.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_pager_none.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_pager_some.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_pager_some.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_pager_some.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_pager_some.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_plugin_argument_default_current_user.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_plugin_argument_default_current_user.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_plugin_argument_default_current_user.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_plugin_argument_default_current_user.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_preview.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_preview.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_preview.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_preview.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_redirect_view.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_redirect_view.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_redirect_view.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_redirect_view.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_reset_button.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_reset_button.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_reset_button.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_reset_button.yml diff --git a/core/modules/views/tests/views_test_config/test_views/views.view.test_simple_argument.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_simple_argument.yml new file mode 100644 index 000000000000..8f1e259be5fc --- /dev/null +++ b/core/modules/views/tests/views_test_config/test_views/views.view.test_simple_argument.yml @@ -0,0 +1,86 @@ +api_version: '3.0' +base_table: views_test_data +core: '8' +description: '' +disabled: '0' +display: + default: + display_options: + defaults: + fields: '0' + pager: '0' + pager_options: '0' + sorts: '0' + arguments: '0' + fields: + age: + field: age + id: age + relationship: none + table: views_test_data + id: + field: id + id: id + relationship: none + table: views_test_data + name: + field: name + id: name + relationship: none + table: views_test_data + pager: + options: + offset: '0' + type: none + pager_options: { } + sorts: + id: + field: id + id: id + order: ASC + relationship: none + table: views_test_data + arguments: + age: + default_action: ignore + style_plugin: default_summary + style_options: { } + wildcard: all + wildcard_substitution: All + title: '' + breadcrumb: '' + default_argument_type: fixed + default_argument: '' + validate: + type: none + fail: 'not found' + break_phrase: '0' + not: '0' + id: age + table: views_test_data + field: age + validate_user_argument_type: uid + validate_user_roles: + 2: '0' + relationship: none + default_options_div_prefix: '' + default_argument_user: '0' + default_argument_fixed: '' + default_argument_php: '' + validate_argument_node_type: + page: '0' + story: '0' + validate_argument_node_access: '0' + validate_argument_nid_type: nid + validate_argument_vocabulary: { } + validate_argument_type: tid + validate_argument_transform: '0' + validate_user_restrict_roles: '0' + validate_argument_php: '' + display_plugin: default + display_title: Master + id: default + position: '0' +human_name: '' +name: test_simple_argument +tag: '' diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_status_extra.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_status_extra.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_status_extra.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_status_extra.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_store_pager_settings.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_store_pager_settings.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_store_pager_settings.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_store_pager_settings.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_style_mapping.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_style_mapping.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_style_mapping.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_style_mapping.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_taxonomy_node_term_data.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_taxonomy_node_term_data.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_taxonomy_node_term_data.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_taxonomy_node_term_data.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_tokens.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_tokens.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_tokens.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_tokens.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_user_name.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_user_name.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_user_name.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_user_name.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_user_relationship.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_user_relationship.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_user_relationship.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_user_relationship.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_user_uid_argument.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_user_uid_argument.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_user_uid_argument.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_user_uid_argument.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_view.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_view.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_view_argument_validate_numeric.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_argument_validate_numeric.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_view_argument_validate_numeric.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view_argument_validate_numeric.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_view_argument_validate_php.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_argument_validate_php.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_view_argument_validate_php.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view_argument_validate_php.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_view_argument_validate_user.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_argument_validate_user.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_view_argument_validate_user.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view_argument_validate_user.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_view_delete.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_delete.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_view_delete.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view_delete.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_view_fieldapi.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_fieldapi.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_view_fieldapi.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view_fieldapi.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_view_handler_weight.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_handler_weight.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_view_handler_weight.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view_handler_weight.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_view_pager_full_zero_items_per_page.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_pager_full_zero_items_per_page.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_view_pager_full_zero_items_per_page.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view_pager_full_zero_items_per_page.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_view_status.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_status.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_view_status.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_view_status.yml diff --git a/core/modules/views/tests/views_test_data/config/views.view.test_views_groupby_save.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_views_groupby_save.yml similarity index 100% rename from core/modules/views/tests/views_test_data/config/views.view.test_views_groupby_save.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_views_groupby_save.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_views_handler_field_user_name.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_views_handler_field_user_name.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_views_handler_field_user_name.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_views_handler_field_user_name.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_views_move_to_field.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_views_move_to_field.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_views_move_to_field.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_views_move_to_field.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_views_move_to_handler.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_views_move_to_handler.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_views_move_to_handler.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_views_move_to_handler.yml diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_views_move_to_table.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_views_move_to_table.yml similarity index 100% rename from core/modules/views/tests/views_test_config/config/views.view.test_views_move_to_table.yml rename to core/modules/views/tests/views_test_config/test_views/views.view.test_views_move_to_table.yml