1
0
mirror of https://github.com/flarum/core.git synced 2025-07-31 13:40:20 +02:00

Rename view extender

As discussed in my initial review, it seems unlikely that we need
the ability to remove (or otherwise modify) namespaces again.
Therefore, it seems more consistent with other extenders to go
for a "View" extender with a "namespace" method.

Sorry for the back and forth. ;)

Refs #1891, #2134.
This commit is contained in:
Franz Liedke
2020-07-17 12:04:04 +02:00
parent 7e3d71a0a0
commit 71abac0323
2 changed files with 8 additions and 8 deletions

View File

@@ -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 ViewTest 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\View)
->namespace('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()));
}
}