From a83f063c2cebd50515b99e6ccab5afab4c958c06 Mon Sep 17 00:00:00 2001 From: tiyowan Date: Fri, 16 Mar 2012 23:52:43 +0400 Subject: Add unit tests for form_helper.php * Does not test form_open() and form_open_multipart() * Does not test set_value(), set_select(), set_checkbox() and set_radio() * Above are in progress and will be added once certain issues are resolved --- tests/codeigniter/helpers/form_helper_test.php | 252 +++++++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 tests/codeigniter/helpers/form_helper_test.php (limited to 'tests') diff --git a/tests/codeigniter/helpers/form_helper_test.php b/tests/codeigniter/helpers/form_helper_test.php new file mode 100644 index 000000000..80bace9d1 --- /dev/null +++ b/tests/codeigniter/helpers/form_helper_test.php @@ -0,0 +1,252 @@ + + +EOH; + + $this->assertEquals($expected, form_hidden('username', 'johndoe')); + } + + public function test_form_input() + { + $expected = << + +EOH; + + $data = array( + 'name' => 'username', + 'id' => 'username', + 'value' => 'johndoe', + 'maxlength' => '100', + 'size' => '50', + 'style' => 'width:50%', + ); + + $this->assertEquals($expected, form_input($data)); + } + + public function test_form_password() + { + $expected = << + +EOH; + + $this->assertEquals($expected, form_password('password')); + } + + public function test_form_upload() + { + $expected = << + +EOH; + + $this->assertEquals($expected, form_upload('attachment')); + } + + public function test_form_textarea() + { + $expected = <<Notes + +EOH; + + $this->assertEquals($expected, form_textarea('notes', 'Notes')); + } + + public function test_form_dropdown() + { + $expected = << + + + + + + +EOH; + + $options = array( + 'small' => 'Small Shirt', + 'med' => 'Medium Shirt', + 'large' => 'Large Shirt', + 'xlarge' => 'Extra Large Shirt', + ); + + $this->assertEquals($expected, form_dropdown('shirts', $options, 'large')); + + $expected = << + + + + + + +EOH; + + $shirts_on_sale = array('small', 'large'); + + $this->assertEquals($expected, form_dropdown('shirts', $options, $shirts_on_sale)); + + $options = array( + 'Swedish Cars' => array( + 'volvo' => 'Volvo', + 'saab' => 'Saab' + ), + 'German Cars' => array( + 'mercedes' => 'Mercedes', + 'audi' => 'Audi' + ) + ); + + $expected = << + + + + + + + + + + +EOH; + + $cars_on_sale = array('volvo', 'audi'); + + $this->assertEquals($expected, form_dropdown('cars', $options, $cars_on_sale)); + + } + + public function test_form_multiselect() + { + $expected = << + + + + + + +EOH; + + $options = array( + 'small' => 'Small Shirt', + 'med' => 'Medium Shirt', + 'large' => 'Large Shirt', + 'xlarge' => 'Extra Large Shirt', + ); + + $this->assertEquals($expected, form_multiselect('shirts[]', $options, array('med', 'large'))); + } + + public function test_form_fieldset() + { + $expected = << +Address Information + +EOH; + + $this->assertEquals($expected, form_fieldset('Address Information')); + } + + public function test_form_fieldset_close() + { + $expected = << +EOH; + + $this->assertEquals($expected, form_fieldset_close('')); + } + + public function test_form_checkbox() + { + $expected = << + +EOH; + + $this->assertEquals($expected, form_checkbox('newsletter', 'accept', TRUE)); + } + + public function test_form_radio() + { + $expected = << + +EOH; + + $this->assertEquals($expected, form_radio('newsletter', 'accept', TRUE)); + } + + public function test_form_submit() + { + $expected = << + +EOH; + + $this->assertEquals($expected, form_submit('mysubmit', 'Submit Post!')); + } + + public function test_form_label() + { + $expected = <<What is your Name +EOH; + + $this->assertEquals($expected, form_label('What is your Name', 'username')); + } + + public function test_form_reset() + { + $expected = << + +EOH; + + $this->assertEquals($expected, form_reset('myreset', 'Reset')); + } + + public function test_form_button() + { + $expected = <<content + +EOH; + + $this->assertEquals($expected, form_button('name','content')); + } + + public function test_form_close() + { + $expected = << +EOH; + + $this->assertEquals($expected, form_close('')); + } + + public function test_form_prep() + { + $expected = "Here is a string containing "quoted" text."; + + $this->assertEquals($expected, form_prep('Here is a string containing "quoted" text.')); + } +} + +/* End of file form_helper_test.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 655a89f4059ebae017d1c4ec5f26aeb2cf4a3bae Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Thu, 29 Mar 2012 03:00:56 +0700 Subject: Preliminary Database Test --- tests/Bootstrap.php | 3 +++ tests/codeigniter/database/.gitkeep | 0 tests/codeigniter/database/DB_test.php | 44 ++++++++++++++++++++++++++++++++++ tests/mocks/database/.gitkeep | 0 tests/mocks/database/db.php | 43 +++++++++++++++++++++++++++++++++ tests/phpunit.xml | 5 +--- 6 files changed, 91 insertions(+), 4 deletions(-) delete mode 100644 tests/codeigniter/database/.gitkeep create mode 100644 tests/codeigniter/database/DB_test.php delete mode 100644 tests/mocks/database/.gitkeep create mode 100644 tests/mocks/database/db.php (limited to 'tests') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 9f89d1be8..e1649804f 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -6,6 +6,9 @@ error_reporting(E_ALL | E_STRICT); $dir = realpath(dirname(__FILE__)); +// Environment constants +define('ENVIRONMENT', 'testing'); + // Path constants define('PROJECT_BASE', realpath($dir.'/../').'/'); define('BASEPATH', PROJECT_BASE.'system/'); diff --git a/tests/codeigniter/database/.gitkeep b/tests/codeigniter/database/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/codeigniter/database/DB_test.php b/tests/codeigniter/database/DB_test.php new file mode 100644 index 000000000..c1930f5f2 --- /dev/null +++ b/tests/codeigniter/database/DB_test.php @@ -0,0 +1,44 @@ +db_config = new Mock_Database_DB(array( + 'mysql' => array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'travis', + 'password' => '', + 'database' => 'ci_test', + 'dbdriver' => 'mysql', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => TRUE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'autoinit' => TRUE, + 'stricton' => FALSE, + 'failover' => array(), + ), + )); + } + + // ------------------------------------------------------------------------ + + public function test_db_valid() + { + $db = DB($this->db_config->set_config('mysql'), TRUE); + + $this->assertTrue($db instanceof CI_DB); + $this->assertTrue($db instanceof CI_DB_Driver); + $this->assertTrue($db instanceof CI_DB_active_record); + $this->assertTrue($db instanceof CI_DB_mysql_driver); + } + +} \ No newline at end of file diff --git a/tests/mocks/database/.gitkeep b/tests/mocks/database/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/mocks/database/db.php b/tests/mocks/database/db.php new file mode 100644 index 000000000..d7a6351a0 --- /dev/null +++ b/tests/mocks/database/db.php @@ -0,0 +1,43 @@ +config = $config; + } + + public function set_config($group = 'default') + { + if ( ! isset($this->config[$group])) + { + throw new InvalidArgumentException('Group '.$group.' not exists'); + } + + if ( ! empty($this->config[$group]['dsn'])) + { + $dsn = $this->config[$group]['dsn']; + } + else + { + $config = $this->config[$group]; + $dsn = $config['dbdriver'].'://'.$config['username'].':'.$config['password'] + .'@'.$config['hostname'].'/'.$config['database']; + + } + + $params = array_slice($this->config[$group], 6); + + return $dsn.http_build_query($params); + } +} \ No newline at end of file diff --git a/tests/phpunit.xml b/tests/phpunit.xml index dfeecd19f..ffd2a1f0f 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -15,10 +15,7 @@ codeigniter/core codeigniter/helpers codeigniter/libraries - + codeigniter/database -- cgit v1.2.3-24-g4f1b From a8a2e3325c128ccdc941daba3bba10b78bf2d098 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Thu, 29 Mar 2012 03:56:46 +0700 Subject: Travis setup and minor cleanup --- tests/Bootstrap.php | 3 -- tests/codeigniter/database/DB_test.php | 45 ++++++++++++----------- tests/codeigniter/database/query_builder/.gitkeep | 0 tests/mocks/database/db.php | 45 +++++++++++++++++++---- tests/mocks/database/models/.gitkeep | 0 5 files changed, 61 insertions(+), 32 deletions(-) create mode 100644 tests/codeigniter/database/query_builder/.gitkeep create mode 100644 tests/mocks/database/models/.gitkeep (limited to 'tests') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index e1649804f..9f89d1be8 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -6,9 +6,6 @@ error_reporting(E_ALL | E_STRICT); $dir = realpath(dirname(__FILE__)); -// Environment constants -define('ENVIRONMENT', 'testing'); - // Path constants define('PROJECT_BASE', realpath($dir.'/../').'/'); define('BASEPATH', PROJECT_BASE.'system/'); diff --git a/tests/codeigniter/database/DB_test.php b/tests/codeigniter/database/DB_test.php index c1930f5f2..10e8dec64 100644 --- a/tests/codeigniter/database/DB_test.php +++ b/tests/codeigniter/database/DB_test.php @@ -2,11 +2,31 @@ class DB_test extends CI_TestCase { - public $db_config; + // ------------------------------------------------------------------------ - public function set_up() + public function test_db_invalid() { - $this->db_config = new Mock_Database_DB(array( + $db_config = new Mock_Database_DB(array( + 'undefined' => array( + 'dsn' => '', + 'hostname' => 'undefined', + 'username' => 'undefined', + 'password' => 'undefined', + 'database' => 'undefined', + 'dbdriver' => 'undefined', + ), + )); + + $this->setExpectedException('InvalidArgumentException', 'CI Error: Invalid DB driver'); + + Mock_Database_DB::DB($db_config->set_dsn('undefined'), TRUE); + } + + // ------------------------------------------------------------------------ + + public function test_db_valid() + { + $db_config = new Mock_Database_DB(array( 'mysql' => array( 'dsn' => '', 'hostname' => 'localhost', @@ -14,30 +34,13 @@ class DB_test extends CI_TestCase { 'password' => '', 'database' => 'ci_test', 'dbdriver' => 'mysql', - 'dbprefix' => '', - 'pconnect' => FALSE, - 'db_debug' => TRUE, - 'cache_on' => FALSE, - 'cachedir' => '', - 'char_set' => 'utf8', - 'dbcollat' => 'utf8_general_ci', - 'swap_pre' => '', - 'autoinit' => TRUE, - 'stricton' => FALSE, - 'failover' => array(), ), )); - } - // ------------------------------------------------------------------------ - - public function test_db_valid() - { - $db = DB($this->db_config->set_config('mysql'), TRUE); + $db = Mock_Database_DB::DB($db_config->set_dsn('mysql'), TRUE); $this->assertTrue($db instanceof CI_DB); $this->assertTrue($db instanceof CI_DB_Driver); - $this->assertTrue($db instanceof CI_DB_active_record); $this->assertTrue($db instanceof CI_DB_mysql_driver); } diff --git a/tests/codeigniter/database/query_builder/.gitkeep b/tests/codeigniter/database/query_builder/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tests/mocks/database/db.php b/tests/mocks/database/db.php index d7a6351a0..11e4a93bd 100644 --- a/tests/mocks/database/db.php +++ b/tests/mocks/database/db.php @@ -12,32 +12,61 @@ class Mock_Database_DB { */ public function __construct($config = array()) { - include_once(BASEPATH.'database/DB.php'); - $this->config = $config; } - public function set_config($group = 'default') + public function set_dsn($group = 'default') { if ( ! isset($this->config[$group])) { throw new InvalidArgumentException('Group '.$group.' not exists'); } - if ( ! empty($this->config[$group]['dsn'])) + $params = array( + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => TRUE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'autoinit' => TRUE, + 'stricton' => FALSE, + 'failover' => array() + ); + + $config = array_merge($this->config[$group], $params); + + if ( ! empty($config['dsn'])) { - $dsn = $this->config[$group]['dsn']; + $dsn = $config['dsn']; } else { - $config = $this->config[$group]; $dsn = $config['dbdriver'].'://'.$config['username'].':'.$config['password'] .'@'.$config['hostname'].'/'.$config['database']; } - $params = array_slice($this->config[$group], 6); + $other_params = array_slice($config, 6); + + return $dsn.http_build_query($other_params); + } + + public static function DB($group, $query_builder = FALSE) + { + include_once(BASEPATH.'database/DB.php'); + + try + { + $db = DB($group, $query_builder); + } + catch (Exception $e) + { + throw new InvalidArgumentException($e->getMessage()); + } - return $dsn.http_build_query($params); + return $db; } } \ No newline at end of file diff --git a/tests/mocks/database/models/.gitkeep b/tests/mocks/database/models/.gitkeep new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3-24-g4f1b From dba9437218a5d8bedb75464b943e8f920d220a25 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Thu, 29 Mar 2012 04:09:37 +0700 Subject: Add schema folder --- tests/mocks/database/models/.gitkeep | 0 tests/mocks/database/schema/.gitkeep | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/mocks/database/models/.gitkeep create mode 100644 tests/mocks/database/schema/.gitkeep (limited to 'tests') diff --git a/tests/mocks/database/models/.gitkeep b/tests/mocks/database/models/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/mocks/database/schema/.gitkeep b/tests/mocks/database/schema/.gitkeep new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3-24-g4f1b From ee2f5d08c64d96b7abc7195bcd1b6a3fd67b5b42 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 30 Mar 2012 06:29:11 +0700 Subject: Multi database setup --- tests/codeigniter/database/DB_test.php | 30 +++++++++++++------------- tests/mocks/database/ci_test.sqlite | Bin 0 -> 17408 bytes tests/mocks/database/config/mysql.php | 34 ++++++++++++++++++++++++++++++ tests/mocks/database/config/pgsql.php | 34 ++++++++++++++++++++++++++++++ tests/mocks/database/config/sqlite.php | 34 ++++++++++++++++++++++++++++++ tests/mocks/database/db.php | 35 ++++++++++++++++++++++++++++--- tests/phpunit.xml | 1 - tests/travis/mysql.phpunit.xml | 37 +++++++++++++++++++++++++++++++++ tests/travis/pgsql.phpunit.xml | 37 +++++++++++++++++++++++++++++++++ tests/travis/sqlite.phpunit.xml | 37 +++++++++++++++++++++++++++++++++ 10 files changed, 261 insertions(+), 18 deletions(-) create mode 100755 tests/mocks/database/ci_test.sqlite create mode 100644 tests/mocks/database/config/mysql.php create mode 100644 tests/mocks/database/config/pgsql.php create mode 100644 tests/mocks/database/config/sqlite.php create mode 100644 tests/travis/mysql.phpunit.xml create mode 100644 tests/travis/pgsql.phpunit.xml create mode 100644 tests/travis/sqlite.phpunit.xml (limited to 'tests') diff --git a/tests/codeigniter/database/DB_test.php b/tests/codeigniter/database/DB_test.php index 10e8dec64..9b93e223d 100644 --- a/tests/codeigniter/database/DB_test.php +++ b/tests/codeigniter/database/DB_test.php @@ -6,7 +6,7 @@ class DB_test extends CI_TestCase { public function test_db_invalid() { - $db_config = new Mock_Database_DB(array( + $connection = new Mock_Database_DB(array( 'undefined' => array( 'dsn' => '', 'hostname' => 'undefined', @@ -19,29 +19,31 @@ class DB_test extends CI_TestCase { $this->setExpectedException('InvalidArgumentException', 'CI Error: Invalid DB driver'); - Mock_Database_DB::DB($db_config->set_dsn('undefined'), TRUE); + Mock_Database_DB::DB($connection->set_dsn('undefined'), TRUE); } // ------------------------------------------------------------------------ public function test_db_valid() { - $db_config = new Mock_Database_DB(array( - 'mysql' => array( - 'dsn' => '', - 'hostname' => 'localhost', - 'username' => 'travis', - 'password' => '', - 'database' => 'ci_test', - 'dbdriver' => 'mysql', - ), - )); + $config = Mock_Database_DB::config(DB_DRIVER); + $connection = new Mock_Database_DB($config); + $db = Mock_Database_DB::DB($connection->set_dsn(DB_DRIVER), TRUE); + + $this->assertTrue($db instanceof CI_DB); + $this->assertTrue($db instanceof CI_DB_Driver); + } - $db = Mock_Database_DB::DB($db_config->set_dsn('mysql'), TRUE); + // ------------------------------------------------------------------------ + + public function test_db_failover() + { + $config = Mock_Database_DB::config(DB_DRIVER); + $connection = new Mock_Database_DB($config); + $db = Mock_Database_DB::DB($connection->set_dsn(DB_DRIVER.'_failover'), TRUE); $this->assertTrue($db instanceof CI_DB); $this->assertTrue($db instanceof CI_DB_Driver); - $this->assertTrue($db instanceof CI_DB_mysql_driver); } } \ No newline at end of file diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite new file mode 100755 index 000000000..37ce4f870 Binary files /dev/null and b/tests/mocks/database/ci_test.sqlite differ diff --git a/tests/mocks/database/config/mysql.php b/tests/mocks/database/config/mysql.php new file mode 100644 index 000000000..ace0a31b1 --- /dev/null +++ b/tests/mocks/database/config/mysql.php @@ -0,0 +1,34 @@ + array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'travis', + 'password' => '', + 'database' => 'ci_test', + 'dbdriver' => 'mysql', + ), + + // Database configuration with failover + 'mysql_failover' => array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'not_travis', + 'password' => 'wrong password', + 'database' => 'not_ci_test', + 'dbdriver' => 'mysql', + 'failover' => array( + array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'travis', + 'password' => '', + 'database' => 'ci_test', + 'dbdriver' => 'mysql', + ), + ), + ), +); \ No newline at end of file diff --git a/tests/mocks/database/config/pgsql.php b/tests/mocks/database/config/pgsql.php new file mode 100644 index 000000000..c06af8ce0 --- /dev/null +++ b/tests/mocks/database/config/pgsql.php @@ -0,0 +1,34 @@ + array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'postgres', + 'password' => '', + 'database' => 'ci_test', + 'dbdriver' => 'postgre', + ), + + // Database configuration with failover + 'pgsql_failover' => array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'not_travis', + 'password' => 'wrong password', + 'database' => 'not_ci_test', + 'dbdriver' => 'postgre', + 'failover' => array( + array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'postgres', + 'password' => '', + 'database' => 'ci_test', + 'dbdriver' => 'postgre', + ), + ), + ), +); \ No newline at end of file diff --git a/tests/mocks/database/config/sqlite.php b/tests/mocks/database/config/sqlite.php new file mode 100644 index 000000000..cf428f473 --- /dev/null +++ b/tests/mocks/database/config/sqlite.php @@ -0,0 +1,34 @@ + array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'sqlite', + 'password' => 'sqlite', + 'database' => realpath(__DIR__.'/..').'/ci_test.sqlite', + 'dbdriver' => 'sqlite', + ), + + // Database configuration with failover + 'sqlite_failover' => array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'sqlite', + 'password' => 'sqlite', + 'database' => '../not_exists.sqlite', + 'dbdriver' => 'sqlite', + 'failover' => array( + array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'sqlite', + 'password' => 'sqlite', + 'database' => realpath(__DIR__.'/..').'/ci_testf.sqlite', + 'dbdriver' => 'sqlite', + ), + ), + ), +); \ No newline at end of file diff --git a/tests/mocks/database/db.php b/tests/mocks/database/db.php index 11e4a93bd..43a0d391f 100644 --- a/tests/mocks/database/db.php +++ b/tests/mocks/database/db.php @@ -2,6 +2,9 @@ class Mock_Database_DB { + /** + * @var array DB configuration + */ private $config = array(); /** @@ -15,6 +18,12 @@ class Mock_Database_DB { $this->config = $config; } + /** + * Build DSN connection string for DB driver instantiate process + * + * @param string Group name + * @return string DSN Connection string + */ public function set_dsn($group = 'default') { if ( ! isset($this->config[$group])) @@ -25,7 +34,7 @@ class Mock_Database_DB { $params = array( 'dbprefix' => '', 'pconnect' => FALSE, - 'db_debug' => TRUE, + 'db_debug' => FALSE, 'cache_on' => FALSE, 'cachedir' => '', 'char_set' => 'utf8', @@ -33,7 +42,6 @@ class Mock_Database_DB { 'swap_pre' => '', 'autoinit' => TRUE, 'stricton' => FALSE, - 'failover' => array() ); $config = array_merge($this->config[$group], $params); @@ -51,9 +59,30 @@ class Mock_Database_DB { $other_params = array_slice($config, 6); - return $dsn.http_build_query($other_params); + return $dsn.'?'.http_build_query($other_params); } + /** + * Return a database config array + * + * @see ./config + * @param string Driver based configuration + * @return array + */ + public static function config($driver) + { + $dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR; + + return include($dir.'config'.DIRECTORY_SEPARATOR.$driver.'.php'); + } + + /** + * Main DB method wrapper + * + * @param string Group or DSN string + * @param bool + * @return object + */ public static function DB($group, $query_builder = FALSE) { include_once(BASEPATH.'database/DB.php'); diff --git a/tests/phpunit.xml b/tests/phpunit.xml index ffd2a1f0f..ffe460d9c 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -15,7 +15,6 @@ codeigniter/core codeigniter/helpers codeigniter/libraries - codeigniter/database diff --git a/tests/travis/mysql.phpunit.xml b/tests/travis/mysql.phpunit.xml new file mode 100644 index 000000000..44d6d6ed9 --- /dev/null +++ b/tests/travis/mysql.phpunit.xml @@ -0,0 +1,37 @@ + + + + + + + + + ../codeigniter/Setup_test.php + ../codeigniter/core + ../codeigniter/helpers + ../codeigniter/libraries + ../codeigniter/database + + + + + PEAR_INSTALL_DIR + PHP_LIBDIR + PROJECT_BASE.'tests' + '../../system/core/CodeIgniter.php' + + + + + + \ No newline at end of file diff --git a/tests/travis/pgsql.phpunit.xml b/tests/travis/pgsql.phpunit.xml new file mode 100644 index 000000000..9f52b40ae --- /dev/null +++ b/tests/travis/pgsql.phpunit.xml @@ -0,0 +1,37 @@ + + + + + + + + + ../codeigniter/Setup_test.php + ../codeigniter/core + ../codeigniter/helpers + ../codeigniter/libraries + ../codeigniter/database + + + + + PEAR_INSTALL_DIR + PHP_LIBDIR + PROJECT_BASE.'tests' + '../../system/core/CodeIgniter.php' + + + + + + \ No newline at end of file diff --git a/tests/travis/sqlite.phpunit.xml b/tests/travis/sqlite.phpunit.xml new file mode 100644 index 000000000..74ebb482b --- /dev/null +++ b/tests/travis/sqlite.phpunit.xml @@ -0,0 +1,37 @@ + + + + + + + + + ../codeigniter/Setup_test.php + ../codeigniter/core + ../codeigniter/helpers + ../codeigniter/libraries + ../codeigniter/database + + + + + PEAR_INSTALL_DIR + PHP_LIBDIR + PROJECT_BASE.'tests' + '../../system/core/CodeIgniter.php' + + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 2c4c5e1946293e1c7a834112a8d271e890cc1c71 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 30 Mar 2012 06:40:35 +0700 Subject: Configation based by environment constant, due Database test implementation accross drivers --- tests/phpunit.xml | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 tests/phpunit.xml (limited to 'tests') diff --git a/tests/phpunit.xml b/tests/phpunit.xml deleted file mode 100644 index ffe460d9c..000000000 --- a/tests/phpunit.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - ./codeigniter/Setup_test.php - codeigniter/core - codeigniter/helpers - codeigniter/libraries - - - - - PEAR_INSTALL_DIR - PHP_LIBDIR - PROJECT_BASE.'tests' - '../system/core/CodeIgniter.php' - - - - - - \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 6dfe76dfe4634971faeef197aa724c924a72d515 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 3 Apr 2012 12:42:59 +0300 Subject: Alter SQLite tests config to use the sqlite3 driver under PHP 5.4+ --- tests/mocks/database/config/sqlite.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/mocks/database/config/sqlite.php b/tests/mocks/database/config/sqlite.php index cf428f473..8665e208d 100644 --- a/tests/mocks/database/config/sqlite.php +++ b/tests/mocks/database/config/sqlite.php @@ -1,7 +1,8 @@ array( 'dsn' => '', @@ -9,7 +10,7 @@ return array( 'username' => 'sqlite', 'password' => 'sqlite', 'database' => realpath(__DIR__.'/..').'/ci_test.sqlite', - 'dbdriver' => 'sqlite', + 'dbdriver' => $dbdriver, ), // Database configuration with failover @@ -19,7 +20,7 @@ return array( 'username' => 'sqlite', 'password' => 'sqlite', 'database' => '../not_exists.sqlite', - 'dbdriver' => 'sqlite', + 'dbdriver' => $dbdriver, 'failover' => array( array( 'dsn' => '', @@ -27,7 +28,7 @@ return array( 'username' => 'sqlite', 'password' => 'sqlite', 'database' => realpath(__DIR__.'/..').'/ci_testf.sqlite', - 'dbdriver' => 'sqlite', + 'dbdriver' => $dbdriver, ), ), ), -- cgit v1.2.3-24-g4f1b