Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_test_dcp_doctitle.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  public $famName = "TST_TITLE";
18  /**
19  * import TST_TITLE family
20  * @static
21  * @return string
22  */
23  protected static function getCommonImportFile()
24  {
25  return "PU_data_dcp_getdoctitle.ods";
26  }
27  /**
28  * @dataProvider dataGetDocTitleMultiple
29  */
30  public function testGetTitleMultiple($docName, $expectValue, $type)
31  {
32  $d = createDoc(self::$dbaccess, $this->famName);
33  $this->assertTrue(is_object($d) , sprintf("cannot create %s document", $this->famName));
34 
35  if ($type == "docid") {
36  $expectedValues = array();
37  $expetedArray = explode(" ", $expectValue);
38  foreach ($expetedArray as $expected) {
39  $expectedValues[] = getIdFromName(self::$dbaccess, $expected);
40  }
41  $expectValue = implode(" ", $expectedValues);
42  }
43 
44  $value = $d->getTitle(getIdFromName(self::$dbaccess, $docName));
45  $this->assertEquals($expectValue, $value, "getTitle wrong value");
46  }
47 
48  public function dataGetDocTitleMultiple()
49  {
50 
51  return array(
52  array(
53  "TST_TITLE_3",
54  "TST_TITLE_2 TST_TITLE_1 TST_TITLE_2 TST_TITLE_1",
55  "docid"
56  ) ,
57  array(
58  'TST_TITLE_2',
59  "TST_TITLE_1",
60  "docid"
61  ) ,
62  array(
63  'TST_TITLE_1',
64  "Y N Y N",
65  "enum"
66  )
67  );
68  }
69 }
testGetTitleMultiple($docName, $expectValue, $type)
$d
Definition: dav.php:77
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
$dbaccess
Definition: checkVault.php:17
getIdFromName($dbaccess, $name)
$value
← centre documentaire © anakeen