diff --git a/autoload.php b/autoload.php
index 036e4bc..2fad55f 100644
--- a/autoload.php
+++ b/autoload.php
@@ -25,7 +25,7 @@ namespace Query;
* Reference to root path
* @subpackage Core
*/
-if ( ! defined('QBASE_PATH')) define('QBASE_PATH', dirname(__FILE__).'/');
+if ( ! defined('QBASE_PATH')) define('QBASE_PATH', dirname(__FILE__).'/src/');
/**
* Path to driver classes
@@ -39,24 +39,7 @@ require(QBASE_PATH.'common.php');
// Load Query Classes
spl_autoload_register(function ($class)
{
- /*$class_segments = explode('\\', $class);
- $driver_class = strtolower(array_pop($class_segments));
-
- // Load DB Driver classes
- $driver_path = QDRIVER_PATH . "{$driver_class}";
- if ($class_segments == array('Query', 'Driver') && is_dir($driver_path))
- {
-
- // Firebird is a special case, since it's not a PDO driver
- // @codeCoverageIgnoreStart
- if (function_exists('\\fbird_connect') && $driver_class === 'firebird')
- {
- array_map('\\do_include', glob("{$driver_path}/*.php"));
- }
- // @codeCoverageIgnoreEnd
- }*/
-
- // Load other classes
+ // Load by namespace
$path = str_replace('\\', DIRECTORY_SEPARATOR, $class);
$file = QBASE_PATH . "{$path}.php";
diff --git a/phpci.yml b/phpci.yml
index a558e36..540e001 100644
--- a/phpci.yml
+++ b/phpci.yml
@@ -8,8 +8,6 @@ setup:
PHPCI: true
test:
- php_unit:
- config: 'phpunit.xml'
php_docblock_checker:
allowed_warnings: 0
skip_classes: true
diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml
index 828ed69..c390473 100644
--- a/phpdoc.dist.xml
+++ b/phpdoc.dist.xml
@@ -11,10 +11,8 @@
- .
- tests
- coverage
- vendor
+ autoload.php
+ src/*
tests/*
coverage/*
vendor/*
diff --git a/phpunit.xml b/phpunit.xml
index f53be02..55da055 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,5 +1,4 @@
-
tests/databases/firebird/FirebirdQBTest.php
- tests/databases/pdo_firebird/PDOFirebirdTest.php
- tests/databases/pdo_firebird/PDOFirebirdQBTest.php
+ tests/databases/pdofirebird/PDOFirebirdTest.php
+ tests/databases/pdofirebird/PDOFirebirdQBTest.php
\ No newline at end of file
diff --git a/Query/Abstract_Driver.php b/src/Query/Abstract_Driver.php
similarity index 100%
rename from Query/Abstract_Driver.php
rename to src/Query/Abstract_Driver.php
diff --git a/Query/Abstract_Query_Builder.php b/src/Query/Abstract_Query_Builder.php
similarity index 100%
rename from Query/Abstract_Query_Builder.php
rename to src/Query/Abstract_Query_Builder.php
diff --git a/Query/Abstract_SQL.php b/src/Query/Abstract_SQL.php
similarity index 100%
rename from Query/Abstract_SQL.php
rename to src/Query/Abstract_SQL.php
diff --git a/Query/Abstract_Util.php b/src/Query/Abstract_Util.php
similarity index 100%
rename from Query/Abstract_Util.php
rename to src/Query/Abstract_Util.php
diff --git a/Query/BadDBDriverException.php b/src/Query/BadDBDriverException.php
similarity index 100%
rename from Query/BadDBDriverException.php
rename to src/Query/BadDBDriverException.php
diff --git a/Query/Connection_Manager.php b/src/Query/Connection_Manager.php
similarity index 100%
rename from Query/Connection_Manager.php
rename to src/Query/Connection_Manager.php
diff --git a/Query/Driver_Interface.php b/src/Query/Driver_Interface.php
similarity index 100%
rename from Query/Driver_Interface.php
rename to src/Query/Driver_Interface.php
diff --git a/Query/Drivers/Firebird/Driver.php b/src/Query/Drivers/Firebird/Driver.php
similarity index 100%
rename from Query/Drivers/Firebird/Driver.php
rename to src/Query/Drivers/Firebird/Driver.php
diff --git a/Query/Drivers/Firebird/Result.php b/src/Query/Drivers/Firebird/Result.php
similarity index 100%
rename from Query/Drivers/Firebird/Result.php
rename to src/Query/Drivers/Firebird/Result.php
diff --git a/Query/Drivers/Firebird/SQL.php b/src/Query/Drivers/Firebird/SQL.php
similarity index 100%
rename from Query/Drivers/Firebird/SQL.php
rename to src/Query/Drivers/Firebird/SQL.php
diff --git a/Query/Drivers/Firebird/Util.php b/src/Query/Drivers/Firebird/Util.php
similarity index 100%
rename from Query/Drivers/Firebird/Util.php
rename to src/Query/Drivers/Firebird/Util.php
diff --git a/Query/Drivers/Mysql/Driver.php b/src/Query/Drivers/Mysql/Driver.php
similarity index 100%
rename from Query/Drivers/Mysql/Driver.php
rename to src/Query/Drivers/Mysql/Driver.php
diff --git a/Query/Drivers/Mysql/SQL.php b/src/Query/Drivers/Mysql/SQL.php
similarity index 100%
rename from Query/Drivers/Mysql/SQL.php
rename to src/Query/Drivers/Mysql/SQL.php
diff --git a/Query/Drivers/Mysql/Util.php b/src/Query/Drivers/Mysql/Util.php
similarity index 100%
rename from Query/Drivers/Mysql/Util.php
rename to src/Query/Drivers/Mysql/Util.php
diff --git a/Query/Drivers/Pdo_firebird/Driver.php b/src/Query/Drivers/Pdo_firebird/Driver.php
similarity index 100%
rename from Query/Drivers/Pdo_firebird/Driver.php
rename to src/Query/Drivers/Pdo_firebird/Driver.php
diff --git a/Query/Drivers/Pdo_firebird/SQL.php b/src/Query/Drivers/Pdo_firebird/SQL.php
similarity index 100%
rename from Query/Drivers/Pdo_firebird/SQL.php
rename to src/Query/Drivers/Pdo_firebird/SQL.php
diff --git a/Query/Drivers/Pdo_firebird/Util.php b/src/Query/Drivers/Pdo_firebird/Util.php
similarity index 100%
rename from Query/Drivers/Pdo_firebird/Util.php
rename to src/Query/Drivers/Pdo_firebird/Util.php
diff --git a/Query/Drivers/Pgsql/Driver.php b/src/Query/Drivers/Pgsql/Driver.php
similarity index 100%
rename from Query/Drivers/Pgsql/Driver.php
rename to src/Query/Drivers/Pgsql/Driver.php
diff --git a/Query/Drivers/Pgsql/SQL.php b/src/Query/Drivers/Pgsql/SQL.php
similarity index 100%
rename from Query/Drivers/Pgsql/SQL.php
rename to src/Query/Drivers/Pgsql/SQL.php
diff --git a/Query/Drivers/Pgsql/Util.php b/src/Query/Drivers/Pgsql/Util.php
similarity index 100%
rename from Query/Drivers/Pgsql/Util.php
rename to src/Query/Drivers/Pgsql/Util.php
diff --git a/Query/Drivers/Sqlite/Driver.php b/src/Query/Drivers/Sqlite/Driver.php
similarity index 100%
rename from Query/Drivers/Sqlite/Driver.php
rename to src/Query/Drivers/Sqlite/Driver.php
diff --git a/Query/Drivers/Sqlite/SQL.php b/src/Query/Drivers/Sqlite/SQL.php
similarity index 100%
rename from Query/Drivers/Sqlite/SQL.php
rename to src/Query/Drivers/Sqlite/SQL.php
diff --git a/Query/Drivers/Sqlite/Util.php b/src/Query/Drivers/Sqlite/Util.php
similarity index 100%
rename from Query/Drivers/Sqlite/Util.php
rename to src/Query/Drivers/Sqlite/Util.php
diff --git a/Query/Query_Builder.php b/src/Query/Query_Builder.php
similarity index 100%
rename from Query/Query_Builder.php
rename to src/Query/Query_Builder.php
diff --git a/Query/Query_Builder_Interface.php b/src/Query/Query_Builder_Interface.php
similarity index 100%
rename from Query/Query_Builder_Interface.php
rename to src/Query/Query_Builder_Interface.php
diff --git a/Query/Query_Parser.php b/src/Query/Query_Parser.php
similarity index 100%
rename from Query/Query_Parser.php
rename to src/Query/Query_Parser.php
diff --git a/Query/SQL_Interface.php b/src/Query/SQL_Interface.php
similarity index 100%
rename from Query/SQL_Interface.php
rename to src/Query/SQL_Interface.php
diff --git a/common.php b/src/common.php
similarity index 100%
rename from common.php
rename to src/common.php
diff --git a/tests/databases/pdo_firebird/PDOFirebirdQBTest.php b/tests/databases/pdofirebird/PDOFirebirdQBTest.php
similarity index 100%
rename from tests/databases/pdo_firebird/PDOFirebirdQBTest.php
rename to tests/databases/pdofirebird/PDOFirebirdQBTest.php
diff --git a/tests/databases/pdo_firebird/PDOFirebirdTest.php b/tests/databases/pdofirebird/PDOFirebirdTest.php
similarity index 100%
rename from tests/databases/pdo_firebird/PDOFirebirdTest.php
rename to tests/databases/pdofirebird/PDOFirebirdTest.php
diff --git a/tests/databases/pgsql/PgSQLQBTest.php b/tests/databases/pgsql/PgSQLQBTest.php
index b1b40f3..286f904 100644
--- a/tests/databases/pgsql/PgSQLQBTest.php
+++ b/tests/databases/pgsql/PgSQLQBTest.php
@@ -36,7 +36,7 @@ class PgSQLQBTest extends QBTest {
$params->options = array();
$params->options[\PDO::ATTR_PERSISTENT] = TRUE;
}
- elseif (($var = getenv('CI'))) // Travis CI Connection Info
+ elseif (getenv('CI')) // Travis CI Connection Info
{
$params = array(
'host' => '127.0.0.1',
@@ -63,8 +63,11 @@ class PgSQLQBTest extends QBTest {
public function testQueryExplain()
{
-$this->markTestSkipped();
-return;
+ if (getenv('CI'))
+ {
+ $this->markTestSkipped("Skip this test on CI, because the check is Postgres version dependent");
+ }
+
$query = $this->db->select('id, key as k, val')
->explain()
->where('id >', 1)
@@ -75,13 +78,13 @@ return;
$expected = array (
array (
- 'QUERY PLAN' => 'Limit (cost=6.41..10.64 rows=2 width=68)',
+ 'QUERY PLAN' => 'Limit (cost=6.31..10.54 rows=2 width=68)',
),
array (
'QUERY PLAN' => ' Output: id, key, val',
),
array (
- 'QUERY PLAN' => ' -> Bitmap Heap Scan on public.create_test (cost=4.29..12.76 rows=4 width=68)',
+ 'QUERY PLAN' => ' -> Bitmap Heap Scan on public.create_test (cost=4.19..12.66 rows=4 width=68)',
),
array (
'QUERY PLAN' => ' Output: id, key, val',
@@ -90,7 +93,7 @@ return;
'QUERY PLAN' => ' Recheck Cond: ((create_test.id > 1) AND (create_test.id < 900))',
),
array (
- 'QUERY PLAN' => ' -> Bitmap Index Scan on create_test_pkey (cost=0.00..4.29 rows=4 width=0)',
+ 'QUERY PLAN' => ' -> Bitmap Index Scan on create_test_pkey (cost=0.00..4.19 rows=4 width=0)',
),
array (
'QUERY PLAN' => ' Index Cond: ((create_test.id > 1) AND (create_test.id < 900))',
diff --git a/tests/index.php b/tests/index.php
index 176fb01..408ff24 100644
--- a/tests/index.php
+++ b/tests/index.php
@@ -39,6 +39,18 @@ require_once('/htdocs/__lib/simpletest/autorun.php');
*/
abstract class Query_TestCase extends UnitTestCase {
+ public function __construct()
+ {
+ $class = get_class($this);
+
+ if (method_exists($class, 'setupBeforeClass'))
+ {
+ $class::setupBeforeClass();
+ }
+
+ parent::__construct();
+ }
+
/**
* Define assertInstanceOf for simpletest
*
@@ -86,21 +98,6 @@ define('QDS', DIRECTORY_SEPARATOR);
// Include db classes
require_once(QBASE_DIR . 'autoload.php');
-// Preset SQLite connection, so there aren't locking issues
-$params = array(
- 'type' => 'sqlite',
- 'file' => ':memory:',
- 'host' => 'localhost',
- 'prefix' => 'create_',
- 'alias' => 'test_sqlite',
- 'options' => array(
- PDO::ATTR_PERSISTENT => TRUE
- )
-);
-
-Query($params);
-unset($params);
-
// Include db tests
// Load db classes based on capability
$test_path = QTEST_DIR.'/databases/';
@@ -118,9 +115,11 @@ if (function_exists('fbird_connect'))
}
$driver_test_map = array(
- 'Firebird' => in_array('interbase', $drivers),
+ //'Firebird' => in_array('interbase', $drivers),
+ 'MySQL' => in_array('mysql', $drivers),
'SQLite' => in_array('sqlite', $drivers),
'PgSQL' => in_array('pgsql', $drivers),
+ //'PDOFirebird' => in_array('firebird', $drivers)
);
// Determine which testcases to load
@@ -128,7 +127,7 @@ foreach($driver_test_map as $name => $do_load)
{
$path = $test_path . strtolower($name) . '/';
- if ($do_load && ($name != 'SQLite' && ! IS_QUERCUS))
+ if ($do_load && (! IS_QUERCUS))
{
require_once("{$path}{$name}Test.php");
require_once("{$path}{$name}QBTest.php");