blessing-skin-server/tests/ListenersTest/NotifyFailedPluginTest.php
2020-03-10 15:12:03 +08:00

31 lines
870 B
PHP

<?php
namespace Tests;
use App\Events;
use App\Models\User;
use App\Services\Plugin;
class NotifyFailedPluginTest extends TestCase
{
public function testHandle()
{
$content = [];
$plugin = new Plugin('', ['title' => 'ff']);
event(new Events\PluginBootFailed($plugin));
event(new Events\RenderingFooter($content));
$this->assertCount(0, $content);
$this->actingAs(factory(User::class)->make());
event(new Events\PluginBootFailed($plugin));
event(new Events\RenderingFooter($content));
$this->assertCount(0, $content);
$this->actingAs(factory(User::class)->states('admin')->make());
event(new Events\PluginBootFailed($plugin));
event(new Events\RenderingFooter($content));
$this->assertStringContainsString('blessing.notify.toast', $content[0]);
}
}