home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (views_handler_area_text.test)

This example Drupal source code file (views_handler_area_text.test) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

area, array, format, function, header, lead, no, php, public, result, return, should, string, to

The views_handler_area_text.test Drupal example source code

// $Id: views_handler_area_text.test,v 2010/11/07 11:32:25 dereine Exp $

class ViewsHandlerAreaTextTest extends ViewsSqlTest {
  public static function getInfo() {
    return array(
      'name' => 'Area: Text',
      'description' => 'Test the core views_handler_area_text handler.',
      'group' => 'Views Handlers',

  public function testAreaText() {
    $view = $this->getBasicView();

    // add a text header
    $string = $this->randomString();
    $view->display['default']->handler->override_option('header', array(
      'area' => array(
        'id' => 'area',
        'table' => 'views',
        'field' => 'area',
        'content' => $string,

    // Execute the view.

    $view->display_handler->handlers['header']['area']->options['format'] = $this->randomString();
    $this->assertEqual(NULL, $view->display_handler->handlers['header']['area']->render(), 'Non existant format should return nothing');

    $view->display_handler->handlers['header']['area']->options['format'] = filter_default_format();
    $this->assertEqual(check_markup($string), $view->display_handler->handlers['header']['area']->render(), 'Existant format should return something');

    // Empty results, and it shouldn't be displayed .
    $this->assertEqual('', $view->display_handler->handlers['header']['area']->render(TRUE), 'No result should lead to no header');
    // Empty results, and it should be displayed.
    $view->display_handler->handlers['header']['area']->options['empty'] = TRUE;
    $this->assertEqual(check_markup($string), $view->display_handler->handlers['header']['area']->render(TRUE), 'No result, but empty enabled lead to a full header');


Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal views_handler_area_text.test source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.