1
0
Fork 0
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:
Samuel Štancl 2021-03-17 17:47:55 +01:00
parent a5e58a14d8
commit 8df06ae2c3
9 changed files with 184 additions and 22 deletions

View file

@ -1,55 +0,0 @@
<?php
namespace Lean\LivewireAccess\Tests;
use Livewire\Exceptions\NonPublicComponentMethodCall;
use Livewire\Exceptions\PublicPropertyNotFoundException;
use Livewire\Livewire;
use Livewire\LivewireServiceProvider;
use Orchestra\Testbench\TestCase as TestbenchTestCase;
class LivewireAccessTest extends TestbenchTestCase
{
protected function getPackageProviders($app)
{
return [
LivewireServiceProvider::class,
];
}
/** @test */
public function public_properties_are_not_accessible_by_default()
{
$this->expectException(PublicPropertyNotFoundException::class);
Livewire::test(TestComponent::class)
->call('$set', 'foo', 'xxx');
}
/** @test */
public function public_properties_can_be_explicitly_accessible()
{
Livewire::test(TestComponent::class)
->call('$set', 'bar', 'xxx');
// No exception
}
/** @test */
public function public_methods_are_not_acccessible_by_default()
{
$this->expectException(NonPublicComponentMethodCall::class);
Livewire::test(TestComponent::class)
->call('abc');
}
/** @test */
public function public_methods_can_be_explicitly_accessible()
{
Livewire::test(TestComponent::class)
->call('def');
// No exception
}
}