public function MimeMailWebTest::testUrl in Mime Mail 8
Tests that spaces in attachment filenames are properly URL-encoded.
File
- tests/
src/ Functional/ MimeMailWebTest.php, line 56
Class
- MimeMailWebTest
- Mime Mail web tests.
Namespace
Drupal\Tests\mimemail\FunctionalCode
public function testUrl() {
$this
->drupalGet('admin/config/system/mimemail');
$this
->submitForm([
'linkonly' => TRUE,
], 'Save configuration');
$url = 'public://' . $this
->randomMachineName() . ' ' . $this
->randomMachineName() . '.jpg';
$result = MimeMailFormatHelper::mimeMailUrl($url, TRUE);
$expected = str_replace(' ', '%20', file_create_url($url));
$message = 'Stream wrapper converted to web accessible URL for linked image.';
$this
->assertSame($result, $expected, $message);
}