remove unnecessary code

This commit is contained in:
Pig Fang 2020-06-30 09:27:40 +08:00
parent e018ced5d8
commit db74a9c051
No known key found for this signature in database
GPG Key ID: A8198F548DADA9E2
3 changed files with 2 additions and 25 deletions

View File

@ -13,12 +13,6 @@ class RenderingFooter extends Event
public function addContent(string $content) public function addContent(string $content)
{ {
if ($content) { $this->contents[] = $content;
if (!is_string($content)) {
throw new \Exception('Can not add non-string content', 1);
}
$this->contents[] = $content;
}
} }
} }

View File

@ -13,12 +13,6 @@ class RenderingHeader extends Event
public function addContent(string $content) public function addContent(string $content)
{ {
if ($content) { $this->contents[] = $content;
if (!is_string($content)) {
throw new \Exception('Can not add non-string content', 1);
}
$this->contents[] = $content;
}
} }
} }

View File

@ -5,7 +5,6 @@ namespace Tests;
use App\Events\RenderingFooter; use App\Events\RenderingFooter;
use App\Events\RenderingHeader; use App\Events\RenderingHeader;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use stdClass;
class HomeControllerTest extends TestCase class HomeControllerTest extends TestCase
{ {
@ -23,11 +22,6 @@ class HomeControllerTest extends TestCase
$event->addContent('testing custom header'); $event->addContent('testing custom header');
}); });
$this->get('/')->assertSee('testing custom header'); $this->get('/')->assertSee('testing custom header');
Event::listen(RenderingHeader::class, function (RenderingHeader $event) {
$event->addContent(new stdClass());
});
$this->get('/');
} }
public function testRenderingFooterEvent() public function testRenderingFooterEvent()
@ -36,11 +30,6 @@ class HomeControllerTest extends TestCase
$event->addContent('testing custom footer'); $event->addContent('testing custom footer');
}); });
$this->get('/')->assertSee('testing custom footer'); $this->get('/')->assertSee('testing custom footer');
Event::listen(RenderingFooter::class, function (RenderingFooter $event) {
$event->addContent(new stdClass());
});
$this->get('/');
} }
public function testApiRoot() public function testApiRoot()