Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_test_dcp_importDocumentsExtra.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  * @param string $file file to import
19  * @param array $datas Array of data
20  * @return void
21  @dataProvider dataTestImportDocumentExtra
22  */
23  public function testDoImportDocumentsExtra($file, array $datas)
24  {
25  $err = "";
26  try {
27  $this->importDocument($file);
28  }
29  catch(\Exception $e) {
30  $err = $e->getMessage();
31  }
32  $this->assertEmpty($err, "import error detected $err");
33  foreach ($datas as $data) {
34  $docName = $data[0];
35  $stateExpected = $data[1];
36  $doc = new_Doc(self::$dbaccess, $docName);
37  $this->assertTrue($doc->isAlive() , sprintf("cannot find doc [%s]", $docName));
38  $stateFound = json_decode($doc->getRawValue("test_extra") , true);
39  $this->assertEquals($stateExpected, $stateFound, sprintf("State found : [%s] is not the same as state expected: [%s]", $stateFound["state"], $stateExpected["state"]));
40  }
41  }
42 
43  public function dataTestImportDocumentExtra()
44  {
45  return array(
46  array(
47  "PU_data_dcp_impworkflowextra.ods",
48  array(
49  array(
50  "TEST_EXTRA_DEFAULT1",
51  array(
52  "state" => "alive",
53  "num" => "1"
54  )
55  ) ,
56  array(
57  "TEST_EXTRA_DEFAULT2",
58  array(
59  "state" => "sick",
60  "num" => "2"
61  )
62  )
63  )
64  )
65  );
66  }
67 }
$file
static importDocument($file)
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
$data
← centre documentaire © anakeen