1
0
Fork 0
mirror of https://github.com/archtechx/livewire-access.git synced 2025-12-12 04:14:03 +00:00
livewire-access/tests/LivewireAccessTest.php
Samuel Štancl e50e22434f initial
2021-03-17 17:28:17 +01:00

55 lines
1.3 KiB
PHP

<?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
}
}