| 1 | <?php |
||
| 6 | class BridgeTestCase extends FunctionalTestCase |
||
| 7 | { |
||
| 8 | /** |
||
| 9 | * @var Bridge |
||
| 10 | */ |
||
| 11 | protected $bridge; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var \PDO |
||
| 15 | */ |
||
| 16 | protected $db; |
||
| 17 | |||
| 18 | public function setUp() |
||
| 19 | { |
||
| 20 | $manager = new Manager(new \Mattbit\MysqlCompat\ConnectionFactory()); |
||
| 21 | $this->bridge = new Bridge($manager); |
||
| 22 | |||
| 23 | $this->bridge->connect($this->config['dbhost'], $this->config['dbuser'], $this->config['dbpass']); |
||
| 24 | $this->bridge->selectDb($this->config['dbname']); |
||
| 25 | |||
| 26 | $this->loadFixtures(); |
||
| 27 | } |
||
| 28 | |||
| 29 | protected function loadFixtures() |
||
| 30 | { |
||
| 31 | $dbname = $this->config['dbname']; |
||
| 32 | $dbhost = $this->config['dbhost']; |
||
| 33 | $dbuser = $this->config['dbuser']; |
||
| 34 | $dbpass = $this->config['dbpass']; |
||
| 35 | |||
| 36 | $this->db = new PDO("mysql:dbname=$dbname;host=$dbhost", $dbuser, $dbpass); |
||
| 37 | $sql = file_get_contents(__DIR__.'/fixtures.sql'); |
||
| 38 | $this->db->query($sql); |
||
| 39 | } |
||
| 40 | } |