summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/codeigniter/core/Common_test.php18
-rw-r--r--tests/codeigniter/core/Config_test.php25
-rw-r--r--tests/codeigniter/core/Loader_test.php4
-rw-r--r--tests/codeigniter/helpers/form_helper_test.php39
4 files changed, 49 insertions, 37 deletions
diff --git a/tests/codeigniter/core/Common_test.php b/tests/codeigniter/core/Common_test.php
index 27d48efc2..999b49cb3 100644
--- a/tests/codeigniter/core/Common_test.php
+++ b/tests/codeigniter/core/Common_test.php
@@ -2,8 +2,6 @@
class Common_test extends CI_TestCase {
- // ------------------------------------------------------------------------
-
public function test_is_php()
{
$this->assertEquals(TRUE, is_php('1.2.0'));
@@ -16,12 +14,12 @@ class Common_test extends CI_TestCase {
{
$this->assertEquals(' class="foo" id="bar"', _stringify_attributes(array('class' => 'foo', 'id' => 'bar')));
- $atts = new Stdclass;
+ $atts = new stdClass;
$atts->class = 'foo';
$atts->id = 'bar';
$this->assertEquals(' class="foo" id="bar"', _stringify_attributes($atts));
- $atts = new Stdclass;
+ $atts = new stdClass;
$this->assertEquals('', _stringify_attributes($atts));
$this->assertEquals(' class="foo" id="bar"', _stringify_attributes('class="foo" id="bar"'));
@@ -35,10 +33,20 @@ class Common_test extends CI_TestCase {
{
$this->assertEquals('width=800,height=600', _stringify_attributes(array('width' => '800', 'height' => '600'), TRUE));
- $atts = new Stdclass;
+ $atts = new stdClass;
$atts->width = 800;
$atts->height = 600;
$this->assertEquals('width=800,height=600', _stringify_attributes($atts, TRUE));
}
+ // ------------------------------------------------------------------------
+
+ public function test_html_escape()
+ {
+ $this->assertEquals(
+ html_escape('Here is a string containing "quoted" text.'),
+ 'Here is a string containing "quoted" text.'
+ );
+ }
+
} \ No newline at end of file
diff --git a/tests/codeigniter/core/Config_test.php b/tests/codeigniter/core/Config_test.php
index d652a625e..be426d070 100644
--- a/tests/codeigniter/core/Config_test.php
+++ b/tests/codeigniter/core/Config_test.php
@@ -9,7 +9,7 @@ class Config_test extends CI_TestCase {
// set predictable config values
$this->cfg = array(
'index_page' => 'index.php',
- 'base_url' => 'http://example.com/',
+ 'base_url' => 'http://example.com/',
'subclass_prefix' => 'MY_'
);
$this->ci_set_config($this->cfg);
@@ -38,7 +38,6 @@ class Config_test extends CI_TestCase {
$this->assertFalse($this->config->item('not_yet_set'));
$this->config->set_item('not_yet_set', 'is set');
-
$this->assertEquals('is set', $this->config->item('not_yet_set'));
}
@@ -50,7 +49,6 @@ class Config_test extends CI_TestCase {
$this->assertFalse($this->config->slash_item('no_good_item'));
$this->assertEquals($this->cfg['base_url'], $this->config->slash_item('base_url'));
-
$this->assertEquals($this->cfg['subclass_prefix'].'/', $this->config->slash_item('subclass_prefix'));
}
@@ -124,7 +122,7 @@ class Config_test extends CI_TestCase {
$q_string = $this->config->item('enable_query_strings');
$this->config->set_item('enable_query_strings', FALSE);
- $uri= 'test';
+ $uri = 'test';
$uri2 = '1';
$this->assertEquals($index_page.'/'.$uri, $this->config->site_url($uri));
$this->assertEquals($index_page.'/'.$uri.'/'.$uri2, $this->config->site_url(array($uri, $uri2)));
@@ -137,7 +135,6 @@ class Config_test extends CI_TestCase {
$this->assertEquals($index_page.'/'.$uri.$suffix.'?'.$arg, $this->config->site_url($uri.'?'.$arg));
$this->config->set_item('url_suffix', FALSE);
-
$this->config->set_item('enable_query_strings', TRUE);
$this->assertEquals($index_page.'?'.$uri, $this->config->site_url($uri));
@@ -233,22 +230,4 @@ class Config_test extends CI_TestCase {
$this->assertNull($this->config->load($file));
}
- // --------------------------------------------------------------------
-
- public function test_assign_to_config()
- {
- $key1 = 'test';
- $key2 = '1';
- $val1 = 'foo';
- $val2 = 'bar';
- $cfg = array(
- $key1 => $val1,
- $key2 => $val2
- );
-
- $this->assertNull($this->config->_assign_to_config($cfg));
- $this->assertEquals($val1, $this->config->item($key1));
- $this->assertEquals($val2, $this->config->item($key2));
- }
-
} \ No newline at end of file
diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php
index f7c338a20..816587a49 100644
--- a/tests/codeigniter/core/Loader_test.php
+++ b/tests/codeigniter/core/Loader_test.php
@@ -36,7 +36,7 @@ class Loader_test extends CI_TestCase {
$this->assertAttributeInstanceOf($class, $lib, $this->ci_obj);
// Test no lib given
- $this->assertFalse($this->load->library());
+ $this->assertNull($this->load->library());
// Test a string given to params
$this->assertNull($this->load->library($lib, ' '));
@@ -450,7 +450,7 @@ class Loader_test extends CI_TestCase {
public function test_load_config()
{
$cfg = 'someconfig';
- $this->assertNull($this->load->config($cfg, FALSE));
+ $this->assertTrue($this->load->config($cfg, FALSE));
$this->assertContains($cfg, $this->ci_obj->config->loaded);
}
diff --git a/tests/codeigniter/helpers/form_helper_test.php b/tests/codeigniter/helpers/form_helper_test.php
index 48628d2e5..03278581d 100644
--- a/tests/codeigniter/helpers/form_helper_test.php
+++ b/tests/codeigniter/helpers/form_helper_test.php
@@ -7,6 +7,8 @@ class Form_helper_test extends CI_TestCase
$this->helper('form');
}
+ // ------------------------------------------------------------------------
+
public function test_form_hidden()
{
$expected = <<<EOH
@@ -18,6 +20,8 @@ EOH;
$this->assertEquals($expected, form_hidden('username', 'johndoe'));
}
+ // ------------------------------------------------------------------------
+
public function test_form_input()
{
$expected = <<<EOH
@@ -37,6 +41,8 @@ EOH;
$this->assertEquals($expected, form_input($data));
}
+ // ------------------------------------------------------------------------
+
public function test_form_password()
{
$expected = <<<EOH
@@ -47,6 +53,8 @@ EOH;
$this->assertEquals($expected, form_password('password'));
}
+ // ------------------------------------------------------------------------
+
public function test_form_upload()
{
$expected = <<<EOH
@@ -57,6 +65,8 @@ EOH;
$this->assertEquals($expected, form_upload('attachment'));
}
+ // ------------------------------------------------------------------------
+
public function test_form_textarea()
{
$expected = <<<EOH
@@ -67,6 +77,8 @@ EOH;
$this->assertEquals($expected, form_textarea('notes', 'Notes'));
}
+ // ------------------------------------------------------------------------
+
public function test_form_dropdown()
{
$expected = <<<EOH
@@ -130,6 +142,8 @@ EOH;
$this->assertEquals($expected, form_dropdown('cars', $options, array('volvo', 'audi')));
}
+ // ------------------------------------------------------------------------
+
public function test_form_multiselect()
{
$expected = <<<EOH
@@ -152,6 +166,8 @@ EOH;
$this->assertEquals($expected, form_multiselect('shirts[]', $options, array('med', 'large')));
}
+ // ------------------------------------------------------------------------
+
public function test_form_fieldset()
{
$expected = <<<EOH
@@ -163,6 +179,8 @@ EOH;
$this->assertEquals($expected, form_fieldset('Address Information'));
}
+ // ------------------------------------------------------------------------
+
public function test_form_fieldset_close()
{
$expected = <<<EOH
@@ -172,6 +190,8 @@ EOH;
$this->assertEquals($expected, form_fieldset_close('</div></div>'));
}
+ // ------------------------------------------------------------------------
+
public function test_form_checkbox()
{
$expected = <<<EOH
@@ -182,6 +202,8 @@ EOH;
$this->assertEquals($expected, form_checkbox('newsletter', 'accept', TRUE));
}
+ // ------------------------------------------------------------------------
+
public function test_form_radio()
{
$expected = <<<EOH
@@ -192,6 +214,8 @@ EOH;
$this->assertEquals($expected, form_radio('newsletter', 'accept', TRUE));
}
+ // ------------------------------------------------------------------------
+
public function test_form_submit()
{
$expected = <<<EOH
@@ -202,6 +226,8 @@ EOH;
$this->assertEquals($expected, form_submit('mysubmit', 'Submit Post!'));
}
+ // ------------------------------------------------------------------------
+
public function test_form_label()
{
$expected = <<<EOH
@@ -211,6 +237,8 @@ EOH;
$this->assertEquals($expected, form_label('What is your Name', 'username'));
}
+ // ------------------------------------------------------------------------
+
public function test_form_reset()
{
$expected = <<<EOH
@@ -221,6 +249,8 @@ EOH;
$this->assertEquals($expected, form_reset('myreset', 'Reset'));
}
+ // ------------------------------------------------------------------------
+
public function test_form_button()
{
$expected = <<<EOH
@@ -231,6 +261,8 @@ EOH;
$this->assertEquals($expected, form_button('name', 'content'));
}
+ // ------------------------------------------------------------------------
+
public function test_form_close()
{
$expected = <<<EOH
@@ -240,13 +272,6 @@ EOH;
$this->assertEquals($expected, form_close('</div></div>'));
}
- public function test_form_prep()
- {
- $expected = 'Here is a string containing &quot;quoted&quot; 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