RemoteSourceTest.php in FileField Sources 8
File
tests/src/Functional/RemoteSourceTest.php
View source
<?php
namespace Drupal\Tests\filefield_sources\Functional;
class RemoteSourceTest extends FileFieldSourcesTestBase {
public function testRemoteSourceEnabled() {
$this
->enableSources([
'remote' => TRUE,
]);
$module_path = \Drupal::service('module_handler')
->getModule('filefield_sources')
->getPath();
$file_url = $GLOBALS['base_url'] . $GLOBALS['base_path'] . $module_path . '/README.txt';
$this
->uploadFileByRemoteSource($file_url, 'README.txt', 0);
$this
->assertNoFieldByXPath('//input[@type="submit"]', t('Transfer'), t('After uploading a file, "Transfer" button is no longer displayed.'));
$this
->removeFile('README.txt', 0);
$this
->assertFieldByXpath('//input[@type="submit"]', t('Transfer'), 'After clicking the "Remove" button, the "Transfer" button is displayed.');
}
public function testFileWithSpecialCharacters() {
$this
->enableSources([
'remote' => TRUE,
]);
$module_path = \Drupal::service('module_handler')
->getModule('filefield_sources')
->getPath();
$file_url = $GLOBALS['base_url'] . $GLOBALS['base_path'] . $module_path . '/tests/files/%CE%B2%CE%B3.txt';
$this
->uploadFileByRemoteSource($file_url, 'bg.txt', 0);
$this
->assertNoFieldByXPath('//input[@type="submit"]', t('Transfer'), t('After uploading a file, "Transfer" button is no longer displayed.'));
$this
->removeFile('bg.txt', 0);
}
}