Follow up from #2870448-30: Convert web tests to browser tests for file module
Problem/Motivation
Drupal\file\Tests\DownloadTest::testFileCreateUrl() contains next part:
// Test public files with a different host name from settings.
$test_base_url = 'http://www.example.com/cdn';
$this->settingsSet('file_public_base_url', $test_base_url);
$filepath = file_create_filename('test.txt', '');
$directory_uri = 'public://' . dirname($filepath);
file_prepare_directory($directory_uri, FILE_CREATE_DIRECTORY);
$file = $this->createFile($filepath, NULL, 'public');
$url = file_create_url($file->getFileUri());
$expected_url = $test_base_url . '/' . basename($filepath);
$this->assertEqual($url, $expected_url);
For convert this part to Functional test (phpunit), we need to add settingsSet() method too.
Proposed resolution
@dawehner posted:
This new method is used for \Drupal\file\Tests\DownloadTest::testFileCreateUrl which could be actually a kernel test, couldn't it?
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #1
Anonymous (not verified) commentedvaplas created an issue. See original summary.
Comment #2
Anonymous (not verified) commentedDirect transfer.
Comment #3
Anonymous (not verified) commentedClean up.
If you are a committer, and you prefer to make this transfer to #2870448: Convert web tests to browser tests for file module, just tell me about it :)
Comment #4
dawehnerWhy do we not use
\Drupal\KernelTests\KernelTestBase::setSetting?Comment #5
Anonymous (not verified) commented@dawehner, thanks for review and nice hint! Done.
Comment #6
dawehnerThis looks great for me now. Thank you!
Comment #7
xjmThe title made me think this was moving the method to KTB, which surprised me. ;)
Comment #10
xjmCommitted and pushed to 8.5.x. Thanks! I also backported it to 8.4.x as a small test improvement.
Comment #11
dawehnerThank you @xjm!