Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_test_dcp_formatcollection.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 
7 namespace Dcp\Pu;
8 /**
9  * @author Anakeen
10  * @package Dcp\Pu
11  */
12 
13 require_once 'PU_testcase_dcp_commonfamily.php';
14 
16 {
17  /**
18  * import TST_FMTCOL
19  * @static
20  * @return string
21  */
22  protected static function getCommonImportFile()
23  {
24  return array(
25  "PU_data_dcp_formatcollection.ods",
26  "PU_data_dcp_documentsformat1.xml",
27  "PU_data_dcp_documentsformat2.xml",
28  "PU_data_dcp_documentsformat3.xml",
29  "PU_data_dcp_documentsformat4.xml",
30  "PU_data_dcp_documentsformat5.xml",
31  "PU_data_dcp_formatcollectionprofil.ods",
32  );
33  }
34 
35  public static function setUpBeforeClass()
36  {
37  parent::setUpBeforeClass();
38  $d1 = new_doc(self::$dbaccess, "TST_FMTCOL1");
39  $d1->state = "E1";
40  $d1->modify();
41  $d1 = new_doc(self::$dbaccess, "TST_FMTCOL2");
42  $d1->state = "E2";
43  $d1->modify();
44  $d1 = new_doc(self::$dbaccess, "TST_FMTCOL3");
45  $d1->state = "E3";
46  $d1->modify();
47  }
48 
49  protected $famName = 'TST_FMTCOL';
50  /**
51  * @dataProvider dataRenderProfilRelationFormatCollection
52  */
53  public function testRenderProfilRelationFormatCollection($login, $docName, $attrName, $expectRender, $expectContainRender = array())
54  {
55  $this->sudo($login);
56 
57  $this->testRenderFormatCollection($docName, $attrName, $expectRender, $expectContainRender);
58  $this->exitSudo();
59  }
60  /**
61  * @dataProvider dataRenderFormatCollection
62  */
63  public function testRenderFormatCollection($docName, $attrName, $expectRender, $expectContainRender = array())
64  {
65  $this->requiresCoreParamEquals('CORE_LANG', 'fr_FR');
66  $s = new \SearchDoc(self::$dbaccess, $this->famName);
67  $s->setObjectReturn();
68  $dl = $s->search()->getDocumentList();
69  $fc = new \FormatCollection();
70  $fc->useCollection($dl);
71  $fc->relationNoAccessText = 'no grant';
72  $fc->addProperty($fc::propName)->addProperty($fc::propUrl);
73 
74  $f = new_doc(self::$dbaccess, $this->famName);
75  $la = $f->getNormalAttributes();
76  foreach ($la as $aid => $oa) {
77  if ($oa->type != "array") $fc->addAttribute($aid);
78  }
79 
80  $r = $fc->render();
81  //print_r2($fc->getDebug());
82  $this->assertEquals($s->count() , count($r) , "render must have same entry count has collection");
83  //print_r(($r));
84  //print_r2(json_encode($r));
85  $fValue = $this->getRenderValue($r, $docName, $attrName);
86  if (is_array($expectRender)) {
87  foreach ($expectRender as $expAttr => $expVal) {
88  if (is_array($expVal)) {
89  $testValue = array();
90  $this->assertTrue(is_array($fValue) , sprintf("result %s not an array for %s", print_r($fValue, true) , $expAttr));
91  foreach ($fValue as $k => $v) {
92  if (is_array($v)) {
93  $testValue[$k] = array();
94  foreach ($v as $vv) {
95  $testValue[$k][] = $vv->$expAttr;
96  }
97  } else {
98  $testValue[$k] = $v->$expAttr;
99  }
100  }
101  } else {
102  $testValue = ($fValue === null) ? null : $fValue->$expAttr;
103  }
104  $this->assertEquals($expVal, $testValue, sprintf("values is : %s %s ", print_r($testValue, true) , json_encode($fValue)));
105  }
106  } else {
107  $this->assertEquals($expectRender, $fValue, sprintf("values is : %s", sprintf(json_encode($fValue))));
108  }
109  foreach ($expectContainRender as $expAttr => $expVal) {
110  $this->assertTrue(preg_match("/$expVal/", $fValue->$expAttr) > 0, sprintf("not match for $expVal. values is : %s", json_encode($fValue)));
111  }
112  }
113  /**
114  * @dataProvider dataUnknowRenderFormatCollection
115  */
116  public function testUnknowRenderFormatCollection($docName, $attrName, $nc)
117  {
118  $s = new \SearchDoc(self::$dbaccess, $this->famName);
119  $s->setObjectReturn();
120  $dl = $s->search()->getDocumentList();
121  $fc = new \FormatCollection();
122  $fc->useCollection($dl);
123  $fc->addProperty($fc::propName);
124  $fc->addAttribute(('tst_x'));
125  $fc->setNc($nc);
126 
127  $r = $fc->render();
128  $this->assertEquals($s->count() , count($r) , "render must have same entry count has collection");
129  /**
130  * @var \UnknowAttributeValue $fValue
131  */
132  $fValue = $this->getRenderValue($r, $docName, $attrName);
133  $this->assertEquals($nc, $fValue->value);
134  }
135  /**
136  * @dataProvider dataStateRenderFormatCollection
137  */
138  public function testStateRenderFormatCollection($docName, $expectState, $expectColor, $expectActivity, $expectDisplayValue)
139  {
140  $s = new \SearchDoc(self::$dbaccess, $this->famName);
141  $s->setObjectReturn();
142  $dl = $s->search()->getDocumentList();
143  $fc = new \FormatCollection();
144  $fc->useCollection($dl);
145  $fc->addProperty($fc::propName)->addProperty($fc::propState);
146 
147  $r = $fc->render();
148  $this->assertEquals($s->count() , count($r) , "render must have same entry count has collection");
149  /**
150  * @var \StatePropertyValue $fstate
151  */
152  $fstate = $this->getRenderProp($r, $docName, $fc::propState);
153  $this->assertEquals($expectState, $fstate->reference, "incorrect state reference");
154  $this->assertEquals($expectColor, $fstate->color, "incorrect state color ");
155  $this->assertEquals($expectActivity, $fstate->activity, "incorrect state activity");
156  $this->assertEquals($expectDisplayValue, $fstate->displayValue, sprintf("incorrect state display value : %s", print_r($fstate, true)));
157  }
158  /**
159  * @dataProvider dataDatePropertyRenderFormatCollection
160  */
161  public function testDatePropertyRenderFormatCollection($docName, $propertyName, $format, $expectedFormat)
162  {
163  $s = new \SearchDoc(self::$dbaccess, $this->famName);
164  $s->setObjectReturn();
165  $dl = $s->search()->getDocumentList();
166  $fc = new \FormatCollection();
167  $fc->useCollection($dl);
168  $fc->addProperty($fc::propName)->addProperty($propertyName);
169  $fc->setDateStyle($format);
170 
171  $r = $fc->render();
172  $this->assertEquals($s->count() , count($r) , "render must have same entry count has collection");
173 
174  $propertyValue = $this->getRenderProp($r, $docName, $propertyName);
175  $this->assertRegExp($expectedFormat, $propertyValue, sprintf("incorrect property (%s) display value : %s", $propertyName, print_r($propertyValue, true)));
176  }
177  /**
178  * @dataProvider dataPropertyRenderFormatCollection
179  */
180  public function testPropertyRenderFormatCollection($docName, $propertyName, $expectedValue)
181  {
182  $s = new \SearchDoc(self::$dbaccess, $this->famName);
183  $s->setObjectReturn();
184  $dl = $s->search()->getDocumentList();
185  $fc = new \FormatCollection();
186  $fc->setPropDateStyle(\DateAttributeValue::isoWTStyle);
187  $fc->useCollection($dl);
188  $fc->addProperty($fc::propName)->addProperty($propertyName);
189 
190  $r = $fc->render();
191  $this->assertEquals($s->count() , count($r) , "render must have same entry count has collection");
192 
193  $propertyValue = $this->getRenderProp($r, $docName, $propertyName);
194  if (is_array($expectedValue)) {
195  foreach ($expectedValue as $infoKey => $expectInfo) {
196 
197  if ($expectInfo[0] === "/") {
198  $this->assertRegExp($expectInfo, (string)$propertyValue[$infoKey], sprintf("incorrect property (%s) display value : %s", $propertyName, print_r($propertyValue, true)));
199  } else {
200  $this->assertEquals($expectInfo, $propertyValue[$infoKey], sprintf("incorrect property (%s) display value : %s", $propertyName, print_r($propertyValue, true)));
201  }
202  }
203  } elseif ($expectedValue[0] === "/") {
204  $this->assertRegExp($expectedValue, $propertyValue, sprintf("incorrect property (%s) display value : %s", $propertyName, print_r($propertyValue, true)));
205  } else {
206  $this->assertEquals($expectedValue, $propertyValue, sprintf("incorrect property (%s) display value : %s", $propertyName, print_r($propertyValue, true)));
207  }
208  }
209  /**
210  * @dataProvider dataRenderAttributeHookFormatCollection
211  */
212  public function testRenderAttributeHookFormatCollection($docName, $attrName, $hook, $expectRender)
213  {
214  $this->requiresCoreParamEquals('CORE_LANG', 'fr_FR');
215  $s = new \SearchDoc(self::$dbaccess, $this->famName);
216  $s->setObjectReturn();
217  $dl = $s->search()->getDocumentList();
218  $fc = new \FormatCollection();
219  $fc->useCollection($dl);
220  $fc->setAttributeRenderHook($hook);
221  $fc->relationNoAccessText = 'no grant';
222  $fc->addProperty($fc::propName)->addProperty($fc::propUrl);
223 
224  $f = new_doc(self::$dbaccess, $this->famName);
225  $la = $f->getNormalAttributes();
226  foreach ($la as $aid => $oa) {
227  if ($oa->type != "array") $fc->addAttribute($aid);
228  }
229 
230  $r = $fc->render();
231  //print_r2($fc->getDebug());
232  $this->assertEquals($s->count() , count($r) , "render must have same entry count has collection");
233  //print_r(($r));
234  //print_r2(json_encode($r));
235  $fValue = $this->getRenderValue($r, $docName, $attrName);
236  if (is_array($expectRender)) {
237  foreach ($expectRender as $expAttr => $expVal) {
238  if (is_array($expVal)) {
239  $testValue = array();
240  $this->assertTrue(is_array($fValue) , sprintf("result %s not an array for %s", print_r($fValue, true) , $expAttr));
241  foreach ($fValue as $k => $v) {
242  if (is_array($v)) {
243  $testValue[$k] = array();
244  foreach ($v as $vv) {
245  $testValue[$k][] = $vv->$expAttr;
246  }
247  } else {
248  $testValue[$k] = $v->$expAttr;
249  }
250  }
251  } else {
252  $testValue = ($fValue === null) ? null : $fValue->$expAttr;
253  }
254  $this->assertEquals($expVal, $testValue, sprintf("values is : %s %s ", print_r($testValue, true) , json_encode($fValue)));
255  }
256  } else {
257  $this->assertEquals($expectRender, $fValue, sprintf("values is : %s", sprintf(json_encode($fValue))));
258  }
259  }
260  /**
261  * @dataProvider dataPropertyHookRenderFormatCollection
262  */
263  public function testPropertyHookRenderFormatCollection($docName, $propertyName, $hook, $expectedValue)
264  {
265  $s = new \SearchDoc(self::$dbaccess, $this->famName);
266  $s->setObjectReturn();
267  $dl = $s->search()->getDocumentList();
268 
269  $fc = new \FormatCollection();
270  $fc->useCollection($dl);
271  $fc->setPropertyRenderHook($hook);
272  $fc->addProperty($fc::propName)->addProperty($propertyName);
273 
274  $r = $fc->render();
275  $this->assertEquals($s->count() , count($r) , "render must have same entry count has collection");
276 
277  $propertyValue = $this->getRenderProp($r, $docName, $propertyName);
278  $this->assertEquals($expectedValue, $propertyValue, sprintf("incorrect property (%s) value : %s", $propertyName, print_r($propertyValue, true)));
279  }
280  /**
281  * @dataProvider dataDocumentHookRenderFormatCollection
282  */
283  public function testDocumentHookRenderFormatCollection($docName, $hook, array $expectedProps)
284  {
285  $s = new \SearchDoc(self::$dbaccess, $this->famName);
286  $s->setObjectReturn();
287  $dl = $s->search()->getDocumentList();
288 
289  $fc = new \FormatCollection();
290  $fc->useCollection($dl);
291  $fc->setDocumentRenderHook($hook);
292  $fc->addProperty($fc::propName)->addProperty("revision");
293 
294  $r = $fc->render();
295  $this->assertEquals($s->count() , count($r) , "render must have same entry count has collection");
296 
297  foreach ($expectedProps as $propKey => $propValue) {
298  $propertyValue = $this->getRenderProp($r, $docName, $propKey);
299  $this->assertEquals($propValue, $propertyValue, sprintf("incorrect property (%s) value : %s", $propKey, print_r($propertyValue, true)));
300  }
301  }
302  private function getRenderValue(array $r, $docName, $attrName)
303  {
304  foreach ($r as $format) {
305  if ($format["properties"]["name"] == $docName) {
306  return $format["attributes"][$attrName];
307  }
308  }
309  return null;
310  }
311 
312  private function getRenderProp(array $r, $docName, $attrName)
313  {
314  foreach ($r as $format) {
315  if ($format["properties"]["name"] == $docName) {
316  return $format["properties"][$attrName];
317  }
318  }
319  return null;
320  }
322  {
323  return array(
324  array(
325  "TST_FMTCOL1",
326  "revision",
327  0
328  ) ,
329  array(
330  "TST_FMTCOL1",
331  "name",
332  "TST_FMTCOL1"
333  ) ,
334  array(
335  "TST_FMTCOL1",
336  "revdate",
337  '/^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/'
338  ) ,
339  array(
340  "TST_FMTCOL1",
341  "cdate",
342  '/^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/'
343  ) ,
344  array(
345  "TST_FMTCOL1",
346  \formatCollection::propFamily,
347  array(
348  "name" => $this->famName,
349  "title" => "Test Format",
350  "id" => '/^[0-9]+$/',
351  "icon" => "/resizeimg.php/"
352  )
353  ) ,
354  array(
355  "TST_FMTCOL1",
356  \formatCollection::propRevisionData,
357  array(
358  "id" => '/^[0-9]+$/',
359  "number" => 0
360  )
361  ) ,
362  array(
363  "TST_FMTCOL1",
364  \formatCollection::propSecurity,
365  array(
366  "readOnly" => false
367  )
368  ) ,
369  array(
370  "TST_FMTCOL1",
371  \formatCollection::propType,
372  "document"
373  ) ,
374  array(
375  "TST_FMTCOL1",
376  \formatCollection::propUsage,
377  "normal"
378  ) ,
379  array(
380  "TST_FMTCOL1",
381  \formatCollection::propNote,
382  array(
383  "id" => 0
384  )
385  ) ,
386  array(
387  "TST_FMTCOL1",
388  \formatCollection::propViewController,
389  array(
390  "id" => 0
391  )
392  ) ,
393  array(
394  "TST_FMTCOL1",
395  \formatCollection::propAffected,
396  array(
397  "id" => 0
398  )
399  ) ,
400  array(
401  "TST_FMTCOL1",
402  \formatCollection::propWorkflow,
403  array(
404  "title" => "Cycle format",
405  "id" => '/^[0-9]+$/',
406  "icon" => "/resizeimg.php/"
407  )
408  ) ,
409  array(
410  "TST_FMTCOL1",
411  \formatCollection::propCreationDate,
412  '/^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/'
413  ) ,
414  array(
415  "TST_FMTCOL1",
416  \formatCollection::propLastModificationDate,
417  '/^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/'
418  ) ,
419  array(
420  "TST_FMTCOL1",
421  \formatCollection::propLastAccessDate,
422  '/^(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/'
423  )
424  );
425  }
426  public function dataDocumentHookRenderFormatCollection()
427  {
428  return array(
429  array(
430  "TST_FMTCOL1",
431  function ($info, $doc)
432  {
433  /**
434  * @var \Doc $doc
435  */
436  $info["properties"]["revision"].= ' (bis)';
437  $info["properties"]["hello"] = 'world - ' . $doc->name;
438  return $info;
439  }
440  ,
441  array(
442  "revision" => '0 (bis)',
443  "hello" => "world - TST_FMTCOL1"
444  )
445  )
446  );
447  }
449  {
450  return array(
451  array(
452  "TST_FMTCOL1",
453  "revision",
454  function ($info, $propId)
455  {
456  if ($propId === "revision") {
457  $info.= " (bis)";
458  }
459  return $info;
460  }
461  ,
462  '0 (bis)'
463  ) ,
464  array(
465  "TST_FMTCOL1",
466  "doctype",
467  function ($info, $propId)
468  {
469  if ($propId === "doctype") {
470  if ($info === "F") {
471  $info = "document";
472  }
473  }
474  return $info;
475  }
476  ,
477  "document"
478  ) ,
479  );
480  }
482  {
483 
484  return array(
485  array(
486  "TST_FMTCOL1",
487  "tst_x",
488  "act"
489  ) ,
490  array(
491  "TST_FMTCOL2",
492  "tst_x",
493  ""
494  )
495  );
496  }
497 
499  {
500 
501  return array(
502  array(
503  "TST_FMTCOL1",
504  "tst_title",
505  function ($info)
506  {
507  if ($info) {
508  if (!is_array($info)) {
509  $info->value.= " (bis)";
510  $info->displayValue.= " (ter)";
511  }
512  }
513  return $info;
514  }
515  ,
516  array(
517  "value" => "Test 1 (bis)",
518  "displayValue" => "Test 1 (ter)"
519  )
520  ) ,
521  array(
522  "TST_FMTCOL2",
523  "tst_doubles",
524  function ($info, $oa)
525  {
526  if ($info) {
527 
528  if ($oa->id === "tst_doubles") {
529  foreach ($info as & $oneInfo) {
530  $oneInfo->value+= 10;
531  }
532  }
533  }
534  return $info;
535  }
536  ,
537  array(
538  "value" => array(
539  56.67 + 10,
540  88.0 + 10,
541  3.1415926535 + 10
542  ) ,
543  "displayValue" => array(
544  "56,67",
545  "88",
546  "3,1415926535"
547  )
548  )
549  )
550  );
551  }
553  {
554  return array(
555  array(
556  "TST_FMTCOL1",
557  "adate",
559  '/^(\d\d)\/(\d\d)\/(\d\d\d\d)\s?(\d\d)?:?(\d\d)?:?(\d\d)?/'
560  ) ,
561  array(
562  "TST_FMTCOL1",
563  "adate",
565  '/^(\d\d\d\d)-(\d\d)-(\d\d)\s?(\d\d)?:?(\d\d)?:?(\d\d)?/'
566  ) ,
567  array(
568  "TST_FMTCOL1",
569  "adate",
571  '/^(\d\d\d\d)-(\d\d)-(\d\d)T?(\d\d)?:?(\d\d)?:?(\d\d)?/'
572  ) ,
573  array(
574  "TST_FMTCOL2",
575  "cdate",
577  '/^(\d\d)\/(\d\d)\/(\d\d\d\d)\s?(\d\d)?:?(\d\d)?:?(\d\d)?/'
578  ) ,
579  array(
580  "TST_FMTCOL2",
581  "cdate",
583  '/^(\d\d\d\d)-(\d\d)-(\d\d)\s?(\d\d)?:?(\d\d)?:?(\d\d)?/'
584  ) ,
585  array(
586  "TST_FMTCOL2",
587  "cdate",
589  '/^(\d\d\d\d)-(\d\d)-(\d\d)T?(\d\d)?:?(\d\d)?:?(\d\d)?/'
590  ) ,
591  array(
592  "TST_FMTCOL3",
593  "revdate",
595  '/^(\d\d)\/(\d\d)\/(\d\d\d\d)\s?(\d\d)?:?(\d\d)?:?(\d\d)?/'
596  ) ,
597  array(
598  "TST_FMTCOL3",
599  "revdate",
601  '/^(\d\d\d\d)-(\d\d)-(\d\d)\s?(\d\d)?:?(\d\d)?:?(\d\d)?/'
602  ) ,
603  array(
604  "TST_FMTCOL3",
605  "revdate",
607  '/^(\d\d\d\d)-(\d\d)-(\d\d)T?(\d\d)?:?(\d\d)?:?(\d\d)?/'
608  )
609  );
610  }
611 
613  {
614 
615  return array(
616  array(
617  "TST_FMTCOL1",
618  "E1",
619  "#7DFF63",
620  "Activity E1",
621  "Activity E1"
622  ) ,
623  array(
624  "TST_FMTCOL2",
625  "E2",
626  "#8CFFDD",
627  "Activity E2",
628  "Activity E2"
629  ) ,
630 
631  array(
632  "TST_FMTCOL3",
633  "E3",
634  "#BC8FFF",
635  "",
636  "E3"
637  )
638  );
639  }
640 
641  public function dataRenderFormatCollection()
642  {
643 
644  return array(
645  array(
646  "TST_FMTCOL1",
647  "tst_title",
648  array(
649  "value" => "Test 1",
650  "displayValue" => "Test 1"
651  )
652  ) ,
653  array(
654  "TST_FMTCOL1",
655  "tst_enum",
656  array(
657  "value" => "1",
658  "displayValue" => "Un"
659  )
660  ) ,
661  array(
662  "TST_FMTCOL2",
663  "tst_double",
664  array(
665  "value" => "23.4567",
666  "displayValue" => "23,46"
667  ) ,
668  ) ,
669  array(
670  "TST_FMTCOL3",
671  "tst_int",
672  null
673  ) ,
674  array(
675  "TST_FMTCOL3",
676  "tst_double",
677  null
678  ) ,
679  array(
680  "TST_FMTCOL2",
681  "tst_rellatest",
682  array(
683  "displayValue" => "Test 1",
684  "familyRelation" => "TST_FMTCOL"
685  ) ,
686  array(
687  "value" => "^[0-9]+$",
688  "url" => "latest=Y"
689  )
690  ) ,
691 
692  array(
693  "TST_FMTCOL4",
694  "tst_rellatest",
695  array(
696  "displayValue" => "Test 3",
697  "familyRelation" => "TST_FMTCOL"
698  ) ,
699  array(
700  "value" => "^[0-9]+$",
701  "url" => "latest=Y"
702  )
703  ) ,
704  array(
705  "TST_FMTCOL2",
706  "tst_title",
707  array(
708  "value" => "Test 2",
709  "displayValue" => "Test 2"
710  )
711  ) ,
712  array(
713  "TST_FMTCOL2",
714  "tst_color",
715  array(
716  "value" => "#52D7FF",
717  "displayValue" => "#52D7FF"
718  )
719  ) ,
720  array(
721  "TST_FMTCOL2",
722  "tst_enum",
723  array(
724  "value" => "2",
725  "displayValue" => "Deux"
726  )
727  ) ,
728  array(
729  "TST_FMTCOL2",
730  "tst_time",
731  array(
732  "value" => "12:20:00"
733  )
734  ) ,
735  array(
736  "TST_FMTCOL2",
737  "tst_text",
738  array(
739  "value" => "Cassoulet",
740  "displayValue" => "before Cassoulet"
741  )
742  ) ,
743  array(
744  "TST_FMTCOL2",
745  "tst_int",
746  array(
747  "value" => "101",
748  "displayValue" => "101"
749  )
750  ) ,
751  array(
752  "TST_FMTCOL1",
753  "tst_int",
754  array(
755  "value" => "0",
756  "displayValue" => "0"
757  )
758  ) ,
759  array(
760  "TST_FMTCOL1",
761  "tst_double",
762  array(
763  "value" => "0",
764  "displayValue" => "0,00"
765  )
766  ) ,
767  array(
768  "TST_FMTCOL2",
769  "tst_ts",
770  array(
771  "value" => "2012-06-13 11:27:00"
772  )
773  ) ,
774  array(
775  "TST_FMTCOL2",
776  "tst_date",
777  array(
778  "value" => "2012-06-13"
779  )
780  ) ,
781  array(
782  "TST_FMTCOL2",
783  "tst_enums",
784  array(
785  "value" => array(
786  1,
787  2,
788  3
789  ) ,
790  "displayValue" => array(
791  "Un",
792  "Deux",
793  "Trois"
794  )
795  )
796  ) ,
797  array(
798  "TST_FMTCOL2",
799  "tst_doubles",
800  array(
801  "value" => array(
802  56.67,
803  88.0,
804  3.1415926535
805  ) ,
806  "displayValue" => array(
807  "56,67",
808  "88",
809  "3,1415926535"
810  )
811  )
812  ) ,
813  array(
814  "TST_FMTCOL2",
815  "tst_ints",
816  array(
817  "value" => array(
818  0,
819  12,
820  null
821  ) ,
822  "displayValue" => array(
823  "0",
824  "12",
825  ""
826  )
827  )
828  ) ,
829  array(
830  "TST_FMTCOL2",
831  "tst_relmuls",
832  array(
833  "displayValue" => array(
834  array(
835  "Test 1"
836  ) ,
837  array(
838  "Test 1"
839  ) ,
840  array(
841  "Test 1"
842  )
843  ) ,
844  )
845  ) ,
846 
847  array(
848  "TST_FMTCOL3",
849  "tst_relmuls",
850  array(
851  "displayValue" => array(
852  array(
853  "Test 1"
854  ) ,
855  array(
856  "Test 1",
857  "Test 2"
858  ) ,
859  array(
860  "Test 2",
861  "Test 1"
862  ) ,
863  array()
864  ) ,
865  )
866  ) ,
867  array(
868  "TST_FMTCOL2",
869  "tst_file",
870  array(
871  "size" => 5,
872  "mime" => "text/plain",
873  "fileName" => "Test.txt"
874  )
875  ) ,
876  array(
877  "TST_FMTCOL5",
878  "tst_rellatests",
879  array(
880  "url" => array(
881  ""
882  ) ,
883  "icon" => array(
884  ""
885  ) ,
886  "value" => array(
887  ""
888  ) ,
889  "displayValue" => array(
890  null
891  )
892  )
893  )
894  );
895  }
896 
898  {
899  return array(
900  array(
901  "tstLoginFmtU1",
902  "TST_FMTCOL1",
903  "tst_title",
904  array(
905  "value" => "Test 1",
906  "displayValue" => "Test 1"
907  )
908  ) ,
909  array(
910  "tstLoginFmtU1",
911  "TST_FMTCOL2",
912  "tst_rellatest",
913  array(
914  "displayValue" => "Test 1",
915  "familyRelation" => "TST_FMTCOL"
916  ) ,
917  array(
918  "value" => "^[0-9]+$",
919  "url" => "latest=Y"
920  )
921  ) ,
922 
923  array(
924  "tstLoginFmtU1",
925  "TST_FMTCOL4",
926  "tst_rellatest",
927  array(
928  "displayValue" => "Test 3",
929  "familyRelation" => "TST_FMTCOL"
930  ) ,
931  array(
932  "value" => "^[0-9]+$",
933  "url" => "latest=Y"
934  )
935  ) ,
936 
937  array(
938  "tstLoginFmtU2",
939  "TST_FMTCOL4",
940  "tst_rellatest",
941  array(
942  "displayValue" => "no grant",
943  "familyRelation" => "TST_FMTCOL"
944  ) ,
945  array(
946  "value" => "^[0-9]+$",
947  "url" => ""
948  )
949  ) ,
950 
951  array(
952  "tstLoginFmtU1",
953  "TST_FMTCOL2",
954  "tst_relmuls",
955  array(
956  "displayValue" => array(
957  array(
958  "Test 1"
959  ) ,
960  array(
961  "Test 1"
962  ) ,
963  array(
964  "Test 1"
965  )
966  ) ,
967  )
968  ) ,
969 
970  array(
971  "tstLoginFmtU2",
972  "TST_FMTCOL4",
973  "tst_relmuls",
974  array(
975  "displayValue" => array(
976  array(
977  "Test 1"
978  ) ,
979  array(
980  "Test 1",
981  "Test 2",
982  "no grant"
983  ) ,
984  array(
985  "Test 2",
986  "Test 1"
987  ) ,
988  array()
989  ) ,
990  )
991  ) ,
992 
993  array(
994  "tstLoginFmtU1",
995  "TST_FMTCOL3",
996  "tst_relmuls",
997  array(
998  "displayValue" => array(
999  array(
1000  "Test 1"
1001  ) ,
1002  array(
1003  "Test 1",
1004  "Test 2"
1005  ) ,
1006  array(
1007  "Test 2",
1008  "Test 1"
1009  ) ,
1010  array()
1011  ) ,
1012  )
1013  )
1014  );
1015  }
1016 }
1017 ?>
static sudo($login)
testDocumentHookRenderFormatCollection($docName, $hook, array $expectedProps)
if($famId) $s
testDatePropertyRenderFormatCollection($docName, $propertyName, $format, $expectedFormat)
testRenderFormatCollection($docName, $attrName, $expectRender, $expectContainRender=array())
testPropertyHookRenderFormatCollection($docName, $propertyName, $hook, $expectedValue)
$d1
Definition: dav.php:11
testRenderProfilRelationFormatCollection($login, $docName, $attrName, $expectRender, $expectContainRender=array())
testPropertyRenderFormatCollection($docName, $propertyName, $expectedValue)
$login
Definition: dav.php:40
$dbaccess
Definition: checkVault.php:17
$info
Definition: geticon.php:30
testRenderAttributeHookFormatCollection($docName, $attrName, $hook, $expectRender)
requiresCoreParamEquals($paramName, $requiredValue, $markTestIncomplete=true)
← centre documentaire © anakeen