DrupalBin
Submit Code
About
Recent Posts
Code
16 min 17 sec
ago
Code
31 min 54 sec
ago
css path
2 hours 16 min
ago
Fix for Code
6 hours 16 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for Code
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
<?php class test { function pass() { echo "Pass\n"; } function fail() { echo "Fail\n"; } } function test_clearinghouse($a0 = NULL, &$a1 = NULL, &$a2 = NULL, &$a3 = NULL, &$a4 = NULL, &$a5 = NULL, &$a6 = NULL, &$a7 = NULL, &$a8 = NULL, &$a9 = NULL) { static $state = TEST_LOAD, $test, $object; switch ($state) { case TEST_LOAD: if (!isset($object)) { $object = new test; } $test = $a0; $state = TEST_START; break; case TEST_START: $state = TEST_IN; $function = 'original_'. $a0; $num_args = func_num_args(); switch ($num_args - 1) { case 0: $return = $function();break; case 1: $return = $function($a1); break; case 2: $return = $function($a1, $a2); break; case 3: $return = $function($a1, $a2, $a3); break; case 4: $return = $function($a1, $a2, $a3, $a4); break; case 5: $return = $function($a1, $a2, $a3, $a4, $a5); break; case 6: $return = $function($a1, $a2, $a3, $a4, $a5, $a6); break; case 7: $return = $function($a1, $a2, $a3, $a4, $a5, $a6, $a7); break; case 8: $return = $function($a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8); break; case 9: $return = $function($a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9); break; } $final_return = $test['final_return']; unset($test['final_return']); if (!$test && $return === $final_return) { $object->pass(); } else { $object->fail(); } $state = TEST_LOAD; break; case TEST_IN: $step = array_shift($test); $incoming = $step['incoming']; $num_args = func_num_args(); for ($i = 0; $i < $num_args; $i++) { $variable_name = "a$i"; if ($incoming[$i] !== $$variable_name) { $object->fail(); } } if (isset($step['references'])) { foreach ($step['references'] as $key => $value) { $variable_name = "$a$key"; $$variable_name = $value; } } if (isset($step['return'])) { return $step['return']; } } } function db_query($query) { return test_clearinghouse('db_query', $query); } function cache_get($cid, $table = 'cache') { return test_clearinghouse('cache_get', $cid, $table); } function cache_set($cid, $data, $table = 'cache', $expire = CACHE_PERMANENT, $headers = NULL) { return test_clearinghouse('cache_set', $cid, $data, $table, $expire, $headers); } function db_fetch_object($result) { return test_clearinghouse('db_fetch_object', $result); } require_once './drupal_original/includes/bootstrap.inc'; test_clearinghouse( array( array( 'incoming' => array('cache_get', 'variables', 'cache'), 'return' => FALSE, ), array( 'incoming' => array('db_query', 'SELECT * FROM {variable}'), 'return' => '__test_placeholder__', ), /* array( 'incoming' => array('db_fetch_object', '__test_placeholder__'), 'return' => (object) array('name '=> 'foo', 'value' => serialize('bar')), ), */ array( 'incoming' => array('db_fetch_object', '__test_placeholder__'), 'return' => FALSE, ), array( 'incoming' => array('cache_set', 'variables', NULL, 'cache', CACHE_PERMANENT, NULL), ) ) ); test_clearinghouse('variable_init');
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.