You are here

function ViewsLimitGroupingTests::testSimpleGroupingLimit in Views Grouping Row Limit 7

Test a single level of grouping.

File

tests/views_limit_grouping.test, line 63
Contains test for views_limit_grouping module.

Class

ViewsLimitGroupingTests
Functional test class for views_limit_grouping.

Code

function testSimpleGroupingLimit() {
  $element = $this
    ->getViewContainer('group_by_content_type');

  // Make sure there is a group for each content type.
  $this
    ->assertEqual($element
    ->count(), self::CONTENT_TYPE_AMOUNT, 'There is a grouping for each content type');

  // Make sure each grouping has the correct number of nodes (2, in this
  // case). Each group should also have a header, so we check for a count of
  // 3 instead (nodes + header).
  $limited = TRUE;
  foreach ($element
    ->children() as $grouping) {
    if (count($grouping
      ->children()) !== 3) {
      $limited = FALSE;
      break;
    }
  }
  $this
    ->assertTrue($limited, 'Each of the groupings has been limited to 2 nodes and a header.');
}