Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_test_dcp_importpropertiesfamily.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package Dcp\Pu
5 */
6 
7 namespace Dcp\Pu;
8 
9 require_once 'PU_testcase_dcp_document.php';
10 
12 {
13  protected static $outputDir;
14  /**
15  * @dataProvider dataBadFamilyFiles
16  */
17  public function testErrorImportFamily($familyFile, $expectedErrors)
18  {
19  $err = '';
20  try {
21  $this->importDocument($familyFile);
22  }
23  catch(\Exception $e) {
24  $err = $e->getMessage();
25  error_log($err);
26  }
27  $this->assertNotEmpty($err, "no import error detected");
28  if (!is_array($expectedErrors)) $expectedErrors = array(
29  $expectedErrors
30  );
31 
32  foreach ($expectedErrors as $expectedError) {
33  $this->assertContains($expectedError, $err, sprintf("not the correct error reporting : %s", $err));
34  }
35  }
36 
37  public function dataBadFamilyFiles()
38  {
39  return array(
40  // test attribute too long
41  array(
42  "PU_data_dcp_badfamprop1.ods",
43  array(
44  "FAM0500",
45  "Test 1",
46  "FAM0501",
47  "TST_BAD FAM1",
48  "FAM0502",
49  "TST_DOC32",
50  "Test Profil"
51  )
52  ) ,
53  array(
54  "PU_data_dcp_badfamprop2.ods",
55  array(
56  "FAM0100",
57  "UNKNOW",
58  "FAM0101",
59  "TST_BADSAME",
60  "FAM0102",
61  "TST_BADFAM11",
62  "WDOC"
63  )
64  ) ,
65  array(
66  "PU_data_dcp_badfamprop3.ods",
67  array(
68  "FAM0200"
69  )
70  ) ,
71  array(
72  "PU_data_dcp_badfamprop4.ods",
73  array(
74  "FAM0400",
75  "FAM0401",
76  "TestNotFound"
77  )
78  ) ,
79  array(
80  "PU_data_dcp_badfamprop5.ods",
81  array(
82  "RESE0001",
83  "patate",
84  "DFLD0001",
85  "folderNotFound",
86  "DFLD0002",
87  "TST_DOCPRF8",
88 
89  "CFLD0001",
90  "searchNotFound",
91  "CFLD0002",
92  "TST_DOCPRF8",
93 
94  "CVID0001",
95  "cvNotFound",
96  "CVID0002",
97  "TST_DOCPRF8",
98  "WID0001",
99  "workflowNotFound",
100  "WID0002",
101  "TST_DOCPRF8",
102  "CPRF0001",
103  "profilNotFound"
104  //"CPRF0002",
105 
106  )
107  ) ,
108  array(
109  "PU_data_dcp_badfamprop6.ods",
110  array(
111  "MTHD0001",
112  "MTHD0002",
113  "Nothing"
114  )
115  ) ,
116  array(
117  "PU_data_dcp_badfamprop7.ods",
118  array(
119  "MTHD0003",
120  "postModify",
121  "postStore"
122  )
123  )
124  );
125  }
126 }
127 ?>
testErrorImportFamily($familyFile, $expectedErrors)
static importDocument($file)
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen