Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_test_dcp_typedvalue.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 
7 namespace Dcp\Pu;
8 
10 /**
11  * @author Anakeen
12  * @package Dcp\Pu
13  */
14 require_once 'PU_testcase_dcp_commonfamily.php';
15 
17 {
18  public $famName = "TST_FAMGETTYPEDVALUE";
19  /**
20  * import TST_FAMSETVALUE family
21  * @static
22  * @return string
23  */
24  protected static function getCommonImportFile()
25  {
26  return "PU_data_dcp_gettypedvaluefamily.ods";
27  }
28  /**
29  * @dataProvider dataGetAttributeValue
30  */
31  public function testGetAttributeValue($docName, array $expectedValues)
32  {
33  $d = new_doc(self::$dbaccess, $docName);
34  $this->assertTrue($d->isAlive() , sprintf("cannot access %s document", $docName));
35  foreach ($expectedValues as $attrid => $expectedValue) {
36  $value = $d->getAttributeValue($attrid);
37  $this->assertTrue($expectedValue === $value, sprintf('wrong value "%s" : expected %s, has %s', $attrid, $this->getDump($expectedValue) , $this->getDump($value, true)));
38  }
39  }
40  /**
41  * @dataProvider dataErrorGetAttributeValue
42  */
43  public function testErrorGetAttributeValue($docName, $attrid, $expectedErrorCode)
44  {
45  $d = new_doc(self::$dbaccess, $docName);
46  $this->assertTrue($d->isAlive() , sprintf("cannot access %s document", $docName));
47  try {
48  $d->getAttributeValue($attrid);
49  }
50  catch(\Dcp\Exception $e) {
51  $this->assertEquals($expectedErrorCode, $e->getDcpCode() , sprintf('"not correct code: %s"', $e->getMessage()));
52  }
53  }
54  /**
55  * @dataProvider dataErrorSetAttributeValue
56  */
57  public function testErrorSetAttributeValue($docName, $attrid, $value, $expectedErrorCode)
58  {
59  $d = new_doc(self::$dbaccess, $docName);
60  $this->assertTrue($d->isAlive() , sprintf("cannot access %s document", $docName));
61  try {
62  $d->setAttributeValue($attrid, $value);
63  $this->assertTrue(false, "no error detected need $expectedErrorCode");
64  }
65  catch(\Dcp\Exception $e) {
66  $this->assertEquals($expectedErrorCode, $e->getDcpCode() , sprintf('"not correct code : %s"', $e->getMessage()));
67  $this->log($e->getMessage());
68  }
69  }
70  /**
71  * @dataProvider dataGetRelationValues
72  */
73  public function testGetRelationValues($docName, array $expectedValues)
74  {
75  $d = new_doc(self::$dbaccess, $docName);
76  $this->assertTrue($d->isAlive() , sprintf("cannot access %s document", $docName));
77  foreach ($expectedValues as $attrid => $expectedValue) {
78  $value = $d->getAttributeValue($attrid);
79  // convert docName to docId
80  $expectedDocId = $this->docNames2docIds($expectedValue);
81  $this->assertTrue($expectedDocId === $value, sprintf('wrong value "%s" : expected %s, has %s \nRaw is :"%s"', $attrid, $this->getDump($expectedDocId) , $this->getDump($value, true) , $d->getRawValue($attrid)));
82  }
83  }
84  /**
85  * @dataProvider dataGetDateValues
86  */
87  public function testGetDateValues($docName, array $expectedValues)
88  {
89  $d = new_doc(self::$dbaccess, $docName);
90  $this->assertTrue($d->isAlive() , sprintf("cannot access %s document", $docName));
91  foreach ($expectedValues as $attrid => $expectedValue) {
92  $value = $d->getAttributeValue($attrid);
93  $stringDates = array();
94  $oa = $d->getAttribute($attrid);
95  switch ($oa->type) {
96  case 'date':
97  $stringDates = $this->date2string($value, 'Y-m-d');
98  break;
99 
100  case 'timestamp':
101  $stringDates = $this->date2string($value, 'Y-m-d\TH:i:s');
102  break;
103  }
104  // convert docName to docId
105  $this->assertTrue($stringDates === $expectedValue, sprintf('wrong value "%s" : expected %s, has %s \nRaw is :"%s"', $attrid, $this->getDump($expectedValue, true) , $this->getDump($stringDates) , $d->getRawValue($attrid)));
106  }
107  }
108  /**
109  * @dataProvider dataSetRelationValues
110  */
111  public function testSetRelationValues($docName, array $expectedValues)
112  {
113  $d = new_doc(self::$dbaccess, $docName);
114  $this->assertTrue($d->isAlive() , sprintf("cannot access %s document", $docName));
115  foreach ($expectedValues as $attrid => $newValue) {
116  $d->setAttributeValue($attrid, $newValue);
117  }
118  foreach ($expectedValues as $attrid => $expectedValue) {
119  $value = $d->getAttributeValue($attrid);
120  // convert docName to docId
121  $expectedDocId = $this->docNames2docIds($expectedValue);
122 
123  $this->assertTrue($expectedDocId === $value, sprintf('wrong value "%s" : expected %s, has %s \nRaw is :"%s"', $attrid, $this->getDump($expectedDocId) , $this->getDump($value, true) , $d->getRawValue($attrid)));
124  }
125  }
126  /**
127  * @dataProvider dataSetAndGetValues
128  */
129  public function testSetGetValues($docName, array $setValues, array $expectedValues)
130  {
131  $d = new_doc(self::$dbaccess, $docName);
132  $this->assertTrue($d->isAlive() , sprintf("cannot access %s document", $docName));
133  foreach ($setValues as $attrid => $newValue) {
134  $d->setAttributeValue($attrid, $newValue);
135  }
136  $d->store(); // verify database record
137  foreach ($expectedValues as $attrid => $expectedValue) {
138  $oriValue = $value = $d->getAttributeValue($attrid);
139 
140  $oa = $d->getAttribute($attrid);
141  switch ($oa->type) {
142  case 'date':
143  $value = $this->date2string($value, 'Y-m-d');
144  break;
145 
146  case 'timestamp':
147  $value = $this->date2string($value, 'Y-m-d\TH:i:s');
148  break;
149  }
150 
151  $this->assertTrue($expectedValue === $value, sprintf('wrong value "%s" : expected %s, has %s \nRaw is :"%s"', $attrid, $this->getDump($expectedValue) , $this->getDump($value, true) , $this->getDump($oriValue)));
152  }
153  }
154 
155  private function date2string($dates, $format)
156  {
157  if (is_array($dates)) {
158  $stringDate = array();
159  /**
160  * @var \DateTime $aDate
161  */
162  foreach ($dates as $aDate) {
163  if (is_array($aDate)) {
164  $Datess = array();
165  /**
166  * @var \DateTime $dates2
167  */
168  foreach ($aDate as $dates2) {
169  $Datess[] = $dates2 ? $dates2->format($format) : null;
170  }
171  $stringDate[] = $Datess;
172  } else {
173  $stringDate[] = $aDate ? $aDate->format($format) : null;
174  }
175  }
176  } else {
177  /**
178  * @var \DateTime $dates
179  */
180  $stringDate = $dates ? $dates->format($format) : null;
181  }
182  return $stringDate;
183  }
184 
185  private function docNames2docIds($docNames)
186  {
187  if (is_array($docNames)) {
188  $expectedDocId = array();
189  foreach ($docNames as $docName) {
190  if (is_array($docName)) {
191  $expectDocId2 = array();
192  foreach ($docName as $docName2) {
193  $expectDocId2[] = $docName2 ? getIdFromName(self::$dbaccess, $docName2) : null;
194  }
195  $expectedDocId[] = $expectDocId2;
196  } else {
197  $expectedDocId[] = $docName ? getIdFromName(self::$dbaccess, $docName) : null;
198  }
199  }
200  } else {
201  $expectedDocId = $docNames ? getIdFromName(self::$dbaccess, $docNames) : null;
202  }
203  return $expectedDocId;
204  }
205 
206  private function getDump($o)
207  {
208  ob_start();
209  var_dump($o);
210  return ob_get_clean();
211  }
212  /**
213  * @dataProvider dataSetAttributeValue
214  */
215  public function testCreateSetAttributeValue(array $expectedValues)
216  {
217  $d = createDoc(self::$dbaccess, $this->famName);
218  $this->assertTrue(is_object($d) , sprintf("cannot create %s document", $this->famName));
219  foreach ($expectedValues as $attrid => $value) {
220  $d->setAttributeValue($attrid, $value);
221  }
222 
223  foreach ($expectedValues as $attrid => $expectedValue) {
224  $value = $d->getAttributeValue($attrid);
225  $this->assertTrue($expectedValue === $value, sprintf('wrong value "%s" : expected %s, has %s', $attrid, $this->getDump($expectedValue) , $this->getDump($value, true)));
226  }
227  }
228  /**
229  * @dataProvider dataModifyAttributeValue
230  */
231  public function testModifySetAttributeValue($docName, array $expectedValues)
232  {
233 
234  $d = new_doc(self::$dbaccess, $docName);
235  $this->assertTrue($d->isAlive() , sprintf("cannot access %s document", $docName));
236  foreach ($expectedValues as $attrid => $value) {
237  $d->setAttributeValue($attrid, $value);
238  }
239  $d->store(); // verify database record
240  foreach ($expectedValues as $attrid => $expectedValue) {
241  $value = $d->getAttributeValue($attrid);
242  $this->assertTrue($expectedValue === $value, sprintf('wrong value "%s" : expected %s, has %s', $attrid, $this->getDump($expectedValue) , $this->getDump($value, true)));
243  }
244  }
245 
246  public function dataSetAndGetValues()
247  {
248  return array(
249  array(
250  'TST_DOCTYPE1',
251  "set" => array(
252  "tst_date" => '2013-04-21',
253  "tst_time" => '10:00',
254  "tst_int" => "23",
255  "tst_double" => "24",
256  "tst_timestamp" => '2013-09-30T10:00:00',
257  "tst_dates" => array(
258  "2013-04-20"
259  ) ,
260  "tst_timestamps" => array(
261  "2013-09-30T10:00:00"
262  )
263  ) ,
264  "get" => array(
265  "tst_date" => '2013-04-21',
266  "tst_time" => '10:00:00',
267  "tst_int" => 23,
268  "tst_double" => 24.0,
269  "tst_timestamp" => '2013-09-30T10:00:00',
270  "tst_dates" => array(
271  "2013-04-20"
272  ) ,
273  "tst_timestamps" => array(
274  "2013-09-30T10:00:00"
275  )
276  )
277  ) ,
278  array(
279  'TST_DOCTYPE1',
280  "set" => array(
281  "tst_date" => new \DateTime('2013-04-21') ,
282  "tst_time" => '1:2:5',
283  "tst_timestamp" => new \DateTime('2013-09-30 10:00:00') ,
284  "tst_dates" => array(
285  new \DateTime("2013-04-20") ,
286  new \DateTime("2013-4-2") ,
287  ) ,
288  "tst_timestamps" => array(
289  new \DateTime("2013-09-30T10:00:00")
290  )
291  ) ,
292  "get" => array(
293  "tst_date" => '2013-04-21',
294  "tst_time" => '01:02:05',
295  "tst_timestamp" => '2013-09-30T10:00:00',
296  "tst_dates" => array(
297  "2013-04-20",
298  "2013-04-02"
299  ) ,
300  "tst_timestamps" => array(
301  "2013-09-30T10:00:00"
302  )
303  )
304  ) ,
305  array(
306  'TST_DOCTYPE1',
307  "set" => array(
308  "tst_array5" => array(
309  array(
310  "tst_dates" => new \DateTime("2013-04-20")
311  ) ,
312  array(
313  "tst_dates" => new \DateTime("2013-4-2")
314  )
315  )
316  ) ,
317  "get" => array(
318  "tst_dates" => array(
319  "2013-04-20",
320  "2013-04-02"
321  )
322  )
323  ) ,
324  array(
325  'TST_DOCTYPE1',
326  "set" => array(
327  "tst_array8" => array(
328  array(
329  "tst_timestamps" => new \DateTime("2013-09-30T10:00:00")
330  ) ,
331  array(
332  "tst_timestamps" => new \DateTime("2013-09-30T22:00:00")
333  )
334  )
335  ) ,
336  "get" => array(
337  "tst_timestamps" => array(
338  '2013-09-30T10:00:00',
339  '2013-09-30T22:00:00'
340  )
341  )
342  ) ,
343  array(
344  'TST_DOCTYPE2',
345  "set" => array(
346  "tst_t_numbers" => array(
347  array(
348  "tst_ints1" => "23",
349  "tst_doubles1" => 23.6
350  )
351  )
352  ) ,
353  "get" => array(
354 
355  "tst_t_numbers" => array(
356  array(
357  "tst_ints1" => 23,
358  "tst_doubles1" => 23.6
359  )
360  )
361  )
362  ) ,
363  array(
364  'TST_DOCTYPE2',
365  "set" => array(
366  "tst_t_numbers" => array(
367  array(
368  "tst_ints1" => "20",
369  "tst_doubles1" => 20.0
370  ) ,
371  array(
372  "tst_ints1" => "21"
373  ) ,
374  array(
375  "tst_doubles1" => "22.2"
376  ) ,
377  array() ,
378  array(
379  "tst_ints1" => "23",
380  "tst_doubles1" => 23.6
381  ) ,
382  array(
383  "tst_ints1" => 0,
384  "tst_doubles1" => 0
385  ) ,
386  )
387  ) ,
388  "get" => array(
389 
390  "tst_t_numbers" => array(
391  array(
392  "tst_ints1" => 20,
393  "tst_doubles1" => 20.0
394  ) ,
395  array(
396  "tst_ints1" => 21,
397  "tst_doubles1" => null
398  ) ,
399  array(
400  "tst_ints1" => null,
401  "tst_doubles1" => 22.2
402  ) ,
403  array(
404  "tst_ints1" => null,
405  "tst_doubles1" => null
406  ) ,
407  array(
408  "tst_ints1" => 23,
409  "tst_doubles1" => 23.6
410  ) ,
411  array(
412  "tst_ints1" => 0,
413  "tst_doubles1" => 0.0
414  )
415  )
416  )
417  ) ,
418  array(
419  'TST_DOCTYPE2',
420  "set" => array(
421  "tst_texts" => array(
422  ''
423  )
424  ) ,
425  "get" => array(
426  "tst_texts" => array() // last empty values are deleted
427 
428  )
429  ) ,
430  array(
431  'TST_DOCTYPE2',
432  "set" => array(
433  "tst_texts" => array(
434  '',
435  ''
436  )
437  ) ,
438  "get" => array(
439  "tst_texts" => array() // last empty values are deleted
440 
441  )
442  ) ,
443  array(
444  'TST_DOCTYPE2',
445  "set" => array(
446  "tst_texts" => array(
447  '',
448  'a',
449  ''
450  )
451  ) ,
452  "get" => array(
453  "tst_texts" => array(
454  null,
455  'a'
456  ) // last empty values are deleted
457 
458  )
459  ) ,
460  array(
461  'TST_DOCTYPE2',
462  "set" => array(
463  "tst_t_text" => array(
464  array(
465  "tst_texts" => ''
466  )
467  )
468  ) ,
469  "get" => array(
470  "tst_texts" => array(
471  null
472  ) // last empty values are not deleted
473 
474  )
475  ) ,
476  array(
477  'TST_DOCTYPE2',
478  "set" => array(
479  "tst_t_text" => array(
480  array(
481  "tst_texts" => ''
482  ) ,
483  array(
484  "tst_texts" => null
485  )
486  )
487  ) ,
488  "get" => array(
489  "tst_texts" => array(
490  null,
491  null
492  ) // last empty values are not deleted
493 
494  )
495  ) ,
496  array(
497  'TST_DOCTYPE2',
498  "set" => array(
499  "tst_t_numbers" => null
500  ) ,
501  "get" => array(
502  "tst_t_numbers" => array()
503  )
504  ) ,
505  array(
506  'TST_DOCTYPE2',
507  "set" => array(
508  "tst_t_numbers" => array()
509  ) ,
510  "get" => array(
511  "tst_t_numbers" => array()
512  )
513  ) ,
514  array(
515  'TST_DOCTYPE2',
516  "set" => array(
517  "tst_t_numbers" => array(
518  array(
519  "tst_ints1" => "20",
520  "tst_doubles1" => 20.0
521  ) ,
522  array(
523  "tst_ints1" => "21"
524  ) ,
525  array(
526  "tst_doubles1" => "22.2"
527  ) ,
528  array() ,
529  array() ,
530  )
531  ) ,
532  "get" => array(
533 
534  "tst_t_numbers" => array(
535  array(
536  "tst_ints1" => 20,
537  "tst_doubles1" => 20.0
538  ) ,
539  array(
540  "tst_ints1" => 21,
541  "tst_doubles1" => null
542  ) ,
543  array(
544  "tst_ints1" => null,
545  "tst_doubles1" => 22.2
546  ) ,
547  array(
548  "tst_ints1" => null,
549  "tst_doubles1" => null
550  ) ,
551  array(
552  "tst_ints1" => null,
553  "tst_doubles1" => null
554  ) ,
555  )
556  )
557  )
558  );
559  }
560 
561  public function dataGetDateValues()
562  {
563  return array(
564  array(
565  'TST_DOCTYPE1',
566  array(
567  "tst_date" => '2013-04-20',
568  "tst_timestamp" => '2013-09-30T10:00:00',
569  "tst_dates" => array(
570  "2013-04-20"
571  ) ,
572  "tst_timestamps" => array(
573  "2013-09-30T10:00:00"
574  )
575  )
576  ) ,
577  array(
578  'TST_DOCTYPE2',
579  array(
580  "tst_date" => '2020-05-23',
581  "tst_timestamp" => '2013-09-30T20:10:41',
582  "tst_dates" => array(
583  "2020-05-23",
584  "2017-04-13"
585  ) ,
586  "tst_timestamps" => array(
587  "2013-09-30T20:10:41",
588  "2014-05-23T00:00:00"
589  )
590  )
591  )
592  );
593  }
594  public function dataGetRelationValues()
595  {
596  return array(
597  array(
598  'TST_DOCTYPE2',
599  array(
600  "tst_rel" => 'TST_DOCTYPE1',
601  "tst_rels" => array(
602  "TST_DOCTYPE1",
603  "TST_DOCTYPE0"
604  ) ,
605  "tst_rels2" => array(
606  array(
607  "TST_DOCTYPE1",
608  "TST_DOCTYPE0"
609  ) ,
610  array(
611  "TST_DOCTYPE0"
612  ) ,
613  array(
614  "TST_DOCTYPE1"
615  )
616  )
617  )
618  ) ,
619  array(
620  'TST_DOCTYPE1',
621  array( //TST_DOCTYPE0<BR><BR>TST_DOCTYPE0\n <BR>TST_DOCTYPE0\n\nTST_DOCTYPE0
622  "tst_rels2" => array(
623  array(
624  "TST_DOCTYPE0",
625  null,
626  "TST_DOCTYPE0"
627  ) ,
628  array(
629  null,
630  "TST_DOCTYPE0"
631  ) ,
632  array() ,
633  array(
634  "TST_DOCTYPE0"
635  )
636  )
637  )
638  )
639  );
640  }
641 
642  public function dataSetRelationValues()
643  {
644  return array(
645  array(
646  'TST_DOCTYPE2',
647  array(
648  "tst_rel" => 'TST_DOCTYPE1',
649  "tst_rels" => array(
650  "TST_DOCTYPE1",
651  "TST_DOCTYPE0"
652  ) ,
653  "tst_rels2" => array(
654  array(
655  "TST_DOCTYPE1",
656  "TST_DOCTYPE0"
657  ) ,
658  array(
659  "TST_DOCTYPE0"
660  ) ,
661  array(
662  "TST_DOCTYPE1"
663  )
664  )
665  )
666  ) ,
667  array(
668  'TST_DOCTYPE1',
669  array( //TST_DOCTYPE0<BR><BR>TST_DOCTYPE0\n <BR>TST_DOCTYPE0\n\nTST_DOCTYPE0
670  "tst_rels2" => array(
671  array(
672  "TST_DOCTYPE0",
673  null,
674  "TST_DOCTYPE0"
675  ) ,
676  array(
677  null,
678  "TST_DOCTYPE0"
679  ) ,
680  array() ,
681  array(
682  "TST_DOCTYPE0"
683  )
684  )
685  )
686  )
687  );
688  }
689 
690  public function dataErrorGetAttributeValue()
691  {
692  return array(
693  array(
694  'TST_DOCTYPE0',
695  "tst_notfound",
696  "DOC0114"
697  ) ,
698  array(
699  'TST_DOCTYPE0',
700  "tst_frame",
701  "DOC0116"
702  )
703  );
704  }
705 
706  public function dataErrorSetAttributeValue()
707  {
708  return array(
709  array(
710  'TST_DOCTYPE0',
711  "tst_notfound",
712  "-",
713  "DOC0115"
714  ) ,
715  array(
716  'TST_DOCTYPE0',
717  "tst_frame",
718  "-",
719  "DOC0117"
720  ) ,
721  array(
722  'TST_DOCTYPE0',
723  "tst_ints",
724  "23",
725  "VALUE0002"
726  ) ,
727  array(
728  'TST_DOCTYPE0',
729  "tst_int",
730  "23.4",
731  "VALUE0001"
732  ) ,
733  array(
734  'TST_DOCTYPE0',
735  "tst_ints",
736  array(
737  "234",
738  "Deux"
739  ) ,
740  "VALUE0001"
741  ) ,
742  array(
743  'TST_DOCTYPE0',
744  "tst_RELS2",
745  array(
746  array(
747  "23"
748  ) ,
749  "24"
750  ) ,
751  "VALUE0003"
752  ) ,
753  array(
754  'TST_DOCTYPE0',
755  "tst_int",
756  23.0,
757  "VALUE0005"
758  ) ,
759  array(
760  'TST_DOCTYPE0',
761  "tst_time",
762  "10:70:00",
763  "VALUE0001"
764  ) ,
765  array(
766  'TST_DOCTYPE0',
767  "tst_time",
768  "10:aa:00",
769  "VALUE0001"
770  ) ,
771  array(
772  'TST_DOCTYPE0',
773  "tst_time",
774  "23",
775  "VALUE0001"
776  ) ,
777  array(
778  'TST_DOCTYPE0',
779  "tst_double",
780  array(
781  "23"
782  ) ,
783  "VALUE0006"
784  ) ,
785  array(
786  'TST_DOCTYPE0',
787  "tst_double",
788  "23a",
789  "VALUE0001"
790  ) ,
791  array(
792  'TST_DOCTYPE1',
793  "tst_double",
794  new \DateTime() ,
795  "VALUE0005"
796  ) ,
797  array(
798  'TST_DOCTYPE1',
799  "tst_title",
800  new \DateTime() ,
801  "VALUE0005"
802  ) ,
803  array(
804  'TST_DOCTYPE1',
805  "tst_t_numbers",
806  new \DateTime() ,
807  "VALUE0008"
808  ) ,
809  array(
810  'TST_DOCTYPE1',
811  "tst_t_numbers",
812  array(
813  new \DateTime()
814  ) ,
815  "VALUE0009"
816  ) ,
817  array(
818  'TST_DOCTYPE1',
819  "tst_t_numbers",
820  array(
821  23,
822  45
823  ) ,
824  "VALUE0009"
825  ) ,
826  array(
827  'TST_DOCTYPE1',
828  "tst_t_numbers",
829  array(
830  array(
831  23,
832  45
833  )
834  ) ,
835  "VALUE0007"
836  )
837  );
838  }
839  public function dataSetAttributeValue()
840  {
841  return array(
842  array(
843  array(
844  "tst_title" => null,
845  "tst_int" => null,
846  "tst_money" => null,
847  "tst_double" => null,
848  "tst_date" => null,
849  "tst_time" => null,
850  "tst_rel" => null,
851  "tst_timestamp" => null,
852  "tst_enum" => null,
853  "tst_color" => null,
854 
855  "tst_enums" => array() ,
856  "tst_texts" => array() ,
857  "tst_ints" => array() ,
858  "tst_moneys" => array() ,
859  "tst_doubles" => array() ,
860  "tst_dates" => array() ,
861  "tst_times" => array() ,
862  "tst_timestamps" => array() ,
863  "tst_enumms" => array() ,
864  "tst_colors" => array() ,
865 
866  "tst_t_text" => array()
867  )
868  ) ,
869  array(
870  array(
871  "tst_title" => "test trois",
872  "tst_int" => 4,
873  "tst_money" => 4.67,
874  "tst_double" => 3.14159,
875  "tst_time" => "12:54:00",
876  "tst_rel" => "12",
877  "tst_enum" => "a",
878  "tst_color" => "#ff23e6",
879 
880  "tst_enums" => array(
881  "a",
882  "b",
883  "c"
884  ) ,
885  "tst_texts" => array(
886  "un cheval",
887  "deux poulains"
888  ) ,
889  "tst_ints" => array(
890  23,
891  567
892  ) ,
893  "tst_moneys" => array(
894  23.0,
895  56.5,
896  0.0, -2.0
897  ) ,
898  "tst_doubles" => array(
899  3.1415,
900  2.718,
901  null,
902  1.72
903  ) ,
904 
905  "tst_times" => array(
906  "12:00:00"
907  ) ,
908 
909  "tst_enumms" => array(
910  "a",
911  "c",
912  "b"
913  ) ,
914  "tst_colors" => array(
915  "#ffaa00",
916  "#dd8756"
917  ) ,
918  //
919  // "tst_t_text" => array()
920 
921  )
922  )
923  );
924  }
925  public function dataModifyAttributeValue()
926  {
927  return array(
928  array(
929  'TST_DOCTYPE1',
930  array(
931  "tst_title" => null,
932  "tst_int" => null,
933  "tst_money" => null,
934  "tst_double" => null,
935  "tst_date" => null,
936  "tst_time" => null,
937  "tst_rel" => null,
938  "tst_timestamp" => null,
939  "tst_enum" => null,
940  "tst_color" => null,
941 
942  "tst_enums" => array() ,
943  "tst_texts" => array() ,
944  "tst_ints" => array() ,
945  "tst_moneys" => array() ,
946  "tst_doubles" => array() ,
947  "tst_dates" => array() ,
948  "tst_times" => array() ,
949  "tst_timestamps" => array() ,
950  "tst_enumms" => array() ,
951  "tst_colors" => array() ,
952 
953  "tst_t_text" => array()
954  )
955  ) ,
956 
957  array(
958  'TST_DOCTYPE2',
959  array(
960  "tst_title" => null,
961  "tst_int" => null,
962  "tst_money" => null,
963  "tst_double" => null,
964  "tst_date" => null,
965  "tst_time" => null,
966  "tst_rel" => null,
967  "tst_timestamp" => null,
968  "tst_enum" => null,
969  "tst_color" => null,
970 
971  "tst_enums" => array() ,
972  "tst_texts" => array() ,
973  "tst_ints" => array() ,
974  "tst_moneys" => array() ,
975  "tst_doubles" => array() ,
976  "tst_dates" => array() ,
977  "tst_times" => array() ,
978  "tst_timestamps" => array() ,
979  "tst_enumms" => array() ,
980  "tst_colors" => array() ,
981 
982  "tst_t_text" => array()
983  )
984  ) ,
985  array(
986  'TST_DOCTYPE2',
987  array(
988  "tst_title" => "test trois",
989  "tst_int" => 4,
990  "tst_money" => 4.67,
991  "tst_htmltext" => '<p>Mon premier paragraphe</p>',
992  "tst_double" => 3.14159,
993  "tst_time" => "12:54:00",
994  "tst_rel" => "12",
995  "tst_enum" => "a",
996  "tst_color" => "#ff23e6",
997 
998  "tst_enums" => array(
999  "a",
1000  "b",
1001  "c"
1002  ) ,
1003  "tst_texts" => array(
1004  "un cheval",
1005  "deux poulains"
1006  ) ,
1007  "tst_ints" => array(
1008  23,
1009  567
1010  ) ,
1011  "tst_moneys" => array(
1012  23.0,
1013  56.5,
1014  0.0, -2.0
1015  ) ,
1016  "tst_doubles" => array(
1017  3.1415,
1018  2.718,
1019  null,
1020  1.72
1021  ) ,
1022  "tst_times" => array(
1023  "10:00:00",
1024  "20:59:59"
1025  ) ,
1026  "tst_enumms" => array(
1027  "a",
1028  "c",
1029  "b"
1030  ) ,
1031  "tst_colors" => array(
1032  "#ffaa00",
1033  "#dd8756"
1034  ) ,
1035  //
1036  // "tst_t_text" => array()
1037 
1038  )
1039  )
1040  );
1041  }
1042  public function dataGetAttributeValue()
1043  {
1044  return array(
1045  array(
1046  'TST_DOCTYPE0',
1047  array(
1048  "tst_title" => null,
1049  "tst_int" => null,
1050  "tst_money" => null,
1051  "tst_double" => null,
1052  "tst_date" => null,
1053  "tst_time" => null,
1054  "tst_rel" => null,
1055  "tst_timestamp" => null,
1056  "tst_enum" => null,
1057  "tst_color" => null,
1058 
1059  "tst_enums" => array() ,
1060  "tst_texts" => array() ,
1061  "tst_ints" => array() ,
1062  "tst_moneys" => array() ,
1063  "tst_doubles" => array() ,
1064  "tst_dates" => array() ,
1065  "tst_times" => array() ,
1066  "tst_timestamps" => array() ,
1067  "tst_enumms" => array() ,
1068  "tst_colors" => array() ,
1069 
1070  "tst_t_text" => array()
1071  )
1072  ) ,
1073  array(
1074  'TST_DOCTYPE1',
1075  array(
1076  "tst_title" => "Titre Un",
1077  "TST_TITLE" => "Titre Un",
1078  "tst_longtext" => "Et\nLa suite...",
1079  "tst_int" => 1,
1080  "tst_money" => 2.54,
1081  "tst_double" => 3.1415926,
1082  "tst_time" => "01:00:00",
1083  "tst_enum" => "a",
1084  "tst_color" => "#f3f",
1085  "tst_enums" => array(
1086  "a",
1087  "b",
1088  "c"
1089  ) ,
1090  "tst_texts" => array(
1091  "Un",
1092  "Deux"
1093  ) ,
1094  "tst_ints" => array(
1095  0
1096  ) ,
1097  "tst_moneys" => array(
1098  3.0
1099  ) ,
1100  "tst_doubles" => array(-54.0
1101  ) ,
1102  "tst_times" => array(
1103  "10:00:00"
1104  ) ,
1105  "tst_enumms" => array(
1106  "a"
1107  ) ,
1108  "tst_colors" => array(
1109  "#f3f"
1110  ) ,
1111  "tst_longtexts" => array(
1112  "Un\nDeux",
1113  "Trois\nQuatre"
1114  ) ,
1115  "tst_ints1" => array(
1116  1,
1117  2,
1118  3
1119  ) ,
1120  "tst_doubles1" => array(
1121  null,
1122  null,
1123  null
1124  ) ,
1125  "tst_t_text" => array(
1126  array(
1127  "tst_texts" => "Un"
1128  ) ,
1129  (array(
1130  "tst_texts" => "Deux"
1131  ))
1132  ) ,
1133  "tst_t_ints" => array(
1134  array(
1135  "tst_ints" => 0
1136  )
1137  ) ,
1138  "tst_t_numbers" => array(
1139  array(
1140  "tst_ints1" => 1,
1141  "tst_doubles1" => null
1142  ) ,
1143  array(
1144  "tst_ints1" => 2,
1145  "tst_doubles1" => null
1146  ) ,
1147  array(
1148  "tst_ints1" => 3,
1149  "tst_doubles1" => null
1150  )
1151  )
1152  )
1153  ) ,
1154  array(
1155  'TST_DOCTYPE2',
1156  array(
1157  "tst_title" => "Titre Deux",
1158  "tst_longtext" => "Texte long. Html tag <BR>.",
1159  "tst_int" => 0,
1160  "tst_money" => 3.0,
1161  "tst_double" => - 54.0,
1162  "tst_time" => "14:17:43",
1163  "tst_enum" => "c",
1164  "tst_color" => "#50ED42",
1165  "tst_enums" => array(
1166  "c",
1167  null,
1168  "b"
1169  ) ,
1170  "tst_texts" => array(
1171  "Un cheval noir",
1172  "Et un autre rouge"
1173  ) ,
1174  "tst_ints" => array(
1175  45,
1176  3654, -34
1177  ) ,
1178  "tst_moneys" => array(
1179  2.54,
1180  3.0,
1181  2.72
1182  ) ,
1183  "tst_doubles" => array(
1184  3.1415926,
1185  2.7182818,
1186  1.61803398875
1187  ) ,
1188  "tst_times" => array(
1189  "04:07:03"
1190  ) ,
1191  "tst_enumms" => array(
1192  "c"
1193  ) ,
1194  "tst_colors" => array(
1195  "#50ED42"
1196  ) ,
1197  "tst_ints1" => array(
1198  3,
1199  null,
1200  null
1201  ) ,
1202  "tst_doubles1" => array(
1203  null,
1204  5.6,
1205  7.8
1206  ) ,
1207  "tst_t_ints" => array(
1208  array(
1209  "tst_ints" => 45
1210  ) ,
1211  array(
1212  "tst_ints" => 3654
1213  ) ,
1214  array(
1215  "tst_ints" => - 34
1216  )
1217  )
1218  )
1219  )
1220  );
1221  }
1222 }
1223 ?>
testGetRelationValues($docName, array $expectedValues)
testErrorSetAttributeValue($docName, $attrid, $value, $expectedErrorCode)
$d
Definition: dav.php:77
testSetRelationValues($docName, array $expectedValues)
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
testCreateSetAttributeValue(array $expectedValues)
if($dbaccess=="") $o
testSetGetValues($docName, array $setValues, array $expectedValues)
testGetDateValues($docName, array $expectedValues)
testErrorGetAttributeValue($docName, $attrid, $expectedErrorCode)
testModifySetAttributeValue($docName, array $expectedValues)
$dbaccess
Definition: checkVault.php:17
getIdFromName($dbaccess, $name)
$value
testGetAttributeValue($docName, array $expectedValues)
← centre documentaire © anakeen