Fix broken tests

This commit is contained in:
Timothy Warren 2013-12-06 23:37:43 -05:00
parent 617246d1d7
commit 7397b95e8b
6 changed files with 23 additions and 7 deletions

View File

@ -20,7 +20,7 @@
"role": "Developer"
}],
"require-dev": {
"phpunit/php-code-coverage": ">=1.2.10,<1.3.0",
"phpunit/php-code-coverage": ">=1.2.10,<1.3.0"
},
"require": {
"php": ">=5.2.0"

View File

@ -793,11 +793,11 @@ abstract class QBTest extends UnitTestCase {
public function TestGetCompiledSelect()
{
$sql = $this->db->from('create_test')->get_compled_select('', FALSE);
$qb_res = $this->db->get();
$sql = $this->db->get_compiled_select('create_test');
$qb_res = $this->db->get('create_test');
$sql_res = $this->db->query($sql);
$this->assertEqual($qb_res, $sql_res);
$this->assertClone($qb_res, $sql_res);
}
// --------------------------------------------------------------------------

View File

@ -39,6 +39,16 @@ class FirebirdQBTest extends QBTest {
}
// --------------------------------------------------------------------------
public function TestGetCompiledSelect()
{
$sql = $this->db->get_compiled_select('create_test');
$qb_res = $this->db->get('create_test');
$sql_res = $this->db->query($sql);
$this->assertIsA($qb_res, 'Firebird_Result');
$this->assertIsA($sql_res, 'Firebird_Result');
}
public function TestInsertBatch()
{

Binary file not shown.

View File

@ -21,9 +21,15 @@ define('QBASE_DIR', str_replace(basename(QTEST_DIR), '', QTEST_DIR));
define('QDS', DIRECTORY_SEPARATOR);
// Include simpletest
// it has to be set in your php path, or put in the tests folder
// it has to be in the tests folder
require_once('simpletest/autorun.php');
// Require composer items, if they exist
if (is_dir(QBASE_DIR.'/vendor/'))
{
require_once(QBASE_DIR.'/vendor/autoload.php');
}
// Include db classes
require_once(QBASE_DIR . 'autoload.php');

View File

@ -51,12 +51,12 @@ function run_local_tests() {
$suite = $loader->createSuiteFromClasses(
basename(initial_file()),
$loader->selectRunnableTests($candidates));
if (function_exists("xdebug_start_code_coverage")) {
if (function_exists("xdebug_start_code_coverage") && is_dir(QBASE_DIR.'/vendor/')) {
$coverage = new PHP_CodeCoverage;
$coverage->start('Query');
}
$ret = $suite->run(new DefaultReporter());
if (function_exists("xdebug_start_code_coverage")) {
if (function_exists("xdebug_start_code_coverage") && is_dir(QBASE_DIR.'/vendor/')) {
$coverage->stop();
$writer = new PHP_CodeCoverage_Report_HTML;
$writer->process($coverage, QBASE_DIR . '/coverage/');