Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_test_dcp_importarchive.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  protected static function getCommonImportFile()
19  {
20  return 'PU_dcp_data_archivefamily.csv';
21  }
22  /**
23  * @dataProvider dataDocumentFiles
24  */
25  public function testExecuteImportArchive($archiveFile, $resultDocuments)
26  {
27 
28  $oImport = new \ImportDocument();
29  $onlyAnalyze = false;
30  $archive = true;
31  $oImport->importDocuments($this->getAction() , $archiveFile, $onlyAnalyze, $archive);
32  $err = $oImport->getErrorMessage();
33 
34  $this->assertEmpty($err, sprintf("import error %s", $err));
35  foreach ($resultDocuments as $expected) {
36  $s = new \SearchDoc('', $expected["family"]);
37  $s->addFilter("title = '%s'", $expected["title"]);
38  $count = $s->onlyCount();
39  $this->assertGreaterThan(0, $count, sprintf("document %s not imported from archive %s", $expected["title"], $archiveFile));
40  }
41  }
42 
43  public function dataDocumentFiles()
44  {
45  return array(
46  array(
47  "./DCPTEST/PU_dcp_data_archiveimage.zip",
48  array(
49  array(
50  "family" => "IMAGE",
51  "title" => "testdcp1.png"
52  ) ,
53  array(
54  "family" => "IMAGE",
55  "title" => "testdcp2.png"
56  )
57  )
58  ) ,
59  array(
60  "./DCPTEST/PU_dcp_data_archiveimage.tgz",
61  array(
62  array(
63  "family" => "IMAGE",
64  "title" => "testdcp1.png"
65  ) ,
66  array(
67  "family" => "IMAGE",
68  "title" => "testdcp2.png"
69  ) ,
70  array(
71  "family" => "FILE",
72  "title" => "testdcp3.txt"
73  )
74  )
75  ) ,
76  array(
77  "./DCPTEST/PU_dcp_data_archivefile.zip",
78  array(
79  array(
80  "family" => "TST_ARCHFILE",
81  "title" => "Fichier un"
82  ) ,
83  array(
84  "family" => "TST_ARCHFILE",
85  "title" => "Fichier deux"
86  ) ,
87  array(
88  "family" => "TST_ARCHFILES",
89  "title" => "Fichier un et deux"
90  )
91  )
92  ) ,
93  );
94  }
95 }
$archive
if($famId) $s
$onlyAnalyze
testExecuteImportArchive($archiveFile, $resultDocuments)
if($file) if($subject==""&&$file) if($subject=="") $err
if($dirid) $oImport
← centre documentaire © anakeen