xref: /plugin/davcal/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\CalDAV\Backend;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehlerrequire_once 'Sabre/TestUtil.php';
6*a1a3b679SAndreas Boehlerrequire_once 'Sabre/CalDAV/TestUtil.php';
7*a1a3b679SAndreas Boehlerrequire_once 'Sabre/CalDAV/Backend/AbstractPDOTest.php';
8*a1a3b679SAndreas Boehler
9*a1a3b679SAndreas Boehlerclass PDOMySQLTest extends AbstractPDOTest {
10*a1a3b679SAndreas Boehler
11*a1a3b679SAndreas Boehler    function setup() {
12*a1a3b679SAndreas Boehler
13*a1a3b679SAndreas Boehler        if (!SABRE_HASMYSQL) $this->markTestSkipped('MySQL driver is not available, or not properly configured');
14*a1a3b679SAndreas Boehler        $pdo = \Sabre\TestUtil::getMySQLDB();
15*a1a3b679SAndreas Boehler        if (!$pdo) $this->markTestSkipped('Could not connect to mysql database');
16*a1a3b679SAndreas Boehler
17*a1a3b679SAndreas Boehler        $pdo->query('DROP TABLE IF EXISTS calendarobjects, calendars, calendarchanges, calendarsubscriptions, schedulingobjects');
18*a1a3b679SAndreas Boehler
19*a1a3b679SAndreas Boehler        $queries = explode(
20*a1a3b679SAndreas Boehler            ';',
21*a1a3b679SAndreas Boehler            file_get_contents(__DIR__ . '/../../../../examples/sql/mysql.calendars.sql')
22*a1a3b679SAndreas Boehler        );
23*a1a3b679SAndreas Boehler
24*a1a3b679SAndreas Boehler        foreach($queries as $query) {
25*a1a3b679SAndreas Boehler            $query = trim($query," \r\n\t");
26*a1a3b679SAndreas Boehler            if ($query)
27*a1a3b679SAndreas Boehler                $pdo->exec($query);
28*a1a3b679SAndreas Boehler        }
29*a1a3b679SAndreas Boehler        $this->pdo = $pdo;
30*a1a3b679SAndreas Boehler
31*a1a3b679SAndreas Boehler    }
32*a1a3b679SAndreas Boehler
33*a1a3b679SAndreas Boehler    function teardown() {
34*a1a3b679SAndreas Boehler
35*a1a3b679SAndreas Boehler        $this->pdo = null;
36*a1a3b679SAndreas Boehler
37*a1a3b679SAndreas Boehler    }
38*a1a3b679SAndreas Boehler
39*a1a3b679SAndreas Boehler}
40