Alternc  3.2
Alternc logiel libre pour l'hébergement
 All Data Structures Namespaces Files Functions Variables Pages
AlterncTest.php
Go to the documentation of this file.
1 <?php
2 /**
3  * This is the abstract class for all tests
4  * @see http://phpunit.de/manual/
5  */
6 abstract class AlterncTest extends PHPUnit_Extensions_Database_TestCase
7 {
8  /**
9  * @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
10  */
11  public function getConnection()
12  {
13  global $database,$user,$password;
14  $pdo = new PDO('mysql:dbname='.$database.';host=127.0.0.1',$user,$password);
15  return $this->createDefaultDBConnection($pdo);
16  }
17 
18  /**
19  *
20  * @param type $file_name
21  * @return \PHPUnit_Extensions_Database_DataSet_YamlDataSet
22  * @throws \Exception
23  */
24  public function loadDataSet($file_name)
25  {
26  $file = PHPUNIT_DATASETS_PATH."/$file_name";
27  if( !is_file($file) ){
28  throw new \Exception("missing $file");
29  }
30  $dataSet = new PHPUnit_Extensions_Database_DataSet_YamlDataSet($file);
31  return $dataSet;
32  }
33 
34 
35 
36 }