/** * @expectedException \InvalidArgumentException * @covers Drupal\amazons3\S3Url::factory */ public function testFactoryInvalidUrl() { $url = S3Url::factory(':'); }
/** * {@inheritdoc} */ public function dirname($uri = NULL) { // drupal_dirname() doesn't call setUri() before calling. That lead our URI // to be stuck at the default 's3://'' that is set by // file_stream_wrapper_get_instance_by_scheme(). if ($uri) { $this->setUri($uri); } $s3url = S3Url::factory($uri, $this->config); $s3url->normalizePath(); $pathSegments = $s3url->getPathSegments(); array_pop($pathSegments); $s3url->setPath($pathSegments); return trim((string) $s3url, '/'); }