3 if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
4 print "This script must be run from the command line\n";
8 define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
9 define('STATUSNET', true);
10 define('LACONICA', true);
12 require_once INSTALLDIR . '/lib/common.php';
14 class CurryTest extends PHPUnit_Framework_TestCase
17 * @dataProvider provider
20 public function testProduction($callback, $curry_params, $call_params, $expected)
22 $params = array_merge(array($callback), $curry_params);
23 $curried = call_user_func_array('curry', $params);
24 $result = call_user_func_array($curried, $call_params);
25 $this->assertEquals($expected, $result);
28 static public function provider()
30 $obj = new CurryTestHelperObj('oldval');
31 return array(array(array('CurryTest', 'callback'),
35 array(array('CurryTest', 'callback'),
36 array('curried1', 'curried2'),
37 array('called1', 'called2'),
38 'called1|called2|curried1|curried2'),
39 array(array('CurryTest', 'callbackObj'),
43 // Confirm object identity is retained...
44 array(array('CurryTest', 'callbackObj'),
50 static function callback()
52 $args = func_get_args();
53 return implode("|", $args);
56 static function callbackObj($val, $obj)
64 class CurryTestHelperObj
68 function __construct($val)