Commit a17c5355 authored by webchick's avatar webchick

Issue #1888700 by dawehner: Drop Drupal\views\Tests\Plugin\StyleTest::testLegacy().

parent e7abb095
......@@ -89,97 +89,6 @@ public function testStyle() {
$this->assertTrue(strpos($output, $random_text) !== FALSE, 'Take sure that the rendering of the row plugin appears in the output of the view.');
}
/**
* Tests the grouping legacy features of styles.
*/
function testGroupingLegacy() {
$view = views_get_view('test_view');
// Setup grouping by the job.
$view->setDisplay();
$view->initStyle();
$view->style_plugin->options['grouping'] = 'job';
// Reduce the amount of items to make the test a bit easier.
// Set up the pager.
$view->displayHandlers->get('default')->overrideOption('pager', array(
'type' => 'some',
'options' => array('items_per_page' => 3),
));
// Add the job field .
$view->displayHandlers->get('default')->overrideOption('fields', array(
'name' => array(
'id' => 'name',
'table' => 'views_test_data',
'field' => 'name',
'relationship' => 'none',
),
'job' => array(
'id' => 'job',
'table' => 'views_test_data',
'field' => 'job',
'relationship' => 'none',
),
));
// Now run the query and groupby the result.
$this->executeView($view);
// This is the old way to call it.
$sets = $view->style_plugin->render_grouping($view->result, $view->style_plugin->options['grouping']);
$expected = array();
// Use Job: as label, so be sure that the label is used for groupby as well.
$expected['Job: Singer'] = array();
$expected['Job: Singer'][0] = new \stdClass();
$expected['Job: Singer'][0]->views_test_data_name = 'John';
$expected['Job: Singer'][0]->views_test_data_job = 'Singer';
$expected['Job: Singer'][0]->views_test_data_id = '1';
$expected['Job: Singer'][1] = new \stdClass();
$expected['Job: Singer'][1]->views_test_data_name = 'George';
$expected['Job: Singer'][1]->views_test_data_job = 'Singer';
$expected['Job: Singer'][1]->views_test_data_id = '2';
$expected['Job: Drummer'] = array();
$expected['Job: Drummer'][2] = new \stdClass();
$expected['Job: Drummer'][2]->views_test_data_name = 'Ringo';
$expected['Job: Drummer'][2]->views_test_data_job = 'Drummer';
$expected['Job: Drummer'][2]->views_test_data_id = '3';
$this->assertEqual($sets, $expected, t('The style plugin should proper group the results with grouping by the rendered output.'));
$expected = array();
$expected['Job: Singer'] = array();
$expected['Job: Singer']['group'] = 'Job: Singer';
$expected['Job: Singer']['rows'][0] = new \stdClass();
$expected['Job: Singer']['rows'][0]->views_test_data_name = 'John';
$expected['Job: Singer']['rows'][0]->views_test_data_job = 'Singer';
$expected['Job: Singer']['rows'][0]->views_test_data_id = '1';
$expected['Job: Singer']['rows'][1] = new \stdClass();
$expected['Job: Singer']['rows'][1]->views_test_data_name = 'George';
$expected['Job: Singer']['rows'][1]->views_test_data_job = 'Singer';
$expected['Job: Singer']['rows'][1]->views_test_data_id = '2';
$expected['Job: Drummer'] = array();
$expected['Job: Drummer']['group'] = 'Job: Drummer';
$expected['Job: Drummer']['rows'][2] = new \stdClass();
$expected['Job: Drummer']['rows'][2]->views_test_data_name = 'Ringo';
$expected['Job: Drummer']['rows'][2]->views_test_data_job = 'Drummer';
$expected['Job: Drummer']['rows'][2]->views_test_data_id = '3';
// The newer api passes the value of the grouping as well.
$sets_new_rendered = $view->style_plugin->render_grouping($view->result, $view->style_plugin->options['grouping'], TRUE);
$sets_new_value = $view->style_plugin->render_grouping($view->result, $view->style_plugin->options['grouping'], FALSE);
$this->assertEqual($sets_new_rendered, $expected, t('The style plugins should proper group the results with grouping by the rendered output.'));
// Reorder the group structure to group by value.
$expected['Singer'] = $expected['Job: Singer'];
$expected['Drummer'] = $expected['Job: Drummer'];
unset($expected['Job: Singer']);
unset($expected['Job: Drummer']);
$this->assertEqual($sets_new_value, $expected, t('The style plugins should proper group the results with grouping by the value.'));
}
function testGrouping() {
$this->_testGrouping(FALSE);
$this->_testGrouping(TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment