-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing
install:broadcasting
command
- Loading branch information
1 parent
c720ccb
commit 4a1fcc3
Showing
3 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
.php_cs | ||
.php_cs.cache | ||
.phpunit.result.cache | ||
/.phpunit.cache | ||
build | ||
composer.lock | ||
coverage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\File; | ||
use Illuminate\Support\Facades\Process; | ||
|
||
it('completely installs all required assets for broadcasting in default scenario', function () { | ||
File::shouldReceive('copy') | ||
->once() | ||
->withArgs(fn($path, $target) => str_ends_with($path, 'broadcasting-routes.stub') && str_ends_with($target, 'routes/channels.php')); | ||
|
||
File::shouldReceive('copy') | ||
->once() | ||
->withArgs(fn($path, $target) => str_ends_with($path, 'echo-js.stub') && str_ends_with($target, 'js/echo.js')); | ||
|
||
File::shouldReceive('missing') | ||
->once() | ||
->withArgs([app()->environmentFile()]) | ||
->andReturn(false); | ||
|
||
File::shouldReceive('get') | ||
->once() | ||
->withArgs([app()->environmentFile()]) | ||
->andReturn('BROADCAST_CONNECTION=log'); | ||
|
||
File::shouldReceive('put') | ||
->once() | ||
->withArgs([app()->environmentFile(), 'BROADCAST_CONNECTION=redis']); | ||
|
||
Process::fake([ | ||
'npm install --save-dev laravel-echo laravel-wave && npm run build' => Process::result() | ||
]); | ||
|
||
$this->artisan('install:broadcasting') | ||
->expectsConfirmation('Would you like to enable the Redis broadcasting driver for Wave?', 'yes') | ||
->expectsConfirmation('Would you like to install and build the Node dependencies required for broadcasting?', 'yes') | ||
->expectsOutputToContain('Installing and building Node dependencies.') | ||
->expectsOutputToContain('Node dependencies installed successfully.') | ||
->expectsConfirmation('Would you like to publish the Wave configuration file?') | ||
->assertExitCode(0); | ||
|
||
$this->assertFileExists($this->app->configPath('broadcasting.php')); | ||
unlink($this->app->configPath('broadcasting.php')); | ||
}); |