only in patch2:
unchanged:
--- a/core/modules/views/lib/Drupal/views/Tests/AnalyzeTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/AnalyzeTest.php
@@ -39,10 +39,8 @@ public function setUp() {
*/
function testAnalyzeBasic() {
$this->drupalLogin($this->admin);
- // Enable the frontpage view and click the analyse button.
- $view = views_get_view('frontpage');
- $this->drupalGet('admin/structure/views/view/frontpage/edit');
+ $this->drupalGet('admin/structure/views/view/test_view/edit');
$this->assertLink(t('analyze view'));
// This redirects the user to the form.
only in patch2:
unchanged:
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/RelationshipTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/RelationshipTest.php
@@ -7,12 +7,14 @@
namespace Drupal\views\Tests\Handler;
+use Drupal\views\Tests\Plugin\RelationshipJoinTestBase;
+
/**
* Tests the base relationship handler.
*
* @see Drupal\views\Plugin\views\relationship\RelationshipPluginBase
*/
-class RelationshipTest extends HandlerTestBase {
+class RelationshipTest extends RelationshipJoinTestBase {
/**
* Maps between the key in the expected result and the query result.
@@ -32,57 +34,6 @@ public static function getInfo() {
);
}
- protected function setUp() {
- parent::setUp();
-
- $this->enableViewsTestModule();
- }
-
-
- /**
- * Overrides Drupal\views\Tests\ViewTestBase::schemaDefinition().
- *
- * Adds a uid column to test the relationships.
- *
- * @return array
- */
- protected function schemaDefinition() {
- $schema = parent::schemaDefinition();
-
- $schema['views_test_data']['fields']['uid'] = array(
- 'description' => "The {users}.uid of the author of the beatle entry.",
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0
- );
-
- return $schema;
- }
-
-
- /**
- * Overrides Drupal\views\Tests\ViewTestBase::viewsData().
- *
- * Adds a relationship for the uid column.
- *
- * @return array
- */
- protected function viewsData() {
- $data = parent::viewsData();
- $data['views_test_data']['uid'] = array(
- 'title' => t('UID'),
- 'help' => t('The test data UID'),
- 'relationship' => array(
- 'id' => 'standard',
- 'base' => 'users',
- 'base field' => 'uid'
- )
- );
-
- return $data;
- }
-
/**
* Tests the query result of a view with a relationship.
*/
only in patch2:
unchanged:
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php
@@ -49,7 +49,7 @@ public function setUp() {
* @see Drupal\views_test_data\Plugin\views\display\DisplayTest
*/
function testDisplayPlugin() {
- $view = views_get_view('frontpage');
+ $view = views_get_view('test_view');
// Add a new 'display_test' display and test it's there.
$view->storage->addDisplay('display_test');
@@ -88,7 +88,7 @@ function testDisplayPlugin() {
$this->assertTrue(strpos($output, '
Test option title
') !== FALSE, 'The test_option value found in display output title.');
// Test that the display category/summary is in the UI.
- $this->drupalGet('admin/structure/views/view/frontpage/edit/display_test_1');
+ $this->drupalGet('admin/structure/views/view/test_view/edit/display_test_1');
$this->assertText('Display test settings');
$this->clickLink('Test option title');
@@ -97,7 +97,7 @@ function testDisplayPlugin() {
$this->drupalPost(NULL, array('test_option' => $this->randomString), t('Apply'));
// Check the new value has been saved by checking the UI summary text.
- $this->drupalGet('admin/structure/views/view/frontpage/edit/display_test_1');
+ $this->drupalGet('admin/structure/views/view/test_view/edit/display_test_1');
$this->assertRaw($this->randomString);
// Test the enable/disable status of a display.
only in patch2:
unchanged:
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/JoinTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/JoinTest.php
@@ -13,8 +13,11 @@
/**
* Tests a generic join plugin and the join plugin base.
+ *
+ * @see \Drupal\views_test_data\Plugin\views\join\JoinTest
+ * @see \Drupal\views\Plugin\views\join\JoinPluginBase
*/
-class JoinTest extends PluginTestBase {
+class JoinTest extends RelationshipJoinTestBase {
/**
* A plugin manager which handlers the instances of joins.
@@ -45,12 +48,12 @@ protected function setUp() {
public function testExamplePlugin() {
// Setup a simple join and test the result sql.
- $view = views_get_view('frontpage');
+ $view = views_get_view('test_view');
$view->initDisplay();
$view->initQuery();
$configuration = array(
- 'left_table' => 'node',
+ 'left_table' => 'views_test_data',
'left_field' => 'uid',
'table' => 'users',
'field' => 'uid',
@@ -61,14 +64,14 @@ public function testExamplePlugin() {
$rand_int = rand(0, 1000);
$join->setJoinValue($rand_int);
- $query = db_select('node');
+ $query = db_select('views_test_data');
$table = array('alias' => 'users');
$join->buildJoin($query, $table, $view->query);
$tables = $query->getTables();
$join_info = $tables['users'];
- debug($join_info);
- $this->assertTrue(strpos($join_info['condition'], "node.uid = $rand_int") !== FALSE, 'Make sure that the custom join plugin can extend the join base and alter the result.');
+ debug($join_info['condition']);
+ $this->assertTrue(strpos($join_info['condition'], "views_test_data.uid = $rand_int") !== FALSE, 'Make sure that the custom join plugin can extend the join base and alter the result.');
}
/**
@@ -77,14 +80,14 @@ public function testExamplePlugin() {
public function testBasePlugin() {
// Setup a simple join and test the result sql.
- $view = views_get_view('frontpage');
+ $view = views_get_view('test_view');
$view->initDisplay();
$view->initQuery();
// First define a simple join without an extra condition.
// Set the various options on the join object.
$configuration = array(
- 'left_table' => 'node',
+ 'left_table' => 'views_test_data',
'left_field' => 'uid',
'table' => 'users',
'field' => 'uid',
@@ -97,7 +100,7 @@ public function testBasePlugin() {
// Build the actual join values and read them back from the dbtng query
// object.
- $query = db_select('node');
+ $query = db_select('views_test_data');
$table = array('alias' => 'users');
$join->buildJoin($query, $table, $view->query);
@@ -106,7 +109,7 @@ public function testBasePlugin() {
$this->assertEqual($join_info['join type'], 'LEFT', 'Make sure the default join type is LEFT');
$this->assertEqual($join_info['table'], $configuration['table']);
$this->assertEqual($join_info['alias'], 'users');
- $this->assertEqual($join_info['condition'], 'node.uid = users.uid');
+ $this->assertEqual($join_info['condition'], 'views_test_data.uid = users.uid');
// Set a different alias and make sure table info is as expected.
$join = $this->manager->createInstance('standard', $configuration);
only in patch2:
unchanged:
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php
@@ -37,13 +37,16 @@ public function testStorePagerSettings() {
$this->drupalLogin($admin_user);
// Test behaviour described in http://drupal.org/node/652712#comment-2354918.
- $this->drupalGet('admin/structure/views/view/frontpage/edit');
-
+ $this->drupalGet('admin/structure/views/view/test_view/edit');
$edit = array(
+ 'pager[type]' => 'full',
+ );
+ $this->drupalPost('admin/structure/views/nojs/display/test_view/default/pager', $edit, t('Apply'));
+ $edit = array(
'pager_options[items_per_page]' => 20,
);
- $this->drupalPost('admin/structure/views/nojs/display/frontpage/default/pager_options', $edit, t('Apply'));
+ $this->drupalPost('admin/structure/views/nojs/display/test_view/default/pager_options', $edit, t('Apply'));
$this->assertText('20 items');
// Change type and check whether the type is new type is stored.
@@ -51,8 +54,8 @@ public function testStorePagerSettings() {
$edit = array(
'pager[type]' => 'mini',
);
- $this->drupalPost('admin/structure/views/nojs/display/frontpage/default/pager', $edit, t('Apply'));
- $this->drupalGet('admin/structure/views/view/frontpage/edit');
+ $this->drupalPost('admin/structure/views/nojs/display/test_view/default/pager', $edit, t('Apply'));
+ $this->drupalGet('admin/structure/views/view/test_view/edit');
$this->assertText('Mini', 'Changed pager plugin, should change some text');
// Test behaviour described in http://drupal.org/node/652712#comment-2354400
only in patch2:
unchanged:
--- /dev/null
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php
@@ -0,0 +1,70 @@
+enableViewsTestModule();
+ }
+
+
+ /**
+ * Overrides Drupal\views\Tests\ViewTestBase::schemaDefinition().
+ *
+ * Adds a uid column to test the relationships.
+ *
+ * @return array
+ */
+ protected function schemaDefinition() {
+ $schema = parent::schemaDefinition();
+
+ $schema['views_test_data']['fields']['uid'] = array(
+ 'description' => "The {users}.uid of the author of the beatle entry.",
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0
+ );
+
+ return $schema;
+ }
+
+
+ /**
+ * Overrides Drupal\views\Tests\ViewTestBase::viewsData().
+ *
+ * Adds a relationship for the uid column.
+ *
+ * @return array
+ */
+ protected function viewsData() {
+ $data = parent::viewsData();
+ $data['views_test_data']['uid'] = array(
+ 'title' => t('UID'),
+ 'help' => t('The test data UID'),
+ 'relationship' => array(
+ 'id' => 'standard',
+ 'base' => 'users',
+ 'base field' => 'uid'
+ )
+ );
+
+ return $data;
+ }
+
+}
only in patch2:
unchanged:
--- a/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/join/JoinTest.php
+++ b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/join/JoinTest.php
@@ -51,7 +51,7 @@ public function setJoinValue($join_value) {
*/
public function buildJoin($select_query, $table, $view_query) {
// Add an additional hardcoded condition to the query.
- $this->extra = 'node.uid = ' . $this->getJoinValue();
+ $this->extra = 'views_test_data.uid = ' . $this->getJoinValue();
parent::buildJoin($select_query, $table, $view_query);
}