Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_test_dcp_searchjoin.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  * import TST_SEARCHJOIN1 and TST_SEARCHJOIN2 family
19  * @static
20  * @return string
21  */
22  protected static function getCommonImportFile()
23  {
24  return "PU_data_dcp_search_join.ods";
25  }
26  /**
27  * Test join search
28  * @param string $join join query
29  * @param string $filter filters query
30  * @param string $filterVar Variable for filter
31  * @dataProvider dataSearchJoin
32  */
33  public function testSearchJoinExecute($join, $filter, $filterVar)
34  {
35  include_once ("FDL/Class.SearchDoc.php");
36  $s = new \SearchDoc(self::$dbaccess, "TST_SEARCHJOIN2");
37  $s->join($join);
38  $s->addFilter($filter, $filterVar);
39  $s->search();
40  $array = $s->getSearchInfo();
41  $err = $array["error"];
42  $this->assertEmpty($err, "An error was found when trying a join search:" . $err);
43  }
44 
45  public function dataSearchJoin()
46  {
47  return array(
48  array(
49  "tst_title = tst_searchjoin1(tst_title)",
50  "tst_searchjoin1.tst_attr1 = '%s'",
51  "Youpi"
52  ) ,
53  array(
54  "tst_join::int = tst_searchjoin1(initid)",
55  "lower(tst_searchjoin1.tst_title) = '%s'",
56  "youpi"
57  ) ,
58  array(
59  "tst_join::int = tst_searchjoin1(initid)",
60  "tst_searchjoin1.tst_title = '%s'",
61  "youpi"
62  ) ,
63  array(
64  "tst_title = tst_searchjoin1(tst_title)",
65  "tst_searchjoin1.tst_attr1 = '%s' OR tst_searchjoin1.tst_attr1 = 'Youpla'",
66  "Youpi"
67  ) ,
68  array(
69  "tst_title = tst_searchjoin1(tst_title)",
70  "lower(tst_searchjoin1.tst_attr1) = lower('%s') OR lower(upper(tst_searchjoin1.tst_attr1)) = lower(upper('Youpla'))",
71  "Youpi"
72  )
73  );
74  }
75 }
testSearchJoinExecute($join, $filter, $filterVar)
if($famId) $s
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen