mirror of
https://github.com/flarum/framework.git
synced 2025-02-01 07:03:00 +08:00
feat(testing): add a trait to flush the formatter cache in tests (#3811)
This commit is contained in:
parent
cfdd6910eb
commit
7298ccb301
|
@ -11,16 +11,16 @@ namespace Flarum\Tests\integration\extenders;
|
|||
|
||||
use Flarum\Extend;
|
||||
use Flarum\Formatter\Formatter;
|
||||
use Flarum\Testing\integration\RefreshesFormatterCache;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
|
||||
class FormatterTest extends TestCase
|
||||
{
|
||||
use RefreshesFormatterCache;
|
||||
|
||||
protected function getFormatter()
|
||||
{
|
||||
$formatter = $this->app()->getContainer()->make(Formatter::class);
|
||||
$formatter->flush();
|
||||
|
||||
return $formatter;
|
||||
return $this->app()->getContainer()->make(Formatter::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?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\Testing\integration;
|
||||
|
||||
use Flarum\Formatter\Formatter;
|
||||
|
||||
trait RefreshesFormatterCache
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->app()->getContainer()->make(Formatter::class)->flush();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user