Skip to content

Commit ff9d29e

Browse files
committed
Create a test for TestComponent Class
1 parent fa3b1c7 commit ff9d29e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/Foundation/Testing/Concerns/InteractsWithViewsTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Illuminate\Tests\Foundation\Testing\Concerns;
44

55
use Illuminate\Foundation\Testing\Concerns\InteractsWithViews;
6+
use Illuminate\View\Component;
67
use Orchestra\Testbench\TestCase;
78

89
class InteractsWithViewsTest extends TestCase
@@ -15,4 +16,19 @@ public function testBladeCorrectlyRendersString()
1516

1617
$this->assertEquals('test ', $string);
1718
}
19+
20+
public function testComponentCanAccessPublicProperties()
21+
{
22+
$exampleComponent = new class extends Component
23+
{
24+
public $foo = 'bar';
25+
public function render()
26+
{
27+
return '';
28+
}
29+
};
30+
$component = $this->component(get_class($exampleComponent));
31+
32+
$this->assertEquals('bar', $component->foo);
33+
}
1834
}

0 commit comments

Comments
 (0)