From 61a0aee144710228ea30afa672adf530623d35d5 Mon Sep 17 00:00:00 2001 From: Razican Date: Tue, 11 Nov 2014 12:36:21 +0200 Subject: Fixed tests Signed-off-by: Razican --- tests/codeigniter/core/URI_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/codeigniter/core/URI_test.php b/tests/codeigniter/core/URI_test.php index b05a385d6..4b1d644e3 100644 --- a/tests/codeigniter/core/URI_test.php +++ b/tests/codeigniter/core/URI_test.php @@ -138,7 +138,7 @@ class URI_test extends CI_TestCase { $str = $this->uri->filter_uri('$destroy_app(foo)'); - $this->assertEquals($str, '$destroy_app(foo)'); + $this->assertEquals($str, '$destroy_app(foo)'); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From bfa233f559a50ee0674a209fa56f866edc814fd9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 5 Dec 2014 12:00:11 +0200 Subject: Further changes related to issue #47, PR #3323 - Removed a test that was created specifically for the 'convert programmatic characters to entities' feature. - Changed filter_uri() to accept by reference and to not return anything as its only purpose now is to trigger a show_error() call. - Added changelog messages and updated the upgrade instructions. --- tests/codeigniter/core/URI_test.php | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'tests') diff --git a/tests/codeigniter/core/URI_test.php b/tests/codeigniter/core/URI_test.php index 4b1d644e3..adb62f6cb 100644 --- a/tests/codeigniter/core/URI_test.php +++ b/tests/codeigniter/core/URI_test.php @@ -119,26 +119,12 @@ class URI_test extends CI_TestCase { */ // -------------------------------------------------------------------- - public function test_filter_uri() + public function test_filter_uri_passing() { $this->uri->_set_permitted_uri_chars('a-z 0-9~%.:_\-'); - $str_in = 'abc01239~%.:_-'; - $str = $this->uri->filter_uri($str_in); - - $this->assertEquals($str, $str_in); - } - - // -------------------------------------------------------------------- - - public function test_filter_uri_escaping() - { - // ensure escaping even if dodgey characters are permitted - $this->uri->_set_permitted_uri_chars('a-z 0-9~%.:_\-()$'); - - $str = $this->uri->filter_uri('$destroy_app(foo)'); - - $this->assertEquals($str, '$destroy_app(foo)'); + $str = 'abc01239~%.:_-'; + $this->uri->filter_uri($str); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 82358c1f2ce5117a21e90f6ec96400535c5f4eed Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 5 Dec 2014 12:03:42 +0200 Subject: Fix a filter_uri() test --- tests/codeigniter/core/URI_test.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/codeigniter/core/URI_test.php b/tests/codeigniter/core/URI_test.php index adb62f6cb..50663d54a 100644 --- a/tests/codeigniter/core/URI_test.php +++ b/tests/codeigniter/core/URI_test.php @@ -135,7 +135,8 @@ class URI_test extends CI_TestCase { $this->uri->config->set_item('enable_query_strings', FALSE); $this->uri->_set_permitted_uri_chars('a-z 0-9~%.:_\-'); - $this->uri->filter_uri('$this()'); + $segment = '$this()'; // filter_uri() accepts by reference + $this->uri->filter_uri($segment); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From eceebe3bedfd635c41ce2d849bcb32766d1e6cb9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 15 Dec 2014 17:30:03 +0200 Subject: Remove minifier test --- tests/codeigniter/core/Output_test.php | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'tests') diff --git a/tests/codeigniter/core/Output_test.php b/tests/codeigniter/core/Output_test.php index 0eeb93f7b..a06c17045 100644 --- a/tests/codeigniter/core/Output_test.php +++ b/tests/codeigniter/core/Output_test.php @@ -38,16 +38,6 @@ HTML; // -------------------------------------------------------------------- - public function test_minify() - { - $this->assertEquals( - str_replace(array("\t", "\n"), '', $this->_output_data), - $this->output->minify($this->_output_data) - ); - } - - // -------------------------------------------------------------------- - public function test_get_content_type() { $this->assertEquals('text/html', $this->output->get_content_type()); -- cgit v1.2.3-24-g4f1b From 42bc6d51e15c180f35632d5c03c649225f8dbf74 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 16 Dec 2014 16:16:45 +0200 Subject: Fix #3419 --- tests/codeigniter/core/Config_test.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/codeigniter/core/Config_test.php b/tests/codeigniter/core/Config_test.php index 8e312e361..f125fc6e9 100644 --- a/tests/codeigniter/core/Config_test.php +++ b/tests/codeigniter/core/Config_test.php @@ -205,13 +205,18 @@ class Config_test extends CI_TestCase { 'number' => 42, 'letter' => 'Z' ); + $pkg_dir = 'package'; - $this->ci_vfs_create($file.'.php', 'ci_app_root, - array($pkg_dir, 'config')); - $this->config->_config_paths[] = $this->ci_vfs_path($pkg_dir.'/', APPPATH); + $this->ci_vfs_create( + $file.'.php', + 'ci_app_root, + array($pkg_dir, 'config') + ); + array_unshift($this->config->_config_paths, $this->ci_vfs_path($pkg_dir.'/', APPPATH)); $this->assertTrue($this->config->load($file, TRUE)); $this->assertEquals(array_merge($cfg, $cfg2), $this->config->item($file)); - array_pop($this->config->_config_paths); + array_shift($this->config->_config_paths); // Test graceful fail of invalid file $file = 'badfile'; -- cgit v1.2.3-24-g4f1b From 168ba6c18ca68248d16184c2518666bc19b6d2fb Mon Sep 17 00:00:00 2001 From: Dan Bernardic Date: Sat, 10 Jan 2015 21:11:01 -0600 Subject: Added a unit test for #3464 Signed-off-by: Dan Bernardic --- tests/codeigniter/core/Lang_test.php | 7 ++++++- tests/mocks/ci_testcase.php | 13 +++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/codeigniter/core/Lang_test.php b/tests/codeigniter/core/Lang_test.php index d3c7ee1e4..87a71c885 100644 --- a/tests/codeigniter/core/Lang_test.php +++ b/tests/codeigniter/core/Lang_test.php @@ -29,6 +29,11 @@ class Lang_test extends CI_TestCase { $this->assertTrue($this->lang->load('date')); $this->assertEquals('Year', $this->lang->language['date_year']); + // A language other than english + $this->ci_vfs_clone('system/language/english/email_lang.php', 'system/language/german/'); + $this->assertTrue($this->lang->load('email', 'german')); + $this->assertEquals('german', $this->lang->is_loaded['email_lang.php'] ); + // Non-alpha idiom (should act the same as unspecified language) $this->ci_vfs_clone('system/language/english/number_lang.php'); $this->assertTrue($this->lang->load('number')); @@ -56,4 +61,4 @@ class Lang_test extends CI_TestCase { $this->assertFalse($this->lang->line(NULL)); } -} \ No newline at end of file +} diff --git a/tests/mocks/ci_testcase.php b/tests/mocks/ci_testcase.php index ad4fe5ac3..a2c37b92e 100644 --- a/tests/mocks/ci_testcase.php +++ b/tests/mocks/ci_testcase.php @@ -274,14 +274,14 @@ class CI_TestCase extends PHPUnit_Framework_TestCase { * @param string Path from base directory * @return bool TRUE on success, otherwise FALSE */ - public function ci_vfs_clone($path) + public function ci_vfs_clone($path, $dest='') { // Check for array if (is_array($path)) { foreach ($path as $file) { - $this->ci_vfs_clone($file); + $this->ci_vfs_clone($file, $dest); } return; } @@ -294,7 +294,12 @@ class CI_TestCase extends PHPUnit_Framework_TestCase { return FALSE; } - $this->ci_vfs_create(basename($path), $content, NULL, dirname($path)); + if (empty($dest)) + { + $dest = dirname($path); + } + + $this->ci_vfs_create(basename($path), $content, NULL, $dest); return TRUE; } @@ -378,4 +383,4 @@ class CI_TestCase extends PHPUnit_Framework_TestCase { } } -} \ No newline at end of file +} -- cgit v1.2.3-24-g4f1b From d24652d4ef8232fa6cfd675aa80d1e182073a220 Mon Sep 17 00:00:00 2001 From: Dan Bernardic Date: Sun, 11 Jan 2015 22:01:23 -0600 Subject: Added support for running unit tests on PHP 5.2 Signed-off-by: Dan Bernardic --- tests/codeigniter/core/Output_test.php | 23 ++++++++++----------- tests/mocks/database/schema/skeleton.php | 34 ++++++++++++++++---------------- 2 files changed, 29 insertions(+), 28 deletions(-) (limited to 'tests') diff --git a/tests/codeigniter/core/Output_test.php b/tests/codeigniter/core/Output_test.php index a06c17045..887c077d7 100644 --- a/tests/codeigniter/core/Output_test.php +++ b/tests/codeigniter/core/Output_test.php @@ -3,19 +3,20 @@ class Output_test extends CI_TestCase { public $output; - protected $_output_data = << - - Basic HTML - - - Test - - -HTML; + protected $_output_data = ''; public function set_up() { + $this->_output_data =<< + + Basic HTML + + + Test + + +HTML; $this->ci_set_config('charset', 'UTF-8'); $output = $this->ci_core_class('output'); $this->output = new $output(); @@ -59,4 +60,4 @@ HTML; ); } -} \ No newline at end of file +} diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index e5c536090..b6d4b7893 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -22,7 +22,7 @@ class Mock_Database_Schema_Skeleton { */ public static function init($driver) { - if (empty(static::$db) && empty(static::$forge)) + if (empty(self::$db) && empty(self::$forge)) { $config = Mock_Database_DB::config($driver); $connection = new Mock_Database_DB($config); @@ -34,12 +34,12 @@ class Mock_Database_Schema_Skeleton { $loader->dbforge(); $forge = CI_TestCase::instance()->ci_instance_var('dbforge'); - static::$db = $db; - static::$forge = $forge; - static::$driver = $driver; + self::$db = $db; + self::$forge = $forge; + self::$driver = $driver; } - return static::$db; + return self::$db; } /** @@ -50,7 +50,7 @@ class Mock_Database_Schema_Skeleton { public static function create_tables() { // User Table - static::$forge->add_field(array( + self::$forge->add_field(array( 'id' => array( 'type' => 'INTEGER', 'constraint' => 3 @@ -68,11 +68,11 @@ class Mock_Database_Schema_Skeleton { 'constraint' => 40 ) )); - static::$forge->add_key('id', TRUE); - static::$forge->create_table('user', TRUE); + self::$forge->add_key('id', TRUE); + self::$forge->create_table('user', TRUE); // Job Table - static::$forge->add_field(array( + self::$forge->add_field(array( 'id' => array( 'type' => 'INTEGER', 'constraint' => 3 @@ -85,11 +85,11 @@ class Mock_Database_Schema_Skeleton { 'type' => 'TEXT' ) )); - static::$forge->add_key('id', TRUE); - static::$forge->create_table('job', TRUE); + self::$forge->add_key('id', TRUE); + self::$forge->create_table('job', TRUE); // Misc Table - static::$forge->add_field(array( + self::$forge->add_field(array( 'id' => array( 'type' => 'INTEGER', 'constraint' => 3 @@ -102,8 +102,8 @@ class Mock_Database_Schema_Skeleton { 'type' => 'TEXT' ) )); - static::$forge->add_key('id', TRUE); - static::$forge->create_table('misc', TRUE); + self::$forge->add_key('id', TRUE); + self::$forge->create_table('misc', TRUE); } /** @@ -136,13 +136,13 @@ class Mock_Database_Schema_Skeleton { foreach ($data as $table => $dummy_data) { - static::$db->truncate($table); + self::$db->truncate($table); foreach ($dummy_data as $single_dummy_data) { - static::$db->insert($table, $single_dummy_data); + self::$db->insert($table, $single_dummy_data); } } } -} \ No newline at end of file +} -- cgit v1.2.3-24-g4f1b From dbf3460bc7c94bf49db7dff3525906cae53a81ac Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 12 Jan 2015 13:37:13 +0200 Subject: Fix quoted_printable_encode() test A false positive is triggered when imap_8bit() exists, as it seems to have slightly different output. --- tests/codeigniter/core/compat/standard_test.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/codeigniter/core/compat/standard_test.php b/tests/codeigniter/core/compat/standard_test.php index a3a6d9552..4077a5c7c 100644 --- a/tests/codeigniter/core/compat/standard_test.php +++ b/tests/codeigniter/core/compat/standard_test.php @@ -449,7 +449,6 @@ class standard_test extends CI_TestCase { return $this->markTestSkipped('quoted_printable_encode() is already available on PHP 5.3'); } - // These are actually imap_8bit() tests: $this->assertEquals("String with CRLF at end=20\r\n", quoted_printable_encode("String with CRLF at end \r\n")); // ext/imap/tests/imap_8bit_basic.phpt says for this line: @@ -459,6 +458,11 @@ class standard_test extends CI_TestCase { $this->assertEquals("String with tab at end =09", quoted_printable_encode("String with tab at end \t")); $this->assertEquals("=00=01=02=03=04=FE=FF=0A=0D", quoted_printable_encode("\x00\x01\x02\x03\x04\xfe\xff\x0a\x0d")); + if (function_exists('imap_8bit')) + { + return $this->markTestIncomplete('imap_8bit() exists and is called as an alias for quoted_printable_encode()'); + } + // And these are from ext/standard/tests/strings/quoted_printable_encode_002.phpt: $this->assertEquals( "=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=\r\n" -- cgit v1.2.3-24-g4f1b From f24ef282bb3aa5f9c014aff3439234d6d73837de Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 12 Jan 2015 14:35:20 +0200 Subject: 5.2 tests appear to not have enough memory --- tests/Bootstrap.php | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 713c0fdb3..5e4198730 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -1,4 +1,5 @@ Date: Mon, 12 Jan 2015 14:40:24 +0200 Subject: These test failures make no sense at all --- tests/Bootstrap.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 5e4198730..8240d2340 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -1,5 +1,9 @@