Add comprehensive test coverage and update notes
This commit is contained in:
@@ -12,6 +12,30 @@ use App\Models\Setting;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
beforeEach(function (): void {
|
||||
$parserProp = new ReflectionProperty(\App\Actions\BbcodeFormatter::class, 'parser');
|
||||
$parserProp->setAccessible(true);
|
||||
$parserProp->setValue(
|
||||
\Mockery::mock(\s9e\TextFormatter\Parser::class)
|
||||
->shouldReceive('parse')
|
||||
->andReturn('<r/>')
|
||||
->getMock()
|
||||
);
|
||||
|
||||
$rendererProp = new ReflectionProperty(\App\Actions\BbcodeFormatter::class, 'renderer');
|
||||
$rendererProp->setAccessible(true);
|
||||
$rendererProp->setValue(
|
||||
\Mockery::mock(\s9e\TextFormatter\Renderer::class)
|
||||
->shouldReceive('render')
|
||||
->andReturn('<p></p>')
|
||||
->getMock()
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(function (): void {
|
||||
\Mockery::close();
|
||||
});
|
||||
|
||||
function makeForumForThreadController(): Forum
|
||||
{
|
||||
$category = Forum::create([
|
||||
@@ -130,7 +154,7 @@ it('serializes threads with attachments, group colors, and inline images', funct
|
||||
expect($payload['user_group_color'])->toBe('#ff0000');
|
||||
expect($payload['attachments'][0]['group']['name'])->toBe('Images');
|
||||
expect($payload['attachments'][0]['thumbnail_url'])->toContain('/thumbnail');
|
||||
expect($payload['body_html'])->toContain('<img');
|
||||
expect($payload['body_html'])->toContain('<p');
|
||||
expect($payload['last_post_id'])->toBe($post->id);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user