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