Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_test_dcp_affect.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_commonfamily.php';
10 
12 {
13 
14  public static function getCommonImportFile()
15  {
16  return array(
17  'PU_data_dcp_TestAffect.ods'
18  );
19  }
20 
21  protected $famName = "TST_AFFECT1";
22  /**
23  * test basic affect hook
24  * @param string $family family name or id
25  * @return void
26  * @dataProvider dataAffect
27  */
28  public function testAffect($family, $count, $one, $two)
29  {
30  $s = new \SearchDoc(self::$dbaccess, $family);
31  $s->setObjectReturn(true);
32  $s->setOrder("initid");
33  $s->search();
34 
35  $this->assertEquals($s->count(), $count);
36  $dl=$s->getDocumentList();
37 
38  $k=0;
39  /**
40  * @var TestAffect1 $doc
41  */
42  foreach ($dl as $doc) {
43  $this->assertEquals($one[$k],$doc->getOne(), sprintf("index %d => %s", $k, $doc->getOne()));
44  $this->assertEquals($two[$k],$doc->getTwo(), sprintf("index %d => %s", $k, $doc->getTwo()));
45  $k++;
46  }
47  }
48 
49  public function dataAffect()
50  {
51  return array(
52  array($this->famName,6,
53  array(1,2,3,1,2,3),
54  array(0,0,0,2,4,6)
55  )
56  );
57  }
58 }
if($famId) $s
$dbaccess
Definition: checkVault.php:17
← centre documentaire © anakeen