1
0
Fork 0
mirror of https://github.com/archtechx/livewire-access.git synced 2025-12-12 12:24:03 +00:00
livewire-access/tests/ImplicitAccessTest.php
2021-03-17 17:47:55 +01:00

46 lines
1.1 KiB
PHP

<?php
namespace Lean\LivewireAccess\Tests;
use Livewire\Exceptions\NonPublicComponentMethodCall;
use Livewire\Exceptions\PublicPropertyNotFoundException;
use Livewire\Livewire;
class ImplicitAccessTest extends TestCase
{
/** @test */
public function public_properties_are_accessible_by_default()
{
// No exception
Livewire::test(ImplicitComponent::class)
->call('$set', 'foo', 'xxx');
}
/** @test */
public function public_properties_can_be_explicitly_blocked()
{
$this->expectException(PublicPropertyNotFoundException::class);
Livewire::test(ImplicitComponent::class)
->call('$set', 'bar', 'xxx');
}
/** @test */
public function public_methods_are_accessible_by_default()
{
Livewire::test(ImplicitComponent::class)
->call('abc');
// No exception
}
/** @test */
public function public_methods_can_be_explicitly_blocked()
{
$this->expectException(NonPublicComponentMethodCall::class);
Livewire::test(ImplicitComponent::class)
->call('def');
}
}