Issue #1641662 by Pedro Lozano, aspilicious: Convert groupby tests to PSR-0.
parent
3ebdf4c8d4
commit
049b4fad8d
|
@ -2,16 +2,18 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Tests aggregate functionality of Views.
|
||||
* Definition of Drupal\views\Tests\QueryGroupByTest.
|
||||
*/
|
||||
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
namespace Drupal\views\Tests;
|
||||
|
||||
use Drupal\views\View;
|
||||
use ViewsSqlTest;
|
||||
|
||||
/**
|
||||
* Tests aggregate functionality of views, for example count.
|
||||
*/
|
||||
class ViewsQueryGroupByTest extends ViewsSqlTest {
|
||||
class QueryGroupByTest extends ViewsSqlTest {
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Groupby',
|
||||
|
@ -286,46 +288,3 @@ class ViewsQueryGroupByTest extends ViewsSqlTest {
|
|||
return $view;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests UI of aggregate functionality..
|
||||
*/
|
||||
class viewsUiGroupbyTestCase extends WebTestBase {
|
||||
protected $profile = 'standard';
|
||||
|
||||
function setUp() {
|
||||
// Enable views_ui.
|
||||
parent::setUp('views_ui', 'views_test');
|
||||
|
||||
// Create and log in a user with administer views permission.
|
||||
$views_admin = $this->drupalCreateUser(array('administer views', 'administer blocks', 'bypass node access', 'access user profiles', 'view revisions'));
|
||||
$this->drupalLogin($views_admin);
|
||||
}
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Groupby UI',
|
||||
'description' => 'Tests UI of aggregate functionality.',
|
||||
'group' => 'Views UI',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether basic saving works.
|
||||
*
|
||||
* @todo: this should check the change of the settings as well.
|
||||
*/
|
||||
function testGroupBySave() {
|
||||
$this->drupalGet('admin/structure/views/view/test_views_groupby_save/edit');
|
||||
|
||||
$edit = array(
|
||||
'group_by' => TRUE,
|
||||
);
|
||||
$this->drupalPost('admin/structure/views/nojs/display/test_views_groupby_save/default/group_by', $edit, t('Apply'));
|
||||
|
||||
$this->drupalGet('admin/structure/views/view/test_views_groupby_save/edit');
|
||||
$this->drupalPost('admin/structure/views/view/test_views_groupby_save/edit', array(), t('Save'));
|
||||
|
||||
$this->drupalGet('admin/structure/views/nojs/display/test_views_groupby_save/default/group_by');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\views\Tests\UiGroupByTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Tests;
|
||||
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
* Tests UI of aggregate functionality..
|
||||
*/
|
||||
class UiGroupByTest extends WebTestBase {
|
||||
protected $profile = 'standard';
|
||||
|
||||
function setUp() {
|
||||
// Enable views_ui.
|
||||
parent::setUp('views_ui', 'views_test');
|
||||
|
||||
// Create and log in a user with administer views permission.
|
||||
$views_admin = $this->drupalCreateUser(array('administer views', 'administer blocks', 'bypass node access', 'access user profiles', 'view revisions'));
|
||||
$this->drupalLogin($views_admin);
|
||||
}
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Groupby UI',
|
||||
'description' => 'Tests UI of aggregate functionality.',
|
||||
'group' => 'Views UI',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether basic saving works.
|
||||
*
|
||||
* @todo: this should check the change of the settings as well.
|
||||
*/
|
||||
function testGroupBySave() {
|
||||
$this->drupalGet('admin/structure/views/view/test_views_groupby_save/edit');
|
||||
|
||||
$edit = array(
|
||||
'group_by' => TRUE,
|
||||
);
|
||||
$this->drupalPost('admin/structure/views/nojs/display/test_views_groupby_save/default/group_by', $edit, t('Apply'));
|
||||
|
||||
$this->drupalGet('admin/structure/views/view/test_views_groupby_save/edit');
|
||||
$this->drupalPost('admin/structure/views/view/test_views_groupby_save/edit', array(), t('Save'));
|
||||
|
||||
$this->drupalGet('admin/structure/views/nojs/display/test_views_groupby_save/default/group_by');
|
||||
}
|
||||
}
|
|
@ -23,6 +23,8 @@ use Drupal\views\Tests\TranslatableTest;
|
|||
use Drupal\views\Tests\UiSettingsTest;
|
||||
use Drupal\views\Tests\UpgradeTestCase;
|
||||
use Drupal\views\Tests\ViewTest;
|
||||
use Drupal\views\Tests\QueryGroupByTest;
|
||||
use Drupal\views\Tests\UiGroupByTest;
|
||||
use Drupal\views\Tests\Comment\ArgumentCommentUserUidTest;
|
||||
use Drupal\views\Tests\Comment\FilterCommentUserUidTest;
|
||||
use Drupal\views\Tests\Field\ApiDataTest;
|
||||
|
@ -72,6 +74,8 @@ class TranslatablePSR0Test extends TranslatableTest {}
|
|||
class UiSettingsPSR0Test extends UiSettingsTest {}
|
||||
class UpgradeTestCasePSR0Test extends UpgradeTestCase {}
|
||||
class ViewPSR0Test extends ViewTest {}
|
||||
class UiGroupByPSR0Test extends UiGroupByTest {}
|
||||
class QueryGroupByPSR0Test extends QueryGroupByTest {}
|
||||
class ArgumentCommentUserUidPSR0Test extends ArgumentCommentUserUidTest {}
|
||||
class FilterCommentUserUidPSR0Test extends FilterCommentUserUidTest {}
|
||||
class ApiDataPSR0Test extends ApiDataTest {}
|
||||
|
|
|
@ -244,7 +244,6 @@ files[] = plugins/views_plugin_style_table.inc
|
|||
; Tests
|
||||
files[] = tests/test_plugins/views_test_plugin_access_test_dynamic.inc
|
||||
files[] = tests/test_plugins/views_test_plugin_access_test_static.inc
|
||||
files[] = tests/views_groupby.test
|
||||
files[] = tests/views_plugin_localization_test.inc
|
||||
files[] = tests/views_query.test
|
||||
files[] = tests/views_test.views_default.inc
|
||||
|
|
Loading…
Reference in New Issue