public function testGetNameWithNoSuffix() { $type = new MyTest(); $this->assertEquals('mytest', $type->getName()); }
$ret = $this->sendAndReceive($url); if ($ret) { echo 'test successful' . PHP_EOL; //TODO 记录一次成功 } } public function sendAndReceive($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:23.0) Gecko/20100101 Firefox/23.0'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLINFO_HEADER_OUT, true); $result = curl_exec($ch); //赋值内容 if (curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch) . "curl error num" . curl_errno($ch) . "\r\n"; return null; return false; } curl_close($ch); //关闭资源 return $true; } } $myTest = new MyTest(); $myTest->run();
<?php class MyTest { public function checking() { $arr = array(); for ($i = 0; $i < 100000; $i++) { $arr[] = $i; } return $arr; } } $my_test = new MyTest(); $my_test_result = $my_test->checking(); echo "<pre>"; print_r($my_test_result); exit;
public function BenchmarkStatic(Benchmark $b) { for ($i = 0; $i < $b->n; $i++) { MyTest::run(); } }
public function testGetNameWithNoSuffix() { $type = new MyTest(); $this->assertEquals('symfony_tests_component_form_mytest', $type->getName()); }
<?php require_once "MyTest.class.php"; $oMyTest = new MyTest(); $url = "http://www.sintegra.es.gov.br/resultado.php"; $http_verb = "POST"; $referer = null; $params = array("botao" => "Consultar", "num_cnpj" => "31.804.115-0002-43"); $request = $oMyTest->request($url, $http_verb, $referer, $params); $json = $oMyTest->myParse($request); echo $json;