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