summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/libraries/Table_test.php
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-05-27 22:53:25 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-05-27 22:53:25 +0200
commit2d8707f8ba27f16a226d85a011aeab5325b27100 (patch)
treef94af6e8b63a8632c45965c2f907a1abd76c6436 /tests/codeigniter/libraries/Table_test.php
parentf777d3ddafcd2a79bbc65d329e1f9586c3a449fb (diff)
parent11fd4b8759438f216318e3e1e004f918b88a56ad (diff)
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
Diffstat (limited to 'tests/codeigniter/libraries/Table_test.php')
-rw-r--r--tests/codeigniter/libraries/Table_test.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/codeigniter/libraries/Table_test.php b/tests/codeigniter/libraries/Table_test.php
index 13f338c6b..f5133de1e 100644
--- a/tests/codeigniter/libraries/Table_test.php
+++ b/tests/codeigniter/libraries/Table_test.php
@@ -291,6 +291,26 @@ class Table_test extends CI_TestCase {
);
}
- // Test main generate method
- // --------------------------------------------------------------------
+ function test_generate()
+ {
+ // Prepare the data
+ $data = array(
+ array('Name', 'Color', 'Size'),
+ array('Fred', 'Blue', 'Small'),
+ array('Mary', 'Red', 'Large'),
+ array('John', 'Green', 'Medium')
+ );
+
+ $table = $this->table->generate($data);
+
+ // Test the table header
+ $this->assertTrue(strpos($table, '<th>Name</th>') !== FALSE);
+ $this->assertTrue(strpos($table, '<th>Color</th>') !== FALSE);
+ $this->assertTrue(strpos($table, '<th>Size</th>') !== FALSE);
+
+ // Test the first entry
+ $this->assertTrue(strpos($table, '<td>Fred</td>') !== FALSE);
+ $this->assertTrue(strpos($table, '<td>Blue</td>') !== FALSE);
+ $this->assertTrue(strpos($table, '<td>Small</td>') !== FALSE);
+ }
} \ No newline at end of file