MimeMailWebTest.php in Mime Mail 8
File
tests/src/Functional/MimeMailWebTest.php
View source
<?php
namespace Drupal\Tests\mimemail\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\mimemail\Utility\MimeMailFormatHelper;
class MimeMailWebTest extends BrowserTestBase {
protected static $modules = [
'mailsystem',
'mimemail',
'field',
'field_ui',
];
protected $defaultTheme = 'stark';
protected $adminUser;
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->createUser([
'access administration pages',
'administer site configuration',
]);
$this
->drupalLogin($this->adminUser);
}
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);
}
}