From 68286a4dcc1ed4d904ad992173c1b3621bf6fced Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Thu, 21 Apr 2011 22:00:33 -0400 Subject: Reworked unit tests to match rest of framework and added a few more. --- tests/codeigniter/libraries/Parser_test.php | 8 ++++---- tests/codeigniter/libraries/Table_test.php | 26 ++++++++++++------------- tests/codeigniter/libraries/Typography_test.php | 8 ++++---- tests/codeigniter/libraries/User_agent_test.php | 14 ++++++------- 4 files changed, 28 insertions(+), 28 deletions(-) (limited to 'tests/codeigniter/libraries') diff --git a/tests/codeigniter/libraries/Parser_test.php b/tests/codeigniter/libraries/Parser_test.php index 44269ad2c..b4580a4b1 100644 --- a/tests/codeigniter/libraries/Parser_test.php +++ b/tests/codeigniter/libraries/Parser_test.php @@ -5,7 +5,7 @@ require BASEPATH.'libraries/Parser.php'; class Parser_test extends CI_TestCase { - public function setUp() + public function set_up() { $obj = new StdClass; $obj->parser = new CI_Parser(); @@ -16,7 +16,7 @@ class Parser_test extends CI_TestCase } // -------------------------------------------------------------------- - public function testSetDelimiters() + public function test_set_delimiters() { // Make sure default delimiters are there $this->assertEquals('{', $this->parser->l_delim); @@ -39,7 +39,7 @@ class Parser_test extends CI_TestCase // -------------------------------------------------------------------- - public function testParseSimpleString() + public function test_parse_simple_string() { $data = array( 'title' => 'Page Title', @@ -55,7 +55,7 @@ class Parser_test extends CI_TestCase // -------------------------------------------------------------------- - public function testParse() + public function test_parse() { $this->_parse_no_template(); $this->_parse_var_pair(); diff --git a/tests/codeigniter/libraries/Table_test.php b/tests/codeigniter/libraries/Table_test.php index ded4c22c1..133179f3a 100644 --- a/tests/codeigniter/libraries/Table_test.php +++ b/tests/codeigniter/libraries/Table_test.php @@ -5,7 +5,7 @@ require BASEPATH.'libraries/Table.php'; class Table_test extends CI_TestCase { - public function setUp() + public function set_up() { $obj = new StdClass; $obj->table = new CI_table(); @@ -19,7 +19,7 @@ class Table_test extends CI_TestCase // Setter Methods // -------------------------------------------------------------------- - public function testSetTemplate() + public function test_set_template() { $this->assertFalse($this->table->set_template('not an array')); @@ -31,13 +31,13 @@ class Table_test extends CI_TestCase $this->assertEquals($template, $this->table->template); } - public function testSetEmpty() + public function test_set_empty() { $this->table->set_empty('nada'); $this->assertEquals('nada', $this->table->empty_cells); } - public function testSetCaption() + public function test_set_caption() { $this->table->set_caption('awesome cap'); $this->assertEquals('awesome cap', $this->table->caption); @@ -47,7 +47,7 @@ class Table_test extends CI_TestCase /* * @depends testPrepArgs */ - public function testSetHeading() + public function test_set_heading() { // uses _prep_args internally, so we'll just do a quick // check to verify that func_get_args and prep_args are @@ -69,7 +69,7 @@ class Table_test extends CI_TestCase /* * @depends testPrepArgs */ - public function testAddRow() + public function test_add_row() { // uses _prep_args internally, so we'll just do a quick // check to verify that func_get_args and prep_args are @@ -95,7 +95,7 @@ class Table_test extends CI_TestCase // Uility Methods // -------------------------------------------------------------------- - public function testPrepArgs() + public function test_prep_args() { $expected = array( array('data' => 'name'), @@ -139,7 +139,7 @@ class Table_test extends CI_TestCase 'attributes'); } - public function testDefaultTemplateKeys() + public function test_default_template_keys() { $deft_template = $this->table->_default_template(); $keys = array( @@ -158,7 +158,7 @@ class Table_test extends CI_TestCase } } - public function testCompileTemplate() + public function test_compile_template() { $this->assertFalse($this->table->set_template('invalid_junk')); @@ -177,7 +177,7 @@ class Table_test extends CI_TestCase $this->assertEquals('', $this->table->template['table_close']); } - public function testMakeColumns() + public function test_make_columns() { // Test bogus parameters $this->assertFalse($this->table->make_columns('invalid_junk')); @@ -213,7 +213,7 @@ class Table_test extends CI_TestCase $this->markTestSkipped('Look at commented assertFalse above'); } - public function testClear() + public function test_clear() { $this->table->set_heading('Name', 'Color', 'Size'); @@ -240,7 +240,7 @@ class Table_test extends CI_TestCase } - public function testSetFromArray() + public function test_set_from_array() { $this->assertFalse($this->table->_set_from_array('bogus')); $this->assertFalse($this->table->_set_from_array(array())); @@ -281,7 +281,7 @@ class Table_test extends CI_TestCase ); } - function testSetFromObject() + function test_set_from_object() { $this->markTestSkipped('Not yet implemented.'); } diff --git a/tests/codeigniter/libraries/Typography_test.php b/tests/codeigniter/libraries/Typography_test.php index 242a6e944..a0533bae0 100644 --- a/tests/codeigniter/libraries/Typography_test.php +++ b/tests/codeigniter/libraries/Typography_test.php @@ -5,7 +5,7 @@ require BASEPATH.'libraries/Typography.php'; class Typography_test extends CI_TestCase { - public function setUp() + public function set_up() { $obj = new StdClass; $obj->type = new CI_Typography(); @@ -22,7 +22,7 @@ class Typography_test extends CI_TestCase * * this can and should grow. */ - public function testFormatCharacters() + public function test_format_characters() { $strs = array( '"double quotes"' => '“double quotes”', @@ -46,7 +46,7 @@ class Typography_test extends CI_TestCase // -------------------------------------------------------------------- - public function testNl2brExceptPre() + public function test_nl2br_except_pre() { $str = <<_blank_string(); $this->_standardize_new_lines(); diff --git a/tests/codeigniter/libraries/User_agent_test.php b/tests/codeigniter/libraries/User_agent_test.php index d1d950cd9..277c12ed0 100644 --- a/tests/codeigniter/libraries/User_agent_test.php +++ b/tests/codeigniter/libraries/User_agent_test.php @@ -9,7 +9,7 @@ class UserAgent_test extends CI_TestCase protected $_user_agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27'; protected $_mobile_ua = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7'; - public function setUp() + public function set_up() { // set a baseline user agent $_SERVER['HTTP_USER_AGENT'] = $this->_user_agent; @@ -24,7 +24,7 @@ class UserAgent_test extends CI_TestCase // -------------------------------------------------------------------- - public function testAcceptLang() + public function test_accept_lang() { $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en'; @@ -35,7 +35,7 @@ class UserAgent_test extends CI_TestCase // -------------------------------------------------------------------- - public function testMobile() + public function test_mobile() { // Mobile Not Set $_SERVER['HTTP_USER_AGENT'] = $this->_mobile_ua; @@ -45,7 +45,7 @@ class UserAgent_test extends CI_TestCase // -------------------------------------------------------------------- - public function testUtilIsFunctions() + public function test_util_is_functions() { $this->assertTrue($this->agent->is_browser()); $this->assertFalse($this->agent->is_robot()); @@ -55,14 +55,14 @@ class UserAgent_test extends CI_TestCase // -------------------------------------------------------------------- - public function testAgentString() + public function test_agent_string() { $this->assertEquals($this->_user_agent, $this->agent->agent_string()); } // -------------------------------------------------------------------- - public function testBrowserInfo() + public function test_browser_info() { $this->assertEquals('Mac OS X', $this->agent->platform()); $this->assertEquals('Safari', $this->agent->browser()); @@ -73,7 +73,7 @@ class UserAgent_test extends CI_TestCase // -------------------------------------------------------------------- - public function testCharsets() + public function test_charsets() { $_SERVER['HTTP_ACCEPT_CHARSET'] = 'utf8'; -- cgit v1.2.3-24-g4f1b