ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\TestUtil Class Reference
+ Collaboration diagram for Sabre\TestUtil:

Static Public Member Functions

static clearTempDir ()
 This function deletes all the contents of the temporary directory. More...
 
static getMySQLDB ()
 
static getSQLiteDB ()
 
static getPgSqlDB ()
 

Static Private Member Functions

static deleteTree ($path, $deleteRoot=true)
 

Detailed Description

Definition at line 5 of file TestUtil.php.

Member Function Documentation

◆ clearTempDir()

◆ deleteTree()

static Sabre\TestUtil::deleteTree (   $path,
  $deleteRoot = true 
)
staticprivate

Definition at line 19 of file TestUtil.php.

References $path.

19  {
20 
21  foreach (scandir($path) as $node) {
22 
23  if ($node == '.' || $node == '..') continue;
24  $myPath = $path . '/' . $node;
25  if (is_file($myPath)) {
26  unlink($myPath);
27  } else {
28  self::deleteTree($myPath);
29  }
30 
31  }
32  if ($deleteRoot) {
33  rmdir($path);
34  }
35 
36  }
$path
Definition: aliased.php:25

◆ getMySQLDB()

static Sabre\TestUtil::getMySQLDB ( )
static

Definition at line 38 of file TestUtil.php.

References $pdo.

38  {
39 
40  try {
41  $pdo = new \PDO(SABRE_MYSQLDSN, SABRE_MYSQLUSER, SABRE_MYSQLPASS);
42  $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
43  return $pdo;
44  } catch (\PDOException $e) {
45  return null;
46  }
47 
48  }
$pdo
Definition: migrateto20.php:62

◆ getPgSqlDB()

static Sabre\TestUtil::getPgSqlDB ( )
static

Definition at line 58 of file TestUtil.php.

References $pdo.

58  {
59 
60  //try {
61  $pdo = new \PDO(SABRE_PGSQLDSN);
62  $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
63  return $pdo;
64  //} catch (\PDOException $e) {
65  // return null;
66  //}
67 
68  }
$pdo
Definition: migrateto20.php:62

◆ getSQLiteDB()

static Sabre\TestUtil::getSQLiteDB ( )
static

Definition at line 50 of file TestUtil.php.

References $pdo.

50  {
51 
52  $pdo = new \PDO('sqlite:' . SABRE_TEMPDIR . '/pdobackend');
53  $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
54  return $pdo;
55 
56  }
$pdo
Definition: migrateto20.php:62

The documentation for this class was generated from the following file: