O'Reilly logo

Drupal 7 Development by Example Beginner's Guide by Kurt Madel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — creating a web test case for the D7Dev duration formatter

The d7dev_integer_duration formatter is a perfect candidate for a web test case.

  1. In Aptana Studio, open the d7dev.test file, and add the following code after the unit test case we just added:
    /**
    * Web test for d7dev_integer_duration formatter.
    */
    class DurationFormatterWebTestCase extends DrupalWebTestCase {
    }
    

    Rather than extending DrupalUnitTestCase, we are extending the DrupalWebTestCase class.

  2. Now, we will add some global variables and the required getInfo function:
    protected $field; protected $instance; protected $test_user; public static function getInfo() { return array( 'name' => 'Duration formatter web test', 'description' => 'Test the creation and display of number ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required