Skip to content

Commit 1c47abd

Browse files
committed
Fix tests to be able to finish it without a fatal error
1 parent b4d3b6e commit 1c47abd

File tree

6 files changed

+32
-64
lines changed

6 files changed

+32
-64
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
tests/DoctrineTest/doctrine_tests/*
2-
*TestCase.php
2+
*TestCase.php
3+
/tests/tmp

.travis.yml

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

15+
services:
16+
- mysql
17+
1518
matrix:
1619
include:
1720
- php: "5.3"
@@ -21,5 +24,8 @@ matrix:
2124
- php: nightly
2225
- php: hhvm
2326

27+
before_install:
28+
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
29+
2430
script:
25-
- php -dshort_open_tag=Off -dmagic_quotes_gpc=Off tests/index.php
31+
- "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: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,28 @@ public function testDropDatabases()
164164

165165
public function testConnectionInformationDecoded()
166166
{
167+
$conn = null;
168+
$thrownException = null;
167169
$dsn = 'mysql://' . urlencode('test/t') . ':' . urlencode('p@ssword') . '@localhost/' . urlencode('db/name');
168170

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

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');
175+
$this->assertEqual($options['username'], 'test/t');
176+
$this->assertEqual($options['password'], 'p@ssword');
177+
$this->assertEqual($options['dsn'], 'mysql:host=localhost;dbname=db/name');
178+
} catch (Exception $e) {
179+
$thrownException = $e;
180+
}
181+
182+
if (null !== $conn) {
183+
Doctrine_Manager::getInstance()->closeConnection($conn);
184+
}
185+
186+
if (null !== $thrownException) {
187+
throw $thrownException;
188+
}
175189
}
176190
public function prepareData() { }
177191
public function prepareTables() { }

tests/tmp/Ticket_1527_User.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/tmp/generated/BaseTicket_1527_User.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)