Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add withoutMix and withMix test helpers (#30900)
- Loading branch information
1 parent
6279233
commit f32662a
Showing
2 changed files
with
69 additions
and
0 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
29 changes: 29 additions & 0 deletions
29
tests/Foundation/Testing/Concerns/InteractsWithContainerTest.php
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,29 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Foundation\Testing\Concerns; | ||
|
||
use Illuminate\Foundation\Mix; | ||
use Orchestra\Testbench\TestCase; | ||
|
||
class InteractsWithContainerTest extends TestCase | ||
{ | ||
public function testWithoutMixBindsEmptyHandlerAndReturnsInstance() | ||
{ | ||
$instance = $this->withoutMix(); | ||
|
||
$this->assertSame('', mix('path/to/asset.png')); | ||
$this->assertSame($this, $instance); | ||
} | ||
|
||
public function testWithMixRestoresOriginalHandlerAndReturnsInstance() | ||
{ | ||
$handler = new \stdClass(); | ||
$this->app->instance(Mix::class, $handler); | ||
|
||
$this->withoutMix(); | ||
$instance = $this->withMix(); | ||
|
||
$this->assertSame($handler, resolve(Mix::class)); | ||
$this->assertSame($this, $instance); | ||
} | ||
} |