9 require_once
'PU_testcase_dcp.php';
20 $oParse = new \parseFamilyFunction();
21 $struct = $oParse->parse($callName);
22 $err = $struct->getError();
24 $this->assertEmpty(
$err, sprintf(
"function struct error detected : %s, %s",
$err, print_r($struct,
true)));
25 foreach ($expectedStructs as $key => $expectedValue) {
26 if (is_array($expectedValue)) {
27 $values = $struct->$key;
28 foreach ($expectedValue as $kv => $singleValue) {
29 if (is_array($singleValue)) {
30 foreach ($singleValue as $k => $v) {
31 $this->assertEquals($v, $values[$kv]->$k, sprintf(
"test struct %s/%s [%s]", $key, $k .
"[$kv]", print_r($values,
true)));
34 $this->assertEquals($singleValue, $values[$kv], sprintf(
"testout struct %s/%s ", $key .
"[$kv]", print_r($struct,
true)));
38 $this->assertEquals($expectedValue, $struct->$key);
51 $oParse = new \parseFamilyFunction();
52 $struct = $oParse->parse($callName);
53 $err = $struct->getError();
55 $this->assertNotEmpty(
$err,
"function struct no error detected");
56 foreach ($expectedErrors as $expectedError) {
58 $this->assertContains($expectedError,
$err, sprintf(
'not the correct error reporting : "%s" : %s',
$err, print_r($struct,
true)));
69 "functionName" =>
"good",
79 "functionName" =>
"good"
86 "functionName" =>
"good",
97 "functionName" =>
"good",
109 "functionName" =>
"good",
123 "good(ONE, CT, 'CT'):OUT",
125 "functionName" =>
"good",
144 'good( "ONE, TWO" ):OUT',
146 "functionName" =>
"good",
149 "name" =>
"ONE, TWO",
157 'good( " ONE \'TWO\' " ):OUT',
159 "functionName" =>
"good",
162 "name" =>
" ONE 'TWO' ",
172 "functionName" =>
"good",
185 "functionName" =>
"good",
198 "functionName" =>
"good",
209 'good("ONE\"TWO"):OUT',
211 "functionName" =>
"good",
222 'good("ONE","TWO"):OUT',
224 "functionName" =>
"good",
241 "functionName" =>
"good",
252 "good('ONE,'TWO):OUT",
254 "functionName" =>
"good",
269 "good('ONE','TWO'):OUT",
271 "functionName" =>
"good",
286 "good('(ONE)',')TWO(:'):OUT",
288 "functionName" =>
"good",
303 "good('ONE', 'TWO'):OUT",
305 "functionName" =>
"good",
320 "good('ONE'TWO):OUT",
322 "functionName" =>
"good",
333 "good('ONE\\'TWO):OUT",
335 "functionName" =>
"good",
345 "good( a simple text ):OUT",
347 "functionName" =>
"good",
350 "name" =>
"a simple text",
360 "functionName" =>
"good",
361 "appName" =>
"MY_APP",
testParseFunctionCall($callName, $expectedStructs)
testParseFunctionCallErrors($callName, $expectedErrors)
if($file) if($subject==""&&$file) if($subject=="") $err