From 4536ead454a45be9316bb79b9c10967826017178 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 24 Jan 2017 16:14:20 -0600 Subject: [PATCH] Remove useless dependency on SQLite (non-PDO) * we only require the PDO driver * fixes #481 Signed-off-by: Morris Jobke --- lib/private/Setup.php | 8 +++----- tests/lib/SetupTest.php | 16 ++-------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 81a5343fe2103..d99977676846a 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -125,8 +125,8 @@ protected function getAvailableDbDriversForPdo() { public function getSupportedDatabases($allowAllDatabases = false) { $availableDatabases = array( 'sqlite' => array( - 'type' => 'class', - 'call' => 'SQLite3', + 'type' => 'pdo', + 'call' => 'sqlite', 'name' => 'SQLite' ), 'mysql' => array( @@ -163,9 +163,7 @@ public function getSupportedDatabases($allowAllDatabases = false) { $type = $availableDatabases[$database]['type']; $call = $availableDatabases[$database]['call']; - if($type === 'class') { - $working = $this->class_exists($call); - } elseif ($type === 'function') { + if ($type === 'function') { $working = $this->is_callable($call); } elseif($type === 'pdo') { $working = in_array($call, $this->getAvailableDbDriversForPdo(), TRUE); diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php index a8389eaaf5636..acbce938a25d4 100644 --- a/tests/lib/SetupTest.php +++ b/tests/lib/SetupTest.php @@ -53,10 +53,6 @@ public function testGetSupportedDatabasesWithOneWorking() { ->will($this->returnValue( array('sqlite', 'mysql', 'oci') )); - $this->setupClass - ->expects($this->once()) - ->method('class_exists') - ->will($this->returnValue(true)); $this->setupClass ->expects($this->once()) ->method('is_callable') @@ -64,7 +60,7 @@ public function testGetSupportedDatabasesWithOneWorking() { $this->setupClass ->expects($this->any()) ->method('getAvailableDbDriversForPdo') - ->will($this->returnValue([])); + ->will($this->returnValue(['sqlite'])); $result = $this->setupClass->getSupportedDatabases(); $expectedResult = array( 'sqlite' => 'SQLite' @@ -80,10 +76,6 @@ public function testGetSupportedDatabasesWithNoWorking() { ->will($this->returnValue( array('sqlite', 'mysql', 'oci', 'pgsql') )); - $this->setupClass - ->expects($this->any()) - ->method('class_exists') - ->will($this->returnValue(false)); $this->setupClass ->expects($this->any()) ->method('is_callable') @@ -104,10 +96,6 @@ public function testGetSupportedDatabasesWithAllWorking() { ->will($this->returnValue( array('sqlite', 'mysql', 'pgsql', 'oci') )); - $this->setupClass - ->expects($this->any()) - ->method('class_exists') - ->will($this->returnValue(true)); $this->setupClass ->expects($this->any()) ->method('is_callable') @@ -115,7 +103,7 @@ public function testGetSupportedDatabasesWithAllWorking() { $this->setupClass ->expects($this->any()) ->method('getAvailableDbDriversForPdo') - ->will($this->returnValue(['mysql', 'pgsql'])); + ->will($this->returnValue(['sqlite', 'mysql', 'pgsql'])); $result = $this->setupClass->getSupportedDatabases(); $expectedResult = array( 'sqlite' => 'SQLite',