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