Tweak mocks
This commit is contained in:
parent
f51e2d7b9d
commit
19efd013f6
|
|
@ -23,7 +23,7 @@ class PluginManagerTest extends TestCase
|
||||||
public function testNotLoadDisabled()
|
public function testNotLoadDisabled()
|
||||||
{
|
{
|
||||||
$dir = config('plugins.directory');
|
$dir = config('plugins.directory');
|
||||||
config(['plugins.directory' => storage_path('mocks')]);
|
config(['plugins.directory' => base_path('tests/__mocks__')]);
|
||||||
|
|
||||||
app()->forgetInstance(PluginManager::class);
|
app()->forgetInstance(PluginManager::class);
|
||||||
resolve(PluginManager::class)->boot();
|
resolve(PluginManager::class)->boot();
|
||||||
|
|
@ -207,7 +207,26 @@ class PluginManagerTest extends TestCase
|
||||||
resolve(PluginManager::class)->boot();
|
resolve(PluginManager::class)->boot();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoadViewsAndTranslations()
|
public function testLoadViews()
|
||||||
|
{
|
||||||
|
$dir = config('plugins.directory');
|
||||||
|
config(['plugins.directory' => base_path('tests/__mocks__')]);
|
||||||
|
$this->mock(Option::class, function ($mock) {
|
||||||
|
$mock->shouldReceive('get')
|
||||||
|
->with('plugins_enabled', '[]')
|
||||||
|
->andReturn(json_encode([
|
||||||
|
['name' => 'fake-with-views', 'version' => '0.0.0'],
|
||||||
|
]));
|
||||||
|
});
|
||||||
|
|
||||||
|
app()->forgetInstance(PluginManager::class);
|
||||||
|
resolve(PluginManager::class)->boot();
|
||||||
|
$this->assertTrue(view()->exists('FakeWithViews::example'));
|
||||||
|
|
||||||
|
config(['plugins.directory' => $dir]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLoadTranslations()
|
||||||
{
|
{
|
||||||
$this->mock(Option::class, function ($mock) {
|
$this->mock(Option::class, function ($mock) {
|
||||||
$mock->shouldReceive('get')
|
$mock->shouldReceive('get')
|
||||||
|
|
@ -257,15 +276,6 @@ class PluginManagerTest extends TestCase
|
||||||
'namespace' => 'Chitanda',
|
'namespace' => 'Chitanda',
|
||||||
]));
|
]));
|
||||||
});
|
});
|
||||||
$this->mock('view', function ($mock) {
|
|
||||||
$mock->shouldReceive('addNamespace')
|
|
||||||
->withArgs(['Mayaka', '/mayaka/views'])
|
|
||||||
->once();
|
|
||||||
|
|
||||||
$mock->shouldReceive('addNamespace')
|
|
||||||
->withArgs(['Chitanda', '/chitanda/views'])
|
|
||||||
->once();
|
|
||||||
});
|
|
||||||
$this->instance('translation.loader', \Mockery::mock(\App\Services\Translations\Loader::class, function ($mock) {
|
$this->instance('translation.loader', \Mockery::mock(\App\Services\Translations\Loader::class, function ($mock) {
|
||||||
$mock->shouldReceive('addNamespace')
|
$mock->shouldReceive('addNamespace')
|
||||||
->withArgs(['Mayaka', '/mayaka/lang'])
|
->withArgs(['Mayaka', '/mayaka/lang'])
|
||||||
|
|
@ -432,7 +442,7 @@ class PluginManagerTest extends TestCase
|
||||||
public function testRegisterAutoload()
|
public function testRegisterAutoload()
|
||||||
{
|
{
|
||||||
$dir = config('plugins.directory');
|
$dir = config('plugins.directory');
|
||||||
config(['plugins.directory' => storage_path('mocks')]);
|
config(['plugins.directory' => base_path('tests/__mocks__')]);
|
||||||
$this->mock(Option::class, function ($mock) {
|
$this->mock(Option::class, function ($mock) {
|
||||||
$mock->shouldReceive('get')
|
$mock->shouldReceive('get')
|
||||||
->with('plugins_enabled', '[]')
|
->with('plugins_enabled', '[]')
|
||||||
|
|
@ -452,7 +462,7 @@ class PluginManagerTest extends TestCase
|
||||||
Event::fake();
|
Event::fake();
|
||||||
|
|
||||||
$dir = config('plugins.directory');
|
$dir = config('plugins.directory');
|
||||||
config(['plugins.directory' => storage_path('mocks')]);
|
config(['plugins.directory' => base_path('tests/__mocks__')]);
|
||||||
$this->mock(Option::class, function ($mock) {
|
$this->mock(Option::class, function ($mock) {
|
||||||
$mock->shouldReceive('get')
|
$mock->shouldReceive('get')
|
||||||
->with('plugins_enabled', '[]')
|
->with('plugins_enabled', '[]')
|
||||||
|
|
|
||||||
5
tests/__mocks__/fake-with-views/package.json
Normal file
5
tests/__mocks__/fake-with-views/package.json
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"name": "fake-with-views",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"namespace": "FakeWithViews"
|
||||||
|
}
|
||||||
1
tests/__mocks__/fake-with-views/views/example.blade.php
Normal file
1
tests/__mocks__/fake-with-views/views/example.blade.php
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Page Content.
|
||||||
Loading…
Reference in New Issue
Block a user