Skipped tests when PDO is not available
This commit is contained in:
parent
f7c5bf1db2
commit
58c227681e
@ -30,6 +30,9 @@ abstract class DoctrineOrmTestCase extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
static public function createTestEntityManager($paths = array())
|
||||
{
|
||||
if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) {
|
||||
self::markTestSkipped('This test requires SQLite support in your environment');
|
||||
}
|
||||
$config = new \Doctrine\ORM\Configuration();
|
||||
$config->setAutoGenerateProxyClasses(true);
|
||||
$config->setProxyDir(\sys_get_temp_dir());
|
||||
|
@ -21,6 +21,10 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCollect()
|
||||
{
|
||||
if (!class_exists('SQLite3') && (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers()))) {
|
||||
$this->markTestSkipped('This test requires SQLite support in your environment');
|
||||
}
|
||||
|
||||
$request = new Request();
|
||||
$request->query->set('foo', 'bar');
|
||||
$response = new Response();
|
||||
|
@ -35,6 +35,9 @@ class SqliteProfilerStorageTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
if (!class_exists('SQLite3') && (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers()))) {
|
||||
$this->markTestSkipped('This test requires SQLite support in your environment');
|
||||
}
|
||||
self::$storage->purge();
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ use Doctrine\DBAL\DriverManager;
|
||||
*/
|
||||
class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** @var \Doctrine\DBAL\Connection */
|
||||
protected $con;
|
||||
protected $insertClassStmt;
|
||||
protected $insertSidStmt;
|
||||
@ -31,12 +32,17 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->con = DriverManager::getConnection(array(
|
||||
'driver' => 'pdo_mysql',
|
||||
'host' => 'localhost',
|
||||
'user' => 'root',
|
||||
'dbname' => 'testdb',
|
||||
));
|
||||
try {
|
||||
$this->con = DriverManager::getConnection(array(
|
||||
'driver' => 'pdo_mysql',
|
||||
'host' => 'localhost',
|
||||
'user' => 'root',
|
||||
'dbname' => 'testdb',
|
||||
));
|
||||
$this->con->connect();
|
||||
} catch (\Exception $e) {
|
||||
$this->markTestSkipped('Unable to connect to the database: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
|
@ -127,6 +127,10 @@ class AclProviderTest extends \PHPUnit_Framework_TestCase
|
||||
if (!class_exists('Doctrine\DBAL\DriverManager')) {
|
||||
$this->markTestSkipped('The Doctrine2 DBAL is required for this test');
|
||||
}
|
||||
if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) {
|
||||
self::markTestSkipped('This test requires SQLite support in your environment');
|
||||
}
|
||||
|
||||
$this->con = DriverManager::getConnection(array(
|
||||
'driver' => 'pdo_sqlite',
|
||||
'memory' => true,
|
||||
|
@ -432,6 +432,10 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase
|
||||
if (!class_exists('Doctrine\DBAL\DriverManager')) {
|
||||
$this->markTestSkipped('The Doctrine2 DBAL is required for this test');
|
||||
}
|
||||
if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) {
|
||||
self::markTestSkipped('This test requires SQLite support in your environment');
|
||||
}
|
||||
|
||||
$this->con = DriverManager::getConnection(array(
|
||||
'driver' => 'pdo_sqlite',
|
||||
'memory' => true,
|
||||
|
Reference in New Issue
Block a user