protected function S3fsUrlGenerationTest::runDomainRootTests in S3 File System 4.0.x
Same name and namespace in other branches
- 8.3 tests/src/Functional/S3fsUrlGenerationTest.php \Drupal\Tests\s3fs\Functional\S3fsUrlGenerationTest::runDomainRootTests()
Execute domain_root tests.
@covers \Drupal\s3fs\StreamWrapper\S3fsStream::getExternalUrl
Parameters
string $domainRoot: The domain root type to set in config.
string $scheme: The uri scheme.
string $expected: The expected output from getExternalUrl.
3 calls to S3fsUrlGenerationTest::runDomainRootTests()
- S3fsUrlGenerationTest::testGetExternalUrlNone in tests/
src/ Functional/ S3fsUrlGenerationTest.php - Test getExternalUrl (none).
- S3fsUrlGenerationTest::testGetExternalUrlPublic in tests/
src/ Functional/ S3fsUrlGenerationTest.php - Test getExternalUrl (public).
- S3fsUrlGenerationTest::testGetExternalUrlRoot in tests/
src/ Functional/ S3fsUrlGenerationTest.php - Test getExternalUrl (root).
File
- tests/
src/ Functional/ S3fsUrlGenerationTest.php, line 278
Class
- S3fsUrlGenerationTest
- S3 File System Tests.
Namespace
Drupal\Tests\s3fs\FunctionalCode
protected function runDomainRootTests($domainRoot, $scheme, $expected) {
$dummyFile = 'dummy.pdf';
$domain = 'test.example.org';
// Test the external url with the root_public domain root.
$this
->config('s3fs.settings')
->set('use_cname', TRUE)
->set('root_folder', 'test_root')
->set('public_folder', 'test_public')
->set('domain_root', $domainRoot)
->set('domain', $domain)
->save();
/** @var \Drupal\s3fs\StreamWrapper\S3fsStream $streamWrapper */
$streamWrapper = \Drupal::service('stream_wrapper.s3fs');
$streamWrapper
->setUri($scheme . $dummyFile);
$this
->assertEquals('http://' . $domain . '/' . $expected . $dummyFile, $streamWrapper
->getExternalUrl(), $domainRoot . ' domain_root as expected');
}