Skip to content

Commit e3b6682

Browse files
committed
Making db connection url a parameter of PHPUnit file
1 parent 503c5e8 commit e3b6682

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

phpunit.xml.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
syntaxCheck="false"
1212
bootstrap="tests/bootstrap.php"
1313
>
14+
15+
<php>
16+
<var name="db_url" value="mysql://root:@localhost/"/>
17+
</php>
18+
1419
<testsuites>
1520
<testsuite name="Mouf Test Suite">
1621
<directory>./tests/</directory>

tests/Mouf/Database/MagicQuery/Twig/SqlTwigEnvironmentFactoryTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ class SqlTwigEnvironmentFactoryTest extends \PHPUnit_Framework_TestCase
1111
{
1212
public function getTwigWithConnection()
1313
{
14+
global $db_url;
1415
$config = new \Doctrine\DBAL\Configuration();
1516
// TODO: put this in conf variable
1617
$connectionParams = array(
17-
'url' => 'mysql://root:@localhost/',
18+
'url' => $db_url,
1819
);
1920
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
2021

tests/Mouf/Database/MagicQueryTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ public function testStandardSelect()
4040
}
4141

4242
public function testWithCache() {
43+
global $db_url;
4344
$config = new \Doctrine\DBAL\Configuration();
4445
// TODO: put this in conf variable
4546
$connectionParams = array(
46-
'url' => 'mysql://root:@localhost/',
47+
'url' => $db_url,
4748
);
4849
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
4950

0 commit comments

Comments
 (0)