Example #1
0
            $response = array();
            for ($i = 0; $i < 25; $i++) {
                $resp = $c->send($req, 10, 'http11');
                $response[] = $resp->value();
            }
            end_test($testName, 'http 11 w. keep-alive and compression', $response);
            $c->keepalive = false;
            begin_test($testName, 'http 11 w. compression');
            $response = array();
            for ($i = 0; $i < 25; $i++) {
                $resp = $c->send($req, 10, 'http11');
                $response[] = $resp->value();
            }
            end_test($testName, 'http 11 w. compression', $response);
        }
        begin_test($testName, 'multicall w. compression');
        $response = $c->send($reqs);
        foreach ($response as $key => &$val) {
            $val = $val->value();
        }
        end_test($testName, 'multicall w. compression', $response);
    }
}
// end of 'if no xdebug profiling'
echo "\n";
foreach ($test_results as $test => $results) {
    echo "\nTEST: {$test}\n";
    foreach ($results as $case => $data) {
        echo "  {$case}: {$data['time']} secs - Output data CRC: " . crc32(serialize($data['result'])) . "\n";
    }
}
Example #2
0
            $response = array();
            for ($i = 0; $i < 25; $i++) {
                $resp =& $c->send($msg, 10, 'http11');
                $response[] = $resp->value();
            }
            end_test('Repeated send (small array)', 'http 11 w. keep-alive and compression', $response);
            $c->keepalive = false;
            begin_test('Repeated send (small array)', 'http 11 w. compression');
            $response = array();
            for ($i = 0; $i < 25; $i++) {
                $resp =& $c->send($msg, 10, 'http11');
                $response[] = $resp->value();
            }
            end_test('Repeated send (small array)', 'http 11 w. compression', $response);
        }
        begin_test('Repeated send (small array)', 'multicall w. compression');
        $response =& $c->send($msgs);
        foreach ($response as $key => &$val) {
            $val = $val->value();
        }
        end_test('Repeated send (small array)', 'multicall w. compression', $response);
    }
}
// end of 'if no xdebug profiling'
function begin_test($test_name, $test_case)
{
    global $test_results;
    if (!isset($test_results[$test_name])) {
        $test_results[$test_name] = array();
    }
    $test_results[$test_name][$test_case] = array();
Example #3
0
        $c->keepalive = false;
        begin_test('Repeated send (small array)', 'http 11');
        $response = array();
        for ($i = 0; $i < 25; $i++) {
            $resp =& $c->send($msg, 10, 'http11');
            $response[] = $resp->value();
        }
        end_test('Repeated send (small array)', 'http 11', $response);
    }
    /*begin_test('Repeated send (small array)', 'multicall');
    	$response =& $c->send($msgs);
    	end_test('Repeated send (small array)', 'multicall', $response);*/
    if (function_exists('gzinflate')) {
        $c->accepted_compression = array('gzip');
        $c->request_compression = 'gzip';
        begin_test('Repeated send (small array)', 'http 10 w. compression');
        $response = array();
        for ($i = 0; $i < 25; $i++) {
            $resp =& $c->send($msg);
            $response[] = $resp->value();
        }
        end_test('Repeated send (small array)', 'http 10 w. compression', $response);
    }
}
function begin_test($test_name, $test_case)
{
    global $test_results;
    if (!isset($test_results[$test_name])) {
        $test_results[$test_name] = array();
    }
    $test_results[$test_name][$test_case] = array();
Example #4
0
$email = '*****@*****.**';
$info = compact('username', 'password', 'realname', 'phone', 'email');
$customer = Customer::create($info);
test(1, 1, array('name' => 'register Customer, db'));
begin_test();
test(User::check($username, $password), true, array('name' => 'User::check($username, $password)'));
begin_test();
$username = '******';
$password = '******';
$user = User::getByName('root');
$superadmin = $user->instance();
$admin = $superadmin->createAdmin(compact('username', 'password'));
$ideal_arr = array('name' => $username, 'password' => md5($password), 'type' => 'Admin');
$id = Pdb::lastInsertId();
$real_arr = Pdb::fetchRow('name, password, type', User::$table, array('id=?' => $id));
test($real_arr, $ideal_arr, array('name' => 'Super Admin create Admin, db'));
begin_test();
$prd_types = Product::types();
$info = array('name' => '唯爱心形群镶女戒_test', 'type' => reset(array_keys($prd_types)), 'material' => json_encode(array('PT950', '白18K金', '黄18K金', '红18K金')), 'rabbet_start' => '0.30', 'rabbet_end' => '0.60', 'weight' => 9, 'small_stone' => 3, 'st_weight' => 2.1, 'images' => array('400' => array('/test/static/img/i400-1.jpg', '/test/static/img/i400-2.jpg', '/test/static/img/i400-3.jpg'), 'thumb' => array('/test/static/img/i80-1.jpg', '/test/static/img/i80-2.jpg', '/test/static/img/i80-3.jpg')));
$product = Product::create($info);
test(1, 1, array('name' => 'Admin post Product, db'));
begin_test();
$address = $customer->defaultAddress();
$address->edit(array('name' => '小池', 'phone' => '14722320989', 'detail' => '深圳罗湖区田贝'));
test(1, 1, array('name' => 'edit Address'));
begin_test();
$cart = $customer->cart();
test(+$cart->count(), 2, array('name' => 'Cart count()'));
begin_test();
$cart->submit();
test(1, 1, array('name' => 'Customer submit a Cart'));