Skip to content

Commit 4a143f1

Browse files
committed
add tests
1 parent b44353d commit 4a143f1

4 files changed

Lines changed: 29 additions & 1 deletion

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/**
4+
* This file is part of CodeIgniter 4 framework.
5+
*
6+
* (c) CodeIgniter Foundation <admin@codeigniter.com>
7+
*
8+
* For the full copyright and license information, please view
9+
* the LICENSE file that was distributed with this source code.
10+
*/
11+
12+
namespace Tests\Support\View\Cells;
13+
14+
use CodeIgniter\View\Cells\Cell;
15+
16+
class AwesomeCell extends Cell
17+
{
18+
public string $message = 'Found!';
19+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div><?= $message ?></div>

tests/system/Commands/CellGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testGenerateCellSimpleName()
7373
$this->assertStringContainsString('class Another extends Cell', $contents);
7474

7575
// Check the view was generated
76-
$file = APPPATH . 'Cells/another_cell.php';
76+
$file = APPPATH . 'Cells/another.php';
7777
$this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer());
7878
$this->assertFileExists($file);
7979
}

tests/system/View/ControlledCellTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Tests\Support\View\Cells\RenderedExtraDataNotice;
2222
use Tests\Support\View\Cells\RenderedNotice;
2323
use Tests\Support\View\Cells\SimpleNotice;
24+
use Tests\Support\View\Cells\AwesomeCell;
2425

2526
/**
2627
* @internal
@@ -36,6 +37,13 @@ public function testCellRendersDefaultValues()
3637
$this->assertStringContainsString('Hello World', $result);
3738
}
3839

40+
public function testCellRendersViewWithActualClassName()
41+
{
42+
$result = view_cell(AwesomeCell::class);
43+
44+
$this->assertStringContainsString('Found!', $result);
45+
}
46+
3947
public function testCellWithNamedView()
4048
{
4149
$result = view_cell(SimpleNotice::class);

0 commit comments

Comments
 (0)