13 require_once
'PU_testcase_dcp_commonfamily.php';
24 return "PU_data_dcp_familydefault.ods";
35 $this->assertTrue(is_object(
$d) , sprintf(
"cannot create %s document",
$famid));
37 $oa =
$d->getAttribute($attrid);
38 $this->assertNotEmpty($oa, sprintf(
"attribute %s not found in %s family", $attrid,
$famid));
40 $this->assertEquals($expectedvalue,
$value, sprintf(
"not the expected default value attribute %s", $attrid));
50 $this->assertTrue(is_object(
$d) , sprintf(
"cannot create %s1 document",
$famid));
52 $oa =
$d->getAttribute($attrid);
53 $this->assertNotEmpty($oa, sprintf(
"attribute %s not found in %s family", $attrid,
$famid));
54 $value =
$d->getFamilyParameterValue($oa->id);
55 $this->assertEquals($expectedvalue,
$value, sprintf(
"not the expected default value attribute %s", $attrid));
63 $this->assertTrue(is_object(
$d) , sprintf(
"cannot create %s document",
$famid));
65 foreach ($expectedvalues as $attrid => $expectedValue) {
66 $oa =
$d->getAttribute($attrid);
67 $this->assertNotEmpty($oa, sprintf(
"attribute %s not found in %s family", $attrid,
$famid));
70 $this->assertEquals($expectedValue,
$value, sprintf(
"not the expected default value attribute %s", $attrid));
72 foreach ($expectedParams as $attrid => $expectedValue) {
73 $oa =
$d->getAttribute($attrid);
74 $this->assertNotEmpty($oa, sprintf(
"parameter %s not found in %s family", $attrid,
$famid));
75 $value =
$d->getFamilyParameterValue($oa->id);
76 $this->assertEquals($expectedValue,
$value, sprintf(
"not the expected default value parameter %s", $attrid));
82 public function testDefaultInherited(
$famid, array $expectedvalues, array $expectedParams)
88 $this->assertTrue(is_object(
$d) , sprintf(
"cannot get %s family",
$famid));
90 foreach ($expectedvalues as $attrid => $expectedValue) {
93 $this->assertEquals($expectedValue,
$value, sprintf(
"not the expected default value attribute %s has %s", $attrid,
$d->defval));
95 foreach ($expectedParams as $attrid => $expectedValue) {
97 $value =
$d->getParameterRawValue($attrid);
98 $this->assertEquals($expectedValue,
$value, sprintf(
"not the expected default value parameter %s", $attrid));
104 public function testFamilyParamvalueInheritedWithDefaultArg(
$famid, $default, array $expectedParams)
110 $this->assertTrue(is_object(
$d) , sprintf(
"cannot get %s family",
$famid));
112 foreach ($expectedParams as $attrid => $expectedValue) {
114 $value =
$d->getParameterRawValue($attrid, $default);
115 $this->assertEquals($expectedValue,
$value, sprintf(
"not the expected default value parameter %s", $attrid));
124 $this->assertTrue(is_object(
$d) , sprintf(
"cannot create %s1 document",
$famid));
126 foreach ($expectedParams as $attrid => $expectedvalue) {
127 $value =
$d->getFamilyParameterValue($attrid, $default);
128 $this->assertEquals($expectedvalue,
$value, sprintf(
"not the expected default value attribute %s", $attrid));
139 $this->assertNotEmpty(
$err, sprintf(
" no error returned, must have %s", $errorCode));
142 $err = $e->getDcpCode();
143 $this->assertEquals($errorCode,
$err, sprintf(
"not the good error code : %s", $e->getMessage()));
152 $value =
$d->getFamilyParameterValue($attrid);
153 $f =
$d->getFamilyDocument();
154 $this->assertEquals($expectedValue,
$value, sprintf(
"parameter %s has not correct initial value, family has \"%s\"", $attrid, $f->param . $f->getParameterRawValue($attrid)));
155 $err = $f->setParam($attrid,
'');
156 $this->assertEmpty(
$err,
"parameter set error : $err");
159 $f =
$d2->getFamilyDocument();
160 $value =
$d2->getFamilyParameterValue($attrid);
161 $this->assertEquals($expectedDefaultValue,
$value, sprintf(
"parameter %s has not correct default value , family has \"%s\"", $attrid, $f->getParameterRawValue($attrid)));
168 "TST_DEFAULTFAMILY2",
174 "TST_DEFAULTFAMILY2",
180 "TST_DEFAULTFAMILY3",
192 "TST_DEFAULTFAMILY2",
195 'TST_P1' =>
'PFirst',
197 "TST_P3" =>
"::oneMore(TST_P2)",
209 "TST_DEFAULTFAMILY2",
213 'TST_P1' =>
'PFirst',
222 "TST_DEFAULTFAMILY4",
226 'TST_P1' =>
'PThird',
241 "TST_DEFAULTFAMILY7",
245 "TST_DEFAULTFAMILY8",
249 "TST_DEFAULTFAMILY9",
259 "TST_DEFAULTFAMILY2",
261 "TST_TITLE" =>
"First",
262 "TST_NUMBER1" =>
"::isOne()",
263 "TST_NUMBER2" =>
"::oneMore(TST_NUMBER1)",
264 "TST_NUMBER3" =>
"::oneMore(2)"
267 'TST_P1' =>
'PFirst',
269 "TST_P3" =>
"::oneMore(TST_P2)"
273 "TST_DEFAULTFAMILY3",
275 "TST_TITLE" =>
"Second",
276 "TST_NUMBER1" =>
"::isOne()",
277 "TST_NUMBER2" =>
"::simpleAdd(12,TST_NUMBER1)",
278 "TST_NUMBER3" =>
"::oneMore(2)"
281 'TST_P1' =>
'PSecond',
283 "TST_P3" =>
"::oneMore(TST_P2)"
287 "TST_DEFAULTFAMILY4",
289 "TST_TITLE" =>
"Third",
290 "TST_NUMBER1" =>
"::isOne()",
291 "TST_NUMBER2" =>
"::oneMore(TST_NUMBER1)",
295 'TST_P1' =>
'PThird',
297 "TST_P3" =>
"::oneMore(TST_P2)"
307 "TST_DEFAULTFAMILY2",
309 "TST_TITLE" =>
"First",
310 "TST_NUMBER1" =>
"1",
311 "TST_NUMBER2" =>
"2",
315 'TST_P1' =>
'PFirst',
323 "TST_DEFAULTFAMILY3",
325 "TST_TITLE" =>
'Second',
326 "TST_NUMBER1" =>
"1",
327 "TST_NUMBER2" =>
"13",
331 "TST_P1" =>
'PSecond',
339 "TST_DEFAULTFAMILY4",
341 "TST_TITLE" =>
'Third',
342 "TST_NUMBER1" =>
"1",
343 "TST_NUMBER2" =>
"2",
347 "TST_P1" =>
'PThird',
361 "TST_DEFAULTFAMILY1",
366 "TST_DEFAULTFAMILY1",
371 "TST_DEFAULTFAMILY1",
376 "TST_DEFAULTFAMILY1",
381 "TST_DEFAULTFAMILY1",
386 "TST_DEFAULTFAMILY1",
391 "TST_DEFAULTFAMILY1",
396 "TST_DEFAULTFAMILY1",
402 "TST_DEFAULTFAMILY1",
408 "TST_DEFAULTFAMILY1",
413 "TST_DEFAULTFAMILY1",
418 "TST_DEFAULTFAMILY1",
423 "TST_DEFAULTFAMILY1",
428 "TST_DEFAULTFAMILY1",
430 'TST_TITLE,TST_TITLE'
433 "TST_DEFAULTFAMILY1",
435 'it is,simple word,testing'
438 "TST_DEFAULTFAMILY1",
440 'it\'s,a "citation",and "second"'
443 "TST_DEFAULTFAMILY1",
448 "TST_DEFAULTFAMILY1",
453 "TST_DEFAULTFAMILY5",
458 "TST_DEFAULTFAMILY5",
463 "TST_DEFAULTFAMILY5",
468 "TST_DEFAULTFAMILY5",
473 "TST_DEFAULTFAMILY5",
478 "TST_DEFAULTFAMILY6",
483 "TST_DEFAULTFAMILY6",
488 "TST_DEFAULTFAMILY6",
493 "TST_DEFAULTFAMILY6",
498 "TST_DEFAULTFAMILYNAMESPACE",
509 "TST_DEFAULTFAMILY1",
514 "TST_DEFAULTFAMILY1",
519 "TST_DEFAULTFAMILY1",
524 "TST_DEFAULTFAMILY1",
529 "TST_DEFAULTFAMILY1",
534 "TST_DEFAULTFAMILY1",
539 "TST_DEFAULTFAMILY1",
544 "TST_DEFAULTFAMILYNAMESPACE",
testDefaultParamValue($famid, $attrid, $expectedvalue)
testDocParamvalueInheritedWithDefaultArg($famid, $default, array $expectedParams)
dataDefaultInheritedValues()
testInitialParam($famid, $attrid, $expectedValue, $expectedDefaultValue)
dataDefaultInheritedWithDefaultArg()
static getCommonImportFile()
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
new_Doc($dbaccess, $id= '', $latest=false)
dataDocParamvalueInheritedWithDefaultArg()
testDefaultInheritedValue($famid, array $expectedvalues, array $expectedParams)
if($file) if($subject==""&&$file) if($subject=="") $err
testWrongValue($famid, $errorCode)
testDefaultValue($famid, $attrid, $expectedvalue)