This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Making the tests work for MySQL and MySQLi drivers independent of the

overall suite(s).
  • Loading branch information...
LouisLandry committed Mar 8, 2012
1 parent 39ee45c commit ec1b6982c985c9b80b1f09dbe0b47501c4ada0c1
View
@@ -1,27 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
-<phpunit
- bootstrap="tests/bootstrap.php"
- colors="true">
+<phpunit bootstrap="tests/bootstrap.php" colors="false">
+
+ <!-- <php>
+ <const name="JTEST_DATABASE_MYSQL_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
+ <const name="JTEST_DATABASE_MYSQLI_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
+ </php> -->
<testsuite name="AllTests">
<directory>tests/suites</directory>
</testsuite>
<logging>
<log type="coverage-html" target="build/coverage" title="Joomla-Platform"
- charset="UTF-8" yui="true" highlight="true"
- lowUpperBound="35" highLowerBound="70"/>
- <log type="coverage-clover" target="build/logs/clover.xml"/>
- <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
+ charset="UTF-8" yui="true" highlight="true" lowUpperBound="35"
+ highLowerBound="70" />
+ <log type="coverage-clover" target="build/logs/clover.xml" />
+ <log type="junit" target="build/logs/junit.xml"
+ logIncompleteSkipped="false" />
</logging>
<filter>
- <whitelist addUncoveredFilesFromWhitelist="false">
- <directory suffix=".php">libraries/joomla</directory>
- <directory suffix=".php">libraries/legacy</directory>
- <file>libraries/import.php</file>
- <file>libraries/loader.php</file>
- <file>libraries/platform.php</file>
- </whitelist>
+ <whitelist addUncoveredFilesFromWhitelist="false">
+ <directory suffix=".php">libraries/joomla</directory>
+ <directory suffix=".php">libraries/legacy</directory>
+ <file>libraries/import.php</file>
+ <file>libraries/loader.php</file>
+ <file>libraries/platform.php</file>
+ </whitelist>
</filter>
</phpunit>
@@ -472,7 +472,7 @@ protected function setErrorCallback($testName)
*/
protected function setUp()
{
- if (empty(self::$driver))
+ if (empty(static::$driver))
{
$this->markTestSkipped('There is no database driver.');
}
@@ -48,6 +48,10 @@ public static function setUpBeforeClass()
{
$dsn = defined('JTEST_DATABASE_MYSQL_DSN') ? JTEST_DATABASE_MYSQL_DSN : getenv('JTEST_DATABASE_MYSQL_DSN');
}
+ else
+ {
+ return;
+ }
// First let's trim the mysql: part off the front of the DSN if it exists.
if (strpos($dsn, 'mysql:') === 0)
@@ -131,22 +135,4 @@ protected function getConnection()
return $this->createDefaultDBConnection($pdo, self::$_options['database']);
}
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @return void
- *
- * @since 12.1
- */
- protected function setUp()
- {
- if (empty(self::$driver))
- {
- $this->markTestSkipped('There is no configured MySQL database.');
- }
-
- parent::setUp();
- }
}
@@ -48,6 +48,10 @@ public static function setUpBeforeClass()
{
$dsn = defined('JTEST_DATABASE_MYSQLI_DSN') ? JTEST_DATABASE_MYSQLI_DSN : getenv('JTEST_DATABASE_MYSQLI_DSN');
}
+ else
+ {
+ return;
+ }
// First let's trim the mysql: part off the front of the DSN if it exists.
if (strpos($dsn, 'mysql:') === 0)
@@ -131,22 +135,4 @@ protected function getConnection()
return $this->createDefaultDBConnection($pdo, self::$_options['database']);
}
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @return void
- *
- * @since 12.1
- */
- protected function setUp()
- {
- if (empty(self::$driver))
- {
- $this->markTestSkipped('There is no configured MySQLi database.');
- }
-
- parent::setUp();
- }
}
@@ -48,6 +48,10 @@ public static function setUpBeforeClass()
{
$dsn = defined('JTEST_DATABASE_ORACLE_DSN') ? JTEST_DATABASE_ORACLE_DSN : getenv('JTEST_DATABASE_ORACLE_DSN');
}
+ else
+ {
+ return;
+ }
// First let's trim the oci: part off the front of the DSN if it exists.
if (strpos($dsn, 'oci:') === 0)
@@ -139,22 +143,4 @@ protected function getConnection()
return $this->createDefaultDBConnection($pdo, self::$_options['database']);
}
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @return void
- *
- * @since 12.1
- */
- protected function setUp()
- {
- if (empty(self::$driver))
- {
- $this->markTestSkipped('There is no configured Oracle database.');
- }
-
- parent::setUp();
- }
}
@@ -48,6 +48,10 @@ public static function setUpBeforeClass()
{
$dsn = defined('JTEST_DATABASE_POSTGRESQL_DSN') ? JTEST_DATABASE_POSTGRESQL_DSN : getenv('JTEST_DATABASE_POSTGRESQL_DSN');
}
+ else
+ {
+ return;
+ }
// First let's trim the pgsql: part off the front of the DSN if it exists.
if (strpos($dsn, 'pgsql:') === 0)
@@ -134,22 +138,4 @@ protected function getConnection()
return $this->createDefaultDBConnection($pdo, self::$_options['database']);
}
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @return void
- *
- * @since 12.1
- */
- protected function setUp()
- {
- if (empty(self::$driver))
- {
- $this->markTestSkipped('There is no configured PostgreSQL database.');
- }
-
- parent::setUp();
- }
}
Oops, something went wrong.

0 comments on commit ec1b698

Please sign in to comment.