Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_test_dcp_importprofid.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 testErrorImportProfid($familyFile, $expectedErrors)
18  {
19  $err = '';
20  try {
21  $this->importDocument($familyFile);
22  }
23  catch(\Exception $e) {
24  $err = $e->getMessage();
25  }
26  $this->assertNotEmpty($err, "no import error detected");
27  if (!is_array($expectedErrors)) $expectedErrors = array(
28  $expectedErrors
29  );
30 
31  foreach ($expectedErrors as $expectedError) {
32  $this->assertContains($expectedError, $err, sprintf("not the correct error reporting : %s", $err));
33  }
34  }
35  /**
36  * @dataProvider dataGoodFamilyFiles
37  */
38  public function testExecuteImportProfid($familyFile)
39  {
40  $err = '';
41  try {
42  $this->importDocument($familyFile);
43  }
44  catch(\Exception $e) {
45  $err = $e->getMessage();
46  }
47  $this->assertEmpty($err, sprintf("profid error detected %s", $err));
48  }
49 
50  public function dataBadFamilyFiles()
51  {
52  return array(
53  // test unknow profid
54  array(
55  "PU_data_dcp_badprofid1.ods",
56  array(
57  "PRFD0001",
58  "inconnu"
59  )
60  ) ,
61  // test unknow profid
62  array(
63  "PU_data_dcp_badprofid2.ods",
64  array(
65  "PRFD0002",
66  "TST_FOLDER1"
67  )
68  )
69  );
70  }
71 
72  public function dataGoodFamilyFiles()
73  {
74  return array(
75  // test pfam ref
76  array(
77  "PU_data_dcp_goodprofid1.ods"
78  ) ,
79  // test itself ref
80  array(
81  "PU_data_dcp_goodprofid2.ods"
82  )
83  );
84  }
85 }
86 ?>
static importDocument($file)
testErrorImportProfid($familyFile, $expectedErrors)
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen