Skip to content

Commit

Permalink
fead: Updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
joserick committed Nov 3, 2024
1 parent 20e143e commit 01d4716
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions tests/Feature/ListCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,30 @@
});

it('should list Livewire Discover components', function () {
$classNamespaces = collect([
'app-livewire' => [
'class_namespace' => 'App\\Livewire',
'class_path' => base_path('app/Livewire'),
],
]);

LaravelLivewireDiscover::shouldReceive('getClassNamespaces')
->once()
->andReturn($classNamespaces);
->andReturn($this->CLASS_NAMESPACES);

File::shouldReceive('isDirectory')
->once()
->andReturn(true);

File::shouldReceive('allFiles')
->once()
->with(base_path('app/Livewire'))
->with($this->NAMESPACE_PATH)
->andReturn([
new SplFileInfo(base_path('app/Livewire/ExampleComponent.php')),
new SplFileInfo(app_path('Tests/Components/TestComponent.php')),
]);

$this->artisan('livewire-discover:list')
->expectsOutput('List of Livewire Discover components:')
->expectsOutput('Livewire-Discover namespaces list:')
->expectsTable(
['Alias', 'Paths'],
['Alias', 'Path'],
[
['app-livewire.example-component', base_path('app/Livewire/ExampleComponent.php')],
[
$this->PREFIX.'.components.test-component',
'app/Tests/Components/TestComponent.php',
],
]
)
->assertExitCode(0);
Expand Down

0 comments on commit 01d4716

Please sign in to comment.