Skip to content

Commit a09379f

Browse files
committed
Fix tests to be able to finish it without a fatal error
1 parent 92671a5 commit a09379f

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ php:
1111
- hhvm
1212
- nightly
1313

14+
services:
15+
- mysql
16+
1417
matrix:
1518
include:
1619
- php: "5.3"
@@ -20,5 +23,8 @@ matrix:
2023
- php: nightly
2124
- php: hhvm
2225

26+
before_install:
27+
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
28+
2329
script:
24-
- php -dshort_open_tag=Off -dmagic_quotes_gpc=Off tests/index.php
30+
- "cd tests && php -dshort_open_tag=Off -dmagic_quotes_gpc=Off run.php"

tests/Connection/CustomTestCase.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ public function testConnection()
4949

5050
class Doctrine_Connection_Test extends Doctrine_Connection_Common
5151
{
52-
52+
/**
53+
* @var string $driverName the name of this connection driver
54+
*/
55+
protected $driverName = 'Mock';
5356
}
5457

5558
class Doctrine_Adapter_Test implements Doctrine_Adapter_Interface

tests/ManagerTestCase.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,24 @@ public function testDropDatabases()
164164

165165
public function testConnectionInformationDecoded()
166166
{
167+
$e = null;
167168
$dsn = 'mysql://' . urlencode('test/t') . ':' . urlencode('p@ssword') . '@localhost/' . urlencode('db/name');
168169

169-
$conn = Doctrine_Manager::connection($dsn);
170-
$options = $conn->getOptions();
170+
try {
171+
$conn = Doctrine_Manager::connection($dsn);
172+
$options = $conn->getOptions();
171173

172-
$this->assertEqual($options['username'], 'test/t');
173-
$this->assertEqual($options['password'], 'p@ssword');
174-
$this->assertEqual($options['dsn'], 'mysql:host=localhost;dbname=db/name');
174+
$this->assertEqual($options['username'], 'test/t');
175+
$this->assertEqual($options['password'], 'p@ssword');
176+
$this->assertEqual($options['dsn'], 'mysql:host=localhost;dbname=db/name');
177+
} catch (Exception $e) {
178+
}
179+
180+
Doctrine_Manager::getInstance()->closeConnection($conn);
181+
182+
if (null !== $e) {
183+
throw $e;
184+
}
175185
}
176186
public function prepareData() { }
177187
public function prepareTables() { }

0 commit comments

Comments
 (0)