blessing-skin-server/tests/ServicesTest/WebpackTest.php

26 lines
721 B
PHP
Raw Normal View History

2019-03-31 13:12:56 +08:00
<?php
namespace Tests;
2019-09-07 10:18:24 +08:00
use Illuminate\Filesystem\Filesystem;
2019-03-31 13:12:56 +08:00
class WebpackTest extends TestCase
{
public function testManifest()
{
2019-09-07 10:18:24 +08:00
$this->mock(Filesystem::class, function ($mock) {
$mock->shouldReceive('exists')
->with(public_path('app/manifest.json'))
->once()
->andReturn(true);
$mock->shouldReceive('get')
->with(public_path('app/manifest.json'))
->once()
->andReturn(json_encode(['a' => 'b']));
});
$this->assertEquals('b', resolve(\App\Services\Webpack::class)->{'a'});
$this->assertEquals('', resolve(\App\Services\Webpack::class)->{'nope'});
2019-03-31 13:12:56 +08:00
}
}