Load translations of plugins even disabled
This commit is contained in:
parent
0c6fe77492
commit
c976a5c5f8
|
|
@ -136,6 +136,10 @@ class PluginManager
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->all()->each(function ($plugin) {
|
||||||
|
$this->loadViewsAndTranslations($plugin);
|
||||||
|
});
|
||||||
|
|
||||||
$enabled = $this->getEnabledPlugins();
|
$enabled = $this->getEnabledPlugins();
|
||||||
$enabled->each(function ($plugin) {
|
$enabled->each(function ($plugin) {
|
||||||
$this->registerPlugin($plugin);
|
$this->registerPlugin($plugin);
|
||||||
|
|
@ -155,7 +159,6 @@ class PluginManager
|
||||||
{
|
{
|
||||||
$this->registerAutoload($plugin);
|
$this->registerAutoload($plugin);
|
||||||
$this->loadVendor($plugin);
|
$this->loadVendor($plugin);
|
||||||
$this->loadViewsAndTranslations($plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ class PluginManagerTest extends TestCase
|
||||||
$mock->shouldReceive('directories')
|
$mock->shouldReceive('directories')
|
||||||
->with(base_path('plugins'))
|
->with(base_path('plugins'))
|
||||||
->once()
|
->once()
|
||||||
->andReturn(collect(['/mayaka']));
|
->andReturn(collect(['/mayaka', '/chitanda']));
|
||||||
|
|
||||||
$mock->shouldReceive('exists')
|
$mock->shouldReceive('exists')
|
||||||
->with('/mayaka'.DIRECTORY_SEPARATOR.'package.json')
|
->with('/mayaka'.DIRECTORY_SEPARATOR.'package.json')
|
||||||
|
|
@ -236,16 +236,38 @@ class PluginManagerTest extends TestCase
|
||||||
->with('/mayaka/bootstrap.php')
|
->with('/mayaka/bootstrap.php')
|
||||||
->once()
|
->once()
|
||||||
->andReturn(false);
|
->andReturn(false);
|
||||||
|
|
||||||
|
$mock->shouldReceive('exists')
|
||||||
|
->with('/chitanda'.DIRECTORY_SEPARATOR.'package.json')
|
||||||
|
->once()
|
||||||
|
->andReturn(true);
|
||||||
|
|
||||||
|
$mock->shouldReceive('get')
|
||||||
|
->with('/chitanda'.DIRECTORY_SEPARATOR.'package.json')
|
||||||
|
->once()
|
||||||
|
->andReturn(json_encode([
|
||||||
|
'name' => 'chitanda',
|
||||||
|
'version' => '0.0.0',
|
||||||
|
'namespace' => 'Chitanda',
|
||||||
|
]));
|
||||||
});
|
});
|
||||||
$this->mock('view', function ($mock) {
|
$this->mock('view', function ($mock) {
|
||||||
$mock->shouldReceive('addNamespace')
|
$mock->shouldReceive('addNamespace')
|
||||||
->withArgs(['Mayaka', '/mayaka/views'])
|
->withArgs(['Mayaka', '/mayaka/views'])
|
||||||
->once();
|
->once();
|
||||||
|
|
||||||
|
$mock->shouldReceive('addNamespace')
|
||||||
|
->withArgs(['Chitanda', '/chitanda/views'])
|
||||||
|
->once();
|
||||||
});
|
});
|
||||||
$this->instance('translation.loader', \Mockery::mock(\App\Services\TranslationLoader::class, function ($mock) {
|
$this->instance('translation.loader', \Mockery::mock(\App\Services\TranslationLoader::class, function ($mock) {
|
||||||
$mock->shouldReceive('addNamespace')
|
$mock->shouldReceive('addNamespace')
|
||||||
->withArgs(['Mayaka', '/mayaka/lang'])
|
->withArgs(['Mayaka', '/mayaka/lang'])
|
||||||
->once();
|
->once();
|
||||||
|
|
||||||
|
$mock->shouldReceive('addNamespace')
|
||||||
|
->withArgs(['Chitanda', '/chitanda/lang'])
|
||||||
|
->once();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
app()->forgetInstance(PluginManager::class);
|
app()->forgetInstance(PluginManager::class);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user