Inject current plugin at bootstrapper

This commit is contained in:
Pig Fang 2019-08-23 14:20:04 +08:00
parent 602fde7227
commit ca4d1b5d04
2 changed files with 3 additions and 2 deletions

View File

@ -230,7 +230,7 @@ class PluginManager
{
$path = $plugin->getPath().'/bootstrap.php';
if ($this->filesystem->exists($path)) {
$this->app->call($this->filesystem->getRequire($path));
$this->app->call($this->filesystem->getRequire($path), ['plugin' => $plugin]);
}
}

View File

@ -291,8 +291,9 @@ class PluginManagerTest extends TestCase
$mock->shouldReceive('getRequire')
->with('/mayaka/bootstrap.php')
->once()
->andReturn(function (\Illuminate\Contracts\Events\Dispatcher $events) {
->andReturn(function (\Illuminate\Contracts\Events\Dispatcher $events, Plugin $plugin) {
$this->assertTrue(method_exists($events, 'listen'));
$this->assertEquals('mayaka', $plugin->name);
});
});