Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 1 | <?php |
| 2 | |
Taufan Aditya | ac5373a | 2012-03-28 16:03:38 +0700 | [diff] [blame] | 3 | class Table_test extends CI_TestCase { |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 4 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 5 | public function set_up() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 6 | { |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 7 | $obj = new stdClass; |
Taufan Aditya | ac5373a | 2012-03-28 16:03:38 +0700 | [diff] [blame] | 8 | $obj->table = new Mock_Libraries_Table(); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 9 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 10 | $this->ci_instance($obj); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 11 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 12 | $this->table = $obj->table; |
| 13 | } |
| 14 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 15 | // Setter Methods |
| 16 | // -------------------------------------------------------------------- |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 17 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 18 | public function test_set_template() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 19 | { |
| 20 | $this->assertFalse($this->table->set_template('not an array')); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 21 | |
| 22 | $template = array('a' => 'b'); |
| 23 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 24 | $this->table->set_template($template); |
| 25 | $this->assertEquals($template, $this->table->template); |
| 26 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 27 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 28 | public function test_set_empty() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 29 | { |
| 30 | $this->table->set_empty('nada'); |
| 31 | $this->assertEquals('nada', $this->table->empty_cells); |
| 32 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 33 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 34 | public function test_set_caption() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 35 | { |
| 36 | $this->table->set_caption('awesome cap'); |
| 37 | $this->assertEquals('awesome cap', $this->table->caption); |
| 38 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 39 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 40 | /* |
| 41 | * @depends testPrepArgs |
| 42 | */ |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 43 | public function test_set_heading() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 44 | { |
| 45 | // uses _prep_args internally, so we'll just do a quick |
| 46 | // check to verify that func_get_args and prep_args are |
| 47 | // being called. |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 48 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 49 | $this->table->set_heading('name', 'color', 'size'); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 50 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 51 | $this->assertEquals( |
| 52 | array( |
| 53 | array('data' => 'name'), |
| 54 | array('data' => 'color'), |
| 55 | array('data' => 'size') |
| 56 | ), |
| 57 | $this->table->heading |
| 58 | ); |
| 59 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 60 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 61 | /* |
| 62 | * @depends testPrepArgs |
| 63 | */ |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 64 | public function test_add_row() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 65 | { |
| 66 | // uses _prep_args internally, so we'll just do a quick |
| 67 | // check to verify that func_get_args and prep_args are |
| 68 | // being called. |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 69 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 70 | $this->table->add_row('my', 'pony', 'sings'); |
| 71 | $this->table->add_row('your', 'pony', 'stinks'); |
| 72 | $this->table->add_row('my pony', '>', 'your pony'); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 73 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 74 | $this->assertEquals(count($this->table->rows), 3); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 75 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 76 | $this->assertEquals( |
| 77 | array( |
| 78 | array('data' => 'your'), |
| 79 | array('data' => 'pony'), |
| 80 | array('data' => 'stinks') |
| 81 | ), |
| 82 | $this->table->rows[1] |
| 83 | ); |
| 84 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 85 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 86 | // Uility Methods |
| 87 | // -------------------------------------------------------------------- |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 88 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 89 | public function test_prep_args() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 90 | { |
| 91 | $expected = array( |
| 92 | array('data' => 'name'), |
| 93 | array('data' => 'color'), |
| 94 | array('data' => 'size') |
| 95 | ); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 96 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 97 | $this->assertEquals( |
| 98 | $expected, |
Taufan Aditya | 30b34d0 | 2012-03-28 16:35:48 +0700 | [diff] [blame] | 99 | $this->table->prep_args(array('name', 'color', 'size')) |
tiyowan | e39728c | 2012-03-10 02:10:44 +0400 | [diff] [blame] | 100 | ); |
Taufan Aditya | 30b34d0 | 2012-03-28 16:35:48 +0700 | [diff] [blame] | 101 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 102 | // with cell attributes |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 103 | // need to add that new argument row to our expected outcome |
| 104 | $expected[] = array('data' => 'weight', 'class' => 'awesome'); |
tiyowan | e39728c | 2012-03-10 02:10:44 +0400 | [diff] [blame] | 105 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 106 | $this->assertEquals( |
| 107 | $expected, |
Taufan Aditya | 30b34d0 | 2012-03-28 16:35:48 +0700 | [diff] [blame] | 108 | $this->table->prep_args(array('name', 'color', 'size', array('data' => 'weight', 'class' => 'awesome'))) |
tiyowan | e39728c | 2012-03-10 02:10:44 +0400 | [diff] [blame] | 109 | ); |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 110 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 111 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 112 | public function test_default_template_keys() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 113 | { |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 114 | $keys = array( |
| 115 | 'table_open', |
| 116 | 'thead_open', 'thead_close', |
| 117 | 'heading_row_start', 'heading_row_end', 'heading_cell_start', 'heading_cell_end', |
| 118 | 'tbody_open', 'tbody_close', |
| 119 | 'row_start', 'row_end', 'cell_start', 'cell_end', |
| 120 | 'row_alt_start', 'row_alt_end', 'cell_alt_start', 'cell_alt_end', |
| 121 | 'table_close' |
| 122 | ); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 123 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 124 | foreach ($keys as $key) |
| 125 | { |
Taufan Aditya | d61b772 | 2012-03-28 16:07:58 +0700 | [diff] [blame] | 126 | $this->assertArrayHasKey($key, $this->table->default_template()); |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 127 | } |
| 128 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 129 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 130 | public function test_compile_template() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 131 | { |
| 132 | $this->assertFalse($this->table->set_template('invalid_junk')); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 133 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 134 | // non default key |
| 135 | $this->table->set_template(array('nonsense' => 'foo')); |
Taufan Aditya | d44d720 | 2012-03-28 16:24:23 +0700 | [diff] [blame] | 136 | $this->table->compile_template(); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 137 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 138 | $this->assertArrayHasKey('nonsense', $this->table->template); |
| 139 | $this->assertEquals('foo', $this->table->template['nonsense']); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 140 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 141 | // override default |
| 142 | $this->table->set_template(array('table_close' => '</table junk>')); |
Taufan Aditya | d44d720 | 2012-03-28 16:24:23 +0700 | [diff] [blame] | 143 | $this->table->compile_template(); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 144 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 145 | $this->assertArrayHasKey('table_close', $this->table->template); |
| 146 | $this->assertEquals('</table junk>', $this->table->template['table_close']); |
| 147 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 148 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 149 | public function test_make_columns() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 150 | { |
| 151 | // Test bogus parameters |
| 152 | $this->assertFalse($this->table->make_columns('invalid_junk')); |
Taufan Aditya | 8749bc7 | 2012-03-11 05:43:45 +0700 | [diff] [blame] | 153 | $this->assertFalse($this->table->make_columns(array())); |
| 154 | $this->assertFalse($this->table->make_columns(array('one', 'two'), '2.5')); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 155 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 156 | // Now on to the actual column creation |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 157 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 158 | $five_values = array( |
| 159 | 'Laura', 'Red', '15', |
| 160 | 'Katie', 'Blue' |
| 161 | ); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 162 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 163 | // No column count - no changes to the array |
| 164 | $this->assertEquals( |
| 165 | $five_values, |
| 166 | $this->table->make_columns($five_values) |
| 167 | ); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 168 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 169 | // Column count of 3 leaves us with one |
| 170 | $this->assertEquals( |
| 171 | array( |
| 172 | array('Laura', 'Red', '15'), |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 173 | array('Katie', 'Blue', ' ') |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 174 | ), |
| 175 | $this->table->make_columns($five_values, 3) |
| 176 | ); |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 177 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 178 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 179 | public function test_clear() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 180 | { |
| 181 | $this->table->set_heading('Name', 'Color', 'Size'); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 182 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 183 | // Make columns changes auto_heading |
| 184 | $rows = $this->table->make_columns(array( |
| 185 | 'Laura', 'Red', '15', |
| 186 | 'Katie', 'Blue' |
| 187 | ), 3); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 188 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 189 | foreach ($rows as $row) |
| 190 | { |
| 191 | $this->table->add_row($row); |
| 192 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 193 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 194 | $this->assertFalse($this->table->auto_heading); |
| 195 | $this->assertEquals(count($this->table->heading), 3); |
| 196 | $this->assertEquals(count($this->table->rows), 2); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 197 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 198 | $this->table->clear(); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 199 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 200 | $this->assertTrue($this->table->auto_heading); |
| 201 | $this->assertEmpty($this->table->heading); |
| 202 | $this->assertEmpty($this->table->rows); |
| 203 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 204 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 205 | public function test_set_from_array() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 206 | { |
Taufan Aditya | d44d720 | 2012-03-28 16:24:23 +0700 | [diff] [blame] | 207 | $this->assertFalse($this->table->set_from_array('bogus')); |
| 208 | $this->assertFalse($this->table->set_from_array(NULL)); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 209 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 210 | $data = array( |
| 211 | array('name', 'color', 'number'), |
| 212 | array('Laura', 'Red', '22'), |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 213 | array('Katie', 'Blue') |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 214 | ); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 215 | |
Taufan Aditya | d44d720 | 2012-03-28 16:24:23 +0700 | [diff] [blame] | 216 | $this->table->set_from_array($data, FALSE); |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 217 | $this->assertEmpty($this->table->heading); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 218 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 219 | $this->table->clear(); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 220 | |
| 221 | $this->table->set_from_array($data); |
| 222 | $this->assertEquals(count($this->table->rows), 2); |
| 223 | |
| 224 | $expected = array( |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 225 | array('data' => 'name'), |
| 226 | array('data' => 'color'), |
| 227 | array('data' => 'number') |
| 228 | ); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 229 | |
| 230 | $this->assertEquals($expected, $this->table->heading); |
| 231 | |
| 232 | $expected = array( |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 233 | array('data' => 'Katie'), |
| 234 | array('data' => 'Blue'), |
| 235 | ); |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 236 | |
| 237 | $this->assertEquals($expected, $this->table->rows[1]); |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 238 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 239 | |
| 240 | public function test_set_from_object() |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 241 | { |
Taufan Aditya | 8749bc7 | 2012-03-11 05:43:45 +0700 | [diff] [blame] | 242 | // Make a stub of query instance |
| 243 | $query = new CI_TestCase(); |
| 244 | $query->list_fields = function(){ |
| 245 | return array('name', 'email'); |
| 246 | }; |
| 247 | $query->result_array = function(){ |
| 248 | return array( |
| 249 | array('name' => 'John Doe', 'email' => 'john@doe.com'), |
| 250 | array('name' => 'Foo Bar', 'email' => 'foo@bar.com'), |
| 251 | ); |
| 252 | }; |
| 253 | $query->num_rows = function(){ |
| 254 | return 2; |
| 255 | }; |
| 256 | |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 257 | $this->table->set_from_object($query); |
| 258 | |
| 259 | $expected = array( |
Taufan Aditya | 8749bc7 | 2012-03-11 05:43:45 +0700 | [diff] [blame] | 260 | array('data' => 'name'), |
| 261 | array('data' => 'email') |
| 262 | ); |
| 263 | |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 264 | $this->assertEquals($expected, $this->table->heading); |
| 265 | |
| 266 | $expected = array( |
Taufan Aditya | 8749bc7 | 2012-03-11 05:43:45 +0700 | [diff] [blame] | 267 | 'name' => array('data' => 'Foo Bar'), |
| 268 | 'email' => array('data' => 'foo@bar.com'), |
| 269 | ); |
| 270 | |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 271 | $this->assertEquals($expected, $this->table->rows[1]); |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 272 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 273 | |
| 274 | public function test_generate() |
Taufan Aditya | 6c7526c | 2012-05-27 13:51:27 +0700 | [diff] [blame] | 275 | { |
| 276 | // Prepare the data |
| 277 | $data = array( |
| 278 | array('Name', 'Color', 'Size'), |
| 279 | array('Fred', 'Blue', 'Small'), |
| 280 | array('Mary', 'Red', 'Large'), |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 281 | array('John', 'Green', 'Medium') |
Taufan Aditya | 6c7526c | 2012-05-27 13:51:27 +0700 | [diff] [blame] | 282 | ); |
| 283 | |
| 284 | $table = $this->table->generate($data); |
| 285 | |
| 286 | // Test the table header |
| 287 | $this->assertTrue(strpos($table, '<th>Name</th>') !== FALSE); |
| 288 | $this->assertTrue(strpos($table, '<th>Color</th>') !== FALSE); |
| 289 | $this->assertTrue(strpos($table, '<th>Size</th>') !== FALSE); |
| 290 | |
| 291 | // Test the first entry |
| 292 | $this->assertTrue(strpos($table, '<td>Fred</td>') !== FALSE); |
| 293 | $this->assertTrue(strpos($table, '<td>Blue</td>') !== FALSE); |
| 294 | $this->assertTrue(strpos($table, '<td>Small</td>') !== FALSE); |
| 295 | } |
Andrey Andreev | c186288 | 2012-06-09 23:16:58 +0300 | [diff] [blame] | 296 | |
Greg Aker | 57fb518 | 2011-04-21 14:58:26 -0500 | [diff] [blame] | 297 | } |