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())
|
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 = new \Doctrine\ORM\Configuration();
|
||||||
$config->setAutoGenerateProxyClasses(true);
|
$config->setAutoGenerateProxyClasses(true);
|
||||||
$config->setProxyDir(\sys_get_temp_dir());
|
$config->setProxyDir(\sys_get_temp_dir());
|
||||||
|
|
|
@ -21,6 +21,10 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testCollect()
|
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 = new Request();
|
||||||
$request->query->set('foo', 'bar');
|
$request->query->set('foo', 'bar');
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
|
|
|
@ -35,6 +35,9 @@ class SqliteProfilerStorageTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
protected function setUp()
|
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();
|
self::$storage->purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ use Doctrine\DBAL\DriverManager;
|
||||||
*/
|
*/
|
||||||
class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
/** @var \Doctrine\DBAL\Connection */
|
||||||
protected $con;
|
protected $con;
|
||||||
protected $insertClassStmt;
|
protected $insertClassStmt;
|
||||||
protected $insertSidStmt;
|
protected $insertSidStmt;
|
||||||
|
@ -31,12 +32,17 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->con = DriverManager::getConnection(array(
|
try {
|
||||||
'driver' => 'pdo_mysql',
|
$this->con = DriverManager::getConnection(array(
|
||||||
'host' => 'localhost',
|
'driver' => 'pdo_mysql',
|
||||||
'user' => 'root',
|
'host' => 'localhost',
|
||||||
'dbname' => 'testdb',
|
'user' => 'root',
|
||||||
));
|
'dbname' => 'testdb',
|
||||||
|
));
|
||||||
|
$this->con->connect();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->markTestSkipped('Unable to connect to the database: '.$e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
|
|
|
@ -127,6 +127,10 @@ class AclProviderTest extends \PHPUnit_Framework_TestCase
|
||||||
if (!class_exists('Doctrine\DBAL\DriverManager')) {
|
if (!class_exists('Doctrine\DBAL\DriverManager')) {
|
||||||
$this->markTestSkipped('The Doctrine2 DBAL is required for this test');
|
$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(
|
$this->con = DriverManager::getConnection(array(
|
||||||
'driver' => 'pdo_sqlite',
|
'driver' => 'pdo_sqlite',
|
||||||
'memory' => true,
|
'memory' => true,
|
||||||
|
|
|
@ -432,6 +432,10 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase
|
||||||
if (!class_exists('Doctrine\DBAL\DriverManager')) {
|
if (!class_exists('Doctrine\DBAL\DriverManager')) {
|
||||||
$this->markTestSkipped('The Doctrine2 DBAL is required for this test');
|
$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(
|
$this->con = DriverManager::getConnection(array(
|
||||||
'driver' => 'pdo_sqlite',
|
'driver' => 'pdo_sqlite',
|
||||||
'memory' => true,
|
'memory' => true,
|
||||||
|
|
Reference in New Issue