simpletest

node.admin.inc test case

  1. class NodeAdminTestCase extends DrupalWebTestCase {
  2.   /**
  3.    * Implementation of getInfo().
  4.    */
  5.   function getInfo() {
  6.     return array(
  7.       'name' => t('Node administration tests'),

Security scanner component for SimpleTest module: taking out a form_id attribute from an hidden field

  1. /**
  2.    *  Implementation of the crawler page.
  3.    */    
  4.   function security_scanner_cron() {
  5.     global $base_url;

backtrace of drupal_access_denied for simpletest security scanner

  1. (
  2.     [0] => Array
  3.         (
  4.             [file] => E:\wamp\www\soc2008\modules\user\user.pages.inc
  5.             [line] => 123
  6.             [function] => drupal_access_denied

Fix for Fix for A more awesome solution

  1. <?php
  2.  
  3. class MyAwesomeTestCase extends DrupalWebTestCase {
  4.   function testAwesomeness() {
  5.     $awesome = $this->drupalGet('awesome_page');
  6.     $this->assertIdentical($awesome, 'cwgordon7');

Fix for Fix for A more awesome solution

  1. <?php
  2.  
  3. class MyAwesomeTestCase extends DrupalWebTestCase {
  4.   function testAwesomeness() {
  5.     $awesome = $this->drupalGet('awesome_page');
  6.     $this->assertIdentical($awesome, 'dmitrig01');

Fix for Fix for A more awesome solution

  1. <?php
  2.  
  3. class MyAwesomeTestCase extends DrupalWebTestCase {
  4.   function testAwesomeness() {
  5.     $awesome = $this->drupalGet('awesome_page');
  6.     $this->assertIdentical($awesome, 'dmitrig01');

Fix for Fix for A more awesome solution

  1. <?php
  2.  
  3. class MyAwesomeTestCase extends DrupalWebTestCase {
  4.   function testAwesomeness() {
  5.     $awesome = $this->drupalGet('awesome_page');
  6.     $this->assertIdentical($awesome, 'cwgordon7');

Fix for A more awesome solution

  1. <?php
  2.  
  3. class MyAwesomeTestCase extends DrupalWebTestCase {
  4.   function testAwesomeness() {
  5.     $this->implementHook('menu');
  6.     $awesome = $this->drupalGet('awesome_page');

A more awesome solution

  1. <?php
  2.  
  3. class MyAwesomeTestCase extends DrupalWebTestCase {
  4.   function testAwesomeness() {
  5.     $this->implementHook('menu', '_hook_menu');
  6.     $awesome = $this->drupalGet('awesome_page');

Registry and testable refactoring

  1. Before:
  2. +function drupal_rebuild_code_registry($check = FALSE) {
  3. +  static $running;
  4. +  if ($check) {
  5. +    return $running;
  6. +  }
  7. +  $running = TRUE;
  8. +  // Flush the old registry.
Syndicate content