"Fossies" - the Fresh Open Source Software Archive

Member "dav-4.0.3/tests/bootstrap.php" (10 Jan 2020, 1891 Bytes) of package /linux/www/dav-4.0.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "bootstrap.php": 4.0.2_vs_4.0.3.

    1 <?php
    2 
    3 declare(strict_types=1);
    4 
    5 set_include_path(__DIR__.'/../lib/'.PATH_SEPARATOR.__DIR__.PATH_SEPARATOR.get_include_path());
    6 
    7 $autoLoader = include __DIR__.'/../vendor/autoload.php';
    8 
    9 // SabreDAV tests auto loading
   10 $autoLoader->add('Sabre\\', __DIR__);
   11 // VObject tests auto loading
   12 $autoLoader->addPsr4('Sabre\\VObject\\', __DIR__.'/../vendor/sabre/vobject/tests/VObject');
   13 $autoLoader->addPsr4('Sabre\\Xml\\', __DIR__.'/../vendor/sabre/xml/tests/Sabre/Xml');
   14 
   15 date_default_timezone_set('UTC');
   16 
   17 if ('TRUE' === getenv('RUN_TEST_WITH_STREAMING_PROPFIND')) {
   18     echo 'Running unit tests with \Sabre\DAV\Server::$streamMultiStatus = true';
   19     \Sabre\DAV\Server::$streamMultiStatus = true;
   20 }
   21 
   22 // List of variables that can be set by the environment
   23 $environmentVars = [
   24     'SABRE_MYSQLUSER',
   25     'SABRE_MYSQLPASS',
   26     'SABRE_MYSQLDSN',
   27     'SABRE_PGSQLDSN',
   28 ];
   29 foreach ($environmentVars as $var) {
   30     if ($value = getenv($var)) {
   31         define($var, $value);
   32     }
   33 }
   34 
   35 $config = [
   36     'SABRE_TEMPDIR' => dirname(__FILE__).'/temp/',
   37     'SABRE_HASSQLITE' => in_array('sqlite', PDO::getAvailableDrivers()),
   38     'SABRE_HASMYSQL' => in_array('mysql', PDO::getAvailableDrivers()),
   39     'SABRE_HASPGSQL' => in_array('pgsql', PDO::getAvailableDrivers()),
   40     'SABRE_MYSQLDSN' => 'mysql:host=127.0.0.1;dbname=sabredav_test',
   41     'SABRE_MYSQLUSER' => 'sabredav',
   42     'SABRE_MYSQLPASS' => '',
   43     'SABRE_PGSQLDSN' => 'pgsql:host=localhost;dbname=sabredav_test;user=sabredav;password=sabredav',
   44 ];
   45 
   46 if (file_exists(__DIR__.'/config.user.php')) {
   47     include __DIR__.'/config.user.php';
   48     foreach ($userConfig as $key => $value) {
   49         $config[$key] = $value;
   50     }
   51 }
   52 
   53 foreach ($config as $key => $value) {
   54     if (!defined($key)) {
   55         define($key, $value);
   56     }
   57 }
   58 
   59 if (!file_exists(SABRE_TEMPDIR)) {
   60     mkdir(SABRE_TEMPDIR);
   61 }
   62 if (file_exists('.sabredav')) {
   63     unlink('.sabredav');
   64 }