Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
PU_testcase_dcp_commonfamily.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.php';
14 
16 {
17 
18  protected function tearDown()
19  {
20  if (!self::$odb) {
21  self::$odb = new \DbObj(self::$dbaccess);
22  }
23  self::$odb->rollbackPoint('testunit');
24  }
25 
26  protected function setUp()
27  {
28  self::$odb->savePoint('testunit');
29  }
30  /**
31  * return file to import before run test
32  * could be an array if several files
33  * @static
34  * @return string|array
35  */
36  protected static function getCommonImportFile()
37  {
38  return '';
39  }
40  public static function setUpBeforeClass()
41  {
42  parent::setUpBeforeClass();
43 
44  self::connectUser();
45  self::beginTransaction();
46 
47  $cf = static::getCommonImportFile();
48  if ($cf) {
49  if (!is_array($cf)) $cf = array(
50  $cf
51  );
52  foreach ($cf as $f) {
53  try {
54  self::importDocument($f);
55  }
56  catch(\Dcp\Exception $e) {
57  self::rollbackTransaction();
58  throw new \Dcp\Exception(sprintf("Exception while importing file '%s': %s", $f, $e->getMessage()));
59  }
60  }
61  }
62  }
63 
64  public static function tearDownAfterClass()
65  {
66  self::rollbackTransaction();
67  }
68 }
$dbaccess
Definition: checkVault.php:17
← centre documentaire © anakeen