Skip to content

Commit 0db6009

Browse files
committed
tests: increase coverage TableTest
1 parent e5ec9c3 commit 0db6009

1 file changed

Lines changed: 16 additions & 50 deletions

File tree

tests/system/View/TableTest.php

Lines changed: 16 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,18 @@ public function testGenerate()
392392
'Small',
393393
],
394394
[
395-
'Mary',
396-
'Red',
397-
'Large',
395+
[
396+
'data' => 'Mary',
397+
'class' => 'cssMary',
398+
],
399+
[
400+
'data' => 'Red',
401+
'class' => 'cssRed',
402+
],
403+
[
404+
'data' => 'Large',
405+
'class' => 'cssLarge',
406+
],
398407
],
399408
[
400409
'John',
@@ -421,53 +430,10 @@ public function testGenerate()
421430
$this->assertStringContainsString('<td>Blue</td>', $table);
422431
$this->assertStringContainsString('<td>Small</td>', $table);
423432

424-
// Check for the caption
425-
$this->assertStringContainsString('<caption>Awesome table</caption>', $table);
426-
427-
// Test the table footing
428-
$this->assertStringContainsString('<td>Subtotal</td>', $table);
429-
$this->assertStringContainsString('<td>12345</td>', $table);
430-
}
431-
432-
public function testGenerateOther()
433-
{
434-
// Prepare the data
435-
$data = [
436-
[
437-
['data' => 'Fred', 'style' => 'cssFred'],
438-
['data' => 'Blue', 'style' => 'cssBlue'],
439-
['data' => 'Small', 'style' => 'cssSmall'],
440-
],
441-
[
442-
'Mary',
443-
'Red',
444-
'Large',
445-
],
446-
[
447-
'John',
448-
'Green',
449-
'Medium',
450-
],
451-
];
452-
453-
$this->table->setCaption('Awesome table');
454-
$this->table->setHeading(['Name', 'Color', 'Size']);
455-
456-
$subtotal = 12345;
457-
458-
$this->table->setFooting('Subtotal', $subtotal);
459-
460-
$table = $this->table->generate($data);
461-
462-
// Test the table header
463-
$this->assertStringContainsString('<th>Name</th>', $table);
464-
$this->assertStringContainsString('<th>Color</th>', $table);
465-
$this->assertStringContainsString('<th>Size</th>', $table);
466-
467-
// Test the first entry
468-
$this->assertStringContainsString('<td style="cssFred">Fred</td>', $table);
469-
$this->assertStringContainsString('<td style="cssBlue">Blue</td>', $table);
470-
$this->assertStringContainsString('<td style="cssSmall">Small</td>', $table);
433+
// Test entry with attribute
434+
$this->assertStringContainsString('<td class="cssMary">Mary</td>', $table);
435+
$this->assertStringContainsString('<td class="cssRed">Red</td>', $table);
436+
$this->assertStringContainsString('<td class="cssLarge">Large</td>', $table);
471437

472438
// Check for the caption
473439
$this->assertStringContainsString('<caption>Awesome table</caption>', $table);

0 commit comments

Comments
 (0)