Skip to content

Commit ff3dd1c

Browse files
committed
test: add test to reproduce bug
1 parent 97f9034 commit ff3dd1c

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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\OtherCells;
13+
14+
/**
15+
* Two classes with the same short name.
16+
*
17+
* - Tests\Support\View\SampleClass
18+
* - Tests\Support\View\OtherCells\SampleClass
19+
*/
20+
class SampleClass
21+
{
22+
public function hello()
23+
{
24+
return 'Good-bye!';
25+
}
26+
}

tests/system/View/CellTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ public function testDisplayRendersWithNamespacedClass()
113113
$this->assertSame($expected, $this->cell->render('\Tests\Support\View\SampleClass::hello'));
114114
}
115115

116+
public function testDisplayRendersTwoCellsWithSameShortName()
117+
{
118+
$output = $this->cell->render('\Tests\Support\View\SampleClass::hello');
119+
120+
$this->assertSame('Hello', $output);
121+
122+
$output = $this->cell->render('\Tests\Support\View\OtherCells\SampleClass::hello');
123+
124+
$this->assertSame('Good-bye!', $output);
125+
}
126+
116127
public function testDisplayRendersWithValidParamString()
117128
{
118129
$params = 'one=two,three=four';

0 commit comments

Comments
 (0)