mirror of
https://github.com/archtechx/livewire-access.git
synced 2025-12-12 12:24:03 +00:00
implicit access
This commit is contained in:
parent
a5e58a14d8
commit
8df06ae2c3
9 changed files with 184 additions and 22 deletions
46
tests/ExplicitAccessTest.php
Normal file
46
tests/ExplicitAccessTest.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace Lean\LivewireAccess\Tests;
|
||||
|
||||
use Livewire\Exceptions\NonPublicComponentMethodCall;
|
||||
use Livewire\Exceptions\PublicPropertyNotFoundException;
|
||||
use Livewire\Livewire;
|
||||
|
||||
class ExplicitAccessTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function public_properties_are_not_accessible_by_default()
|
||||
{
|
||||
$this->expectException(PublicPropertyNotFoundException::class);
|
||||
|
||||
Livewire::test(ExplicitComponent::class)
|
||||
->call('$set', 'foo', 'xxx');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function public_properties_can_be_explicitly_accessible()
|
||||
{
|
||||
Livewire::test(ExplicitComponent::class)
|
||||
->call('$set', 'bar', 'xxx');
|
||||
|
||||
// No exception
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function public_methods_are_not_accessible_by_default()
|
||||
{
|
||||
$this->expectException(NonPublicComponentMethodCall::class);
|
||||
|
||||
Livewire::test(ExplicitComponent::class)
|
||||
->call('abc');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function public_methods_can_be_explicitly_accessible()
|
||||
{
|
||||
Livewire::test(ExplicitComponent::class)
|
||||
->call('def');
|
||||
|
||||
// No exception
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue