email support
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Admin\EmailTemplateController;
|
||||
use App\Models\Document;
|
||||
use App\Models\EmailTemplate;
|
||||
|
||||
it('fills img src from template documents by matching alt', function () {
|
||||
$tpl = new EmailTemplate;
|
||||
// fake relation collection with a single image document
|
||||
$doc = new Document([
|
||||
'path' => 'email-images/logo-uuid.png',
|
||||
'file_name' => 'logo-uuid.png',
|
||||
'mime_type' => 'image/png',
|
||||
'name' => 'logo',
|
||||
]);
|
||||
$tpl->setRelation('documents', collect([$doc]));
|
||||
|
||||
$controller = new EmailTemplateController;
|
||||
$ref = new ReflectionClass($controller);
|
||||
$method = $ref->getMethod('attachSrcFromTemplateDocuments');
|
||||
$method->setAccessible(true);
|
||||
|
||||
$input = '<div><img alt="Logo" width="300"></div>';
|
||||
$output = $method->invoke($controller, $tpl, $input);
|
||||
|
||||
expect($output)->toContain('src="/storage/email-images/logo-uuid.png"');
|
||||
});
|
||||
Reference in New Issue
Block a user