ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV Namespace Reference

Namespaces

 Auth
 
 Browser
 
 Exception
 
 FS
 
 FSExt
 
 Locks
 
 Mock
 
 Mount
 
 PartialUpdate
 
 Property
 
 PropertyStorage
 
 Sharing
 
 Sync
 
 Xml
 

Data Structures

class  AbstractServer
 
class  BasicNodeTest
 
class  Client
 SabreDAV DAV client. More...
 
class  ClientMock
 
class  ClientTest
 
class  Collection
 Collection class. More...
 
class  CorePlugin
 The core plugin provides all the basic features for a WebDAV server. More...
 
class  CorePluginTest
 
class  DbCache
 
class  DirectoryMock
 
class  Exception
 Main Exception class. More...
 
class  ExceptionTest
 
class  File
 File class. More...
 
class  FileMock
 
class  GetIfConditionsTest
 
class  HttpCopyTest
 Tests related to the COPY request. More...
 
class  HttpDeleteTest
 Tests related to the PUT request. More...
 
class  HttpGetTest
 Tests related to the GET request. More...
 
class  HttpHeadTest
 Tests related to the HEAD request. More...
 
class  HttpMoveTest
 Tests related to the MOVE request. More...
 
class  HTTPPreferParsingTest
 
class  HttpPutTest
 Tests related to the PUT request. More...
 
interface  ICollection
 The ICollection Interface. More...
 
interface  IExtendedCollection
 The IExtendedCollection interface. More...
 
interface  IFile
 This interface represents a file in the directory tree. More...
 
interface  IMoveTarget
 By implementing this interface, a collection can effectively say "other nodes may be moved into this collection". More...
 
interface  IMultiGet
 IMultiGet. More...
 
interface  INode
 The INode interface is the base interface, and the parent class of both ICollection and IFile. More...
 
interface  IProperties
 IProperties interface. More...
 
interface  IQuota
 IQuota interface. More...
 
class  Issue33Test
 
class  MkCol
 This class represents a MKCOL operation. More...
 
class  MockLogger
 The MockLogger is a simple PSR-3 implementation that we can use to test whether things get logged correctly. More...
 
class  Node
 Node class. More...
 
class  ObjectTreeTest
 
class  PropFind
 This class holds all the information about a PROPFIND request. More...
 
class  PropFindTest
 
class  PropPatch
 This class represents a set of properties that are going to be updated. More...
 
class  PropPatchTest
 
class  PSR3Test
 
class  Server
 Main DAV server class. More...
 
class  ServerEventsTest
 
class  ServerMKCOLTest
 
class  ServerPlugin
 The baseclass for all server plugins. More...
 
class  ServerPluginMock
 
class  ServerPluginTest
 
class  ServerPreconditionsNode
 
class  ServerPreconditionsTest
 
class  ServerPropsInfiniteDepthTest
 
class  ServerPropsTest
 
class  ServerRangeTest
 This file tests HTTP requests that use the Range: header. More...
 
class  ServerSimpleTest
 
class  ServerUpdatePropertiesTest
 
class  SimpleCollection
 SimpleCollection. More...
 
class  SimpleFile
 SimpleFile. More...
 
class  SimpleFileTest
 
class  StringUtil
 String utility. More...
 
class  StringUtilTest
 
class  SyncTokenPropertyTest
 
class  TemporaryFileFilterPlugin
 Temporary File Filter Plugin. More...
 
class  TemporaryFileFilterTest
 
class  TestPlugin
 
class  Tree
 The tree object is responsible for basic tree operations. More...
 
class  TreeDirectoryTester
 
class  TreeFileTester
 
class  TreeMock
 
class  TreeMultiGetTester
 
class  TreeTest
 
class  UUIDUtil
 UUID Utility. More...
 
class  UUIDUtilTest
 
class  Version
 This class contains the SabreDAV version constants. More...
 

Functions

 getDb ()
 Returns a fully configured PDO object. More...
 
 getPDO ()
 Alias for getDb. More...
 
 createSchema ($schemaName)
 Uses .sql files from the examples directory to initialize the database. More...
 
 dropTables ($tableNames)
 Drops tables, if they exist. More...
 
 tearDown ()
 

Variables

trait DbTestHelperTrait
 

Function Documentation

◆ createSchema()

Sabre\DAV\createSchema (   $schemaName)

Uses .sql files from the examples directory to initialize the database.

Parameters
string$schemaName
Returns
void

Definition at line 94 of file DbTestHelperTrait.php.

References $query, and Sabre\DAV\getDb().

Referenced by Sabre\DAV\Locks\Backend\PDOTest\getBackend(), Sabre\DAV\PropertyStorage\Backend\AbstractPDOTest\getBackend(), Sabre\DAV\Auth\Backend\AbstractPDOTest\setUp(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\setUp(), Sabre\CalDAV\Backend\AbstractPDOTest\setUp(), Sabre\CardDAV\Backend\AbstractPDOTest\setUp(), Sabre\CardDAV\AddressBookTest\testGetSyncToken(), and Sabre\CardDAV\AddressBookTest\testGetSyncToken2().

94  {
95 
96  $db = $this->getDb();
97 
98  $queries = file_get_contents(
99  __DIR__ . '/../../../examples/sql/' . $this->driver . '.' . $schemaName . '.sql'
100  );
101 
102  foreach (explode(';', $queries) as $query) {
103 
104  if (trim($query) === '') {
105  continue;
106  }
107 
108  $db->exec($query);
109 
110  }
111 
112  }
getDb()
Returns a fully configured PDO object.
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dropTables()

Sabre\DAV\dropTables (   $tableNames)

Drops tables, if they exist.

Parameters
string|string[]$tableNames
Returns
void

Definition at line 120 of file DbTestHelperTrait.php.

References Sabre\DAV\getDb().

Referenced by Sabre\DAV\Locks\Backend\PDOTest\getBackend(), Sabre\DAV\PropertyStorage\Backend\AbstractPDOTest\getBackend(), Sabre\DAV\Auth\Backend\AbstractPDOTest\setUp(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\setUp(), Sabre\CalDAV\Backend\AbstractPDOTest\setUp(), Sabre\CardDAV\Backend\AbstractPDOTest\setUp(), Sabre\CardDAV\AddressBookTest\testGetSyncToken(), and Sabre\CardDAV\AddressBookTest\testGetSyncToken2().

120  {
121 
122  $tableNames = (array)$tableNames;
123  $db = $this->getDb();
124  foreach ($tableNames as $tableName) {
125  $db->exec('DROP TABLE IF EXISTS ' . $tableName);
126  }
127 
128 
129  }
getDb()
Returns a fully configured PDO object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDb()

Sabre\DAV\getDb ( )

Returns a fully configured PDO object.

Returns
PDO

Definition at line 26 of file DbTestHelperTrait.php.

References Sabre\DAV\DbCache\$cache, $driver, $pdo, and $version.

Referenced by Sabre\DAV\createSchema(), Sabre\DAV\dropTables(), Sabre\DAV\getPDO(), and Sabre\CalDAV\Backend\AbstractPDOTest\setUp().

26  {
27 
28  if (!$this->driver) {
29  throw new \Exception('You must set the $driver public property');
30  }
31 
32  if (array_key_exists($this->driver, DbCache::$cache)) {
33  $pdo = DbCache::$cache[$this->driver];
34  if ($pdo === null) {
35  $this->markTestSkipped($this->driver . ' was not enabled, not correctly configured or of the wrong version');
36  }
37  return $pdo;
38  }
39 
40  try {
41 
42  switch ($this->driver) {
43 
44  case 'mysql' :
45  $pdo = new PDO(SABRE_MYSQLDSN, SABRE_MYSQLUSER, SABRE_MYSQLPASS);
46  break;
47  case 'sqlite' :
48  $pdo = new \PDO('sqlite:' . SABRE_TEMPDIR . '/testdb');
49  break;
50  case 'pgsql' :
51  $pdo = new \PDO(SABRE_PGSQLDSN);
52  $version = $pdo->query('SELECT VERSION()')->fetchColumn();
53  preg_match('|([0-9\.]){5,}|', $version, $matches);
54  $version = $matches[0];
55  if (version_compare($version, '9.5.0', '<')) {
56  DbCache::$cache[$this->driver] = null;
57  $this->markTestSkipped('We require at least Postgres 9.5. This server is running ' . $version);
58  }
59  break;
60 
61 
62 
63  }
64  $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
65 
66  } catch (PDOException $e) {
67 
68  $this->markTestSkipped($this->driver . ' was not enabled or not correctly configured. Error message: ' . $e->getMessage());
69 
70  }
71 
72  DbCache::$cache[$this->driver] = $pdo;
73  return $pdo;
74 
75  }
$version
Definition: build.php:27
$driver
Definition: migrateto20.php:66
$pdo
Definition: migrateto20.php:62
+ Here is the caller graph for this function:

◆ getPDO()

Sabre\DAV\getPDO ( )

Alias for getDb.

Returns
PDO

Definition at line 82 of file DbTestHelperTrait.php.

References Sabre\DAV\getDb().

Referenced by Sabre\DAV\Locks\Backend\PDOTest\getBackend(), Sabre\DAV\PropertyStorage\Backend\AbstractPDOTest\getBackend(), Sabre\DAV\Auth\Backend\AbstractPDOTest\setUp(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\setUp(), Sabre\CardDAV\Backend\AbstractPDOTest\setUp(), Sabre\DAV\Auth\Backend\AbstractPDOTest\testConstruct(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testConstruct(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testFindByUri(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testFindByUriUnknownScheme(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testGetGroupMemberSet(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testGetGroupMembership(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testGetPrincipalByPath(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testGetPrincipalsByPrefix(), Sabre\CardDAV\AddressBookTest\testGetSyncToken(), Sabre\CardDAV\AddressBookTest\testGetSyncToken2(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testSearchPrincipals(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testSetGroupMemberSet(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testUpdatePrincipal(), Sabre\DAVACL\PrincipalBackend\AbstractPDOTest\testUpdatePrincipalUnknownField(), and Sabre\DAV\Auth\Backend\AbstractPDOTest\testUserInfo().

82  {
83 
84  return $this->getDb();
85 
86  }
getDb()
Returns a fully configured PDO object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tearDown()

Sabre\DAV\tearDown ( )

Definition at line 131 of file DbTestHelperTrait.php.

References Sabre\DAV\DbCache\$cache.

Referenced by Monolog\Formatter\LogstashFormatterTest\tearDown(), Monolog\Formatter\NormalizerFormatterTest\tearDown(), Sabre\DAV\Browser\GuessContentTypeTest\tearDown(), Sabre\DAV\ServerPropsTest\tearDown(), and Sabre\DAV\ServerPropsInfiniteDepthTest\tearDown().

131  {
132 
133  switch ($this->driver) {
134 
135  case 'sqlite' :
136  // Recreating sqlite, just in case
137  unset(DbCache::$cache[$this->driver]);
138  unlink(SABRE_TEMPDIR . '/testdb');
139  }
140 
141  }
+ Here is the caller graph for this function:

Variable Documentation

◆ DbTestHelperTrait

trait Sabre::DAV\DbTestHelperTrait
Initial value:
{
public $driver = null
$driver
Definition: migrateto20.php:66

Definition at line 14 of file DbTestHelperTrait.php.