Make createLocalViewFactory compatible with Laravel 8 (#1026)

* Make createLocalViewFactory compatible with Laravel 8

Fixes https://github.com/barryvdh/laravel-ide-helper/issues/1024

* tests: move up mockFilesystem so it get be re-used in other tests

Note: removed `$this->mockOutput = '';` as it was a no-op, that property
doesn't exist (it was probably a typo, but I guess we don't need it
anyway)

* tests: show basic features for ide-helper:meta working
This commit is contained in:
Markus Podar
2020-08-31 06:20:02 +02:00
committed by GitHub
parent 462989abd5
commit 1ca875fbca
4 changed files with 87 additions and 32 deletions
@@ -7,13 +7,9 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand;
use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
use Barryvdh\LaravelIdeHelper\Tests\SnapshotPhpDriver;
use Barryvdh\LaravelIdeHelper\Tests\TestCase;
use Illuminate\Filesystem\Filesystem;
use Mockery;
abstract class AbstractModelsCommand extends TestCase
{
protected $mockFilesystemOutput;
protected function setUp(): void
{
parent::setUp();
@@ -57,33 +53,6 @@ abstract class AbstractModelsCommand extends TestCase
$config->set('ide-helper.type_overrides', []);
}
protected function mockFilesystem()
{
$this->mockOutput = '';
$mockFilesystem = Mockery::mock(Filesystem::class);
$mockFilesystem
->shouldReceive('get')
->andReturnUsing(function ($file) {
return file_get_contents($file);
});
$mockFilesystem
->shouldReceive('put')
->with(
Mockery::any(),
Mockery::any()
)
->andReturnUsing(function ($path, $contents) {
$this->mockFilesystemOutput .= $contents;
return strlen($contents);
});
$this->instance(Filesystem::class, $mockFilesystem);
}
protected function assertMatchesMockedSnapshot()
{
$this->assertMatchesSnapshot($this->mockFilesystemOutput, new SnapshotPhpDriver());