mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
View Extender (add namespace) (#2134)
This commit is contained in:
committed by
GitHub
parent
368a9836bd
commit
cd58692fca
1
framework/core/tests/fixtures/views/test.blade.php
vendored
Normal file
1
framework/core/tests/fixtures/views/test.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<html><body>Hello World!</body></html>
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Tests\integration\extenders;
|
||||
|
||||
use Flarum\Extend;
|
||||
use Flarum\Tests\integration\TestCase;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
|
||||
class ViewNamespaceTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function custom_view_namespace_does_not_exist_by_default()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->app()->getContainer()->make(Factory::class)->make('integration.test::test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function custom_view_namespace_can_be_added_by_extender()
|
||||
{
|
||||
$this->extend(
|
||||
(new Extend\ViewNamespace)
|
||||
->add('integration.test', dirname(__FILE__, 3).'/fixtures/views')
|
||||
);
|
||||
|
||||
$this->assertEquals('<html><body>Hello World!</body></html>', trim($this->app()->getContainer()->make(Factory::class)->make('integration.test::test')->render()));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user