From 7397b95e8b248b39597a0122a1c0a37b8b2a832a Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Fri, 6 Dec 2013 23:37:43 -0500 Subject: [PATCH] Fix broken tests --- composer.json | 2 +- tests/core/db_qb_test.php | 6 +++--- tests/databases/firebird/firebird-qb.php | 10 ++++++++++ tests/db_files/FB_TEST_DB.FDB | Bin 802816 -> 802816 bytes tests/index.php | 8 +++++++- tests/simpletest/autorun.php | 4 ++-- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index c2fabf0..22f20e4 100644 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/tests/core/db_qb_test.php b/tests/core/db_qb_test.php index 97e3f0b..2f4d45f 100644 --- a/tests/core/db_qb_test.php +++ b/tests/core/db_qb_test.php @@ -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); } // -------------------------------------------------------------------------- diff --git a/tests/databases/firebird/firebird-qb.php b/tests/databases/firebird/firebird-qb.php index 201daa7..90af362 100644 --- a/tests/databases/firebird/firebird-qb.php +++ b/tests/databases/firebird/firebird-qb.php @@ -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() { diff --git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%WsJwvLO4;iv&mOgL;_3j3aRfl_K;ib^h z_Te3W>bVJ|M2Yj`-j?GdZf<6;$mc(|_1MHFqJJRx%Ao10!HYz$M zefu*laa0vM1Yq`(uLU^L<;$~}5+**QDNhgW;_5P2+6H%WP3NS`u0^gocuEYa$D24Q zW;DW;Oz&_l+U4alJi1r377Y8Pwv4q6XbINNn)b`q*5IkGwoA0erYYz#q8;s7ga(A{ zDLt!hFVLDnepru+|8!2ZMn@7L(0XC?(i-iCidREL2$)T39FlS+Oc%XR#~%fRqGlpg zppJ`Itydi(qRSq;5lYofo;gCEj?mb2dbAy#uvxlBn(lnW(wwX}tyfL0d!9V1H1u|4 z7#%9qNDK9?boYk|m9G%{P>xN&J?{tz?twc`lc)NP4%BbN$+WC)-@pO&Q3vzK$YBo@ zE8BY!C)rc#n+{gROPpyZL{|OT!Q94K1XnoTZI z|7~EY_cmkosYjbQtO_yakEXh`<6QOAm-r6dcbt8n)AyZiO7AC@@Qm8-;4=d{DVtP1 d$*J1zgzEMGJ(r`-_ElkS3^Ba*&kc0%{0}tYWUT-I diff --git a/tests/index.php b/tests/index.php index 205c515..a5905c3 100644 --- a/tests/index.php +++ b/tests/index.php @@ -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'); diff --git a/tests/simpletest/autorun.php b/tests/simpletest/autorun.php index 9145417..4a6c2d9 100644 --- a/tests/simpletest/autorun.php +++ b/tests/simpletest/autorun.php @@ -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/');