public function HttpStreamWrapperTest::testDirname in Remote Stream Wrapper 8
Test dirname().
@covers ::dirname
File
- tests/
src/ Unit/ HttpStreamWrapperTest.php, line 65
Class
- HttpStreamWrapperTest
- @group remote_stream_wrapper @coversDefaultClass \Drupal\remote_stream_wrapper\StreamWrapper\HttpStreamWrapper
Namespace
Drupal\Tests\remote_stream_wrapper\UnitCode
public function testDirname() {
$wrapper = new HttpStreamWrapper();
// Test dirname() with no parameters.
$wrapper
->setUri('http://example.com/test.txt');
$this
->assertEquals('http://example.com', $wrapper
->dirname());
// Test dirname() with one directory.
$wrapper
->setUri('http://example.com/directory/test.txt');
$this
->assertEquals('http://example.com/directory', $wrapper
->dirname());
// Test dirname() with two directories and a $uri parameter.
$this
->assertEquals('http://example.com/directory/directory2', $wrapper
->dirname('http://example.com/directory/directory2/test.txt'));
// Test referencing self with a dot.
$this
->assertEquals('http://', $wrapper
->dirname('http://.'));
}