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

feat(testing): add a trait to flush the formatter cache in tests (#3811)

This commit is contained in:
Sami Mazouz
2023-04-30 09:48:46 +01:00
committed by GitHub
parent cfdd6910eb
commit 7298ccb301
2 changed files with 26 additions and 4 deletions

View File

@@ -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);
}
/**

View File

@@ -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();
}
}