class S3UrlTest in AmazonS3 7.2
Test S3Url.
@class S3UrlTest @package Drupal\amazons3Test
Hierarchy
- class \Drupal\amazons3Test\S3UrlTest extends \Drupal\amazons3Test\PHPUnit_Framework_TestCase
Expanded class hierarchy of S3UrlTest
File
- tests/
S3UrlTest.php, line 13
Namespace
Drupal\amazons3TestView source
class S3UrlTest extends \PHPUnit_Framework_TestCase {
/**
* Test that we set the scheme, bucket, and key properly.
*
* @covers Drupal\amazons3\S3Url::__construct
*/
public function testConstruct() {
$url = new S3Url('bucket', 'key');
$this
->assertEquals('s3://bucket/key', (string) $url);
$this
->assertEquals('bucket', $url
->getBucket());
$this
->assertEquals('key', $url
->getKey());
}
/**
* @covers Drupal\amazons3\S3Url::setBucket
* @covers Drupal\amazons3\S3Url::getBucket
*/
public function testGetBucket() {
$url = new S3Url('bucket');
$url
->setBucket('second-bucket');
$this
->assertEquals('second-bucket', $url
->getBucket());
}
/**
* @covers Drupal\amazons3\S3Url::setKey
* @covers Drupal\amazons3\S3Url::getKey
*/
public function testGetKey() {
$url = new S3Url('bucket');
$url
->setKey('key');
$this
->assertEquals('key', $url
->getKey());
}
/**
* @covers Drupal\amazons3\S3Url::setPath
*/
public function testSetPath() {
$url = new S3Url('bucket');
$url
->setPath(array(
'directory',
'key',
));
$this
->assertEquals('/directory/key', $url
->getPath());
}
/**
* @covers Drupal\amazons3\S3Url::getImageStyleUrl
*/
public function testGetImageStyleUrl() {
$url = new S3Url('bucket', 'key');
$styleUrl = $url
->getImageStyleUrl('style_name');
$this
->assertEquals($styleUrl
->getKey(), "styles/style_name/key");
}
/**
* @covers Drupal\amazons3\S3Url::factory
*/
public function testFactory() {
$url = S3Url::factory('s3://bucket/key');
$this
->assertInstanceOf('Drupal\\amazons3\\S3Url', $url);
}
/**
* @expectedException \InvalidArgumentException
* @covers Drupal\amazons3\S3Url::factory
*/
public function testFactoryInvalidUrl() {
$url = S3Url::factory(':');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
S3UrlTest:: |
public | function | Test that we set the scheme, bucket, and key properly. | |
S3UrlTest:: |
public | function | @covers Drupal\amazons3\S3Url::factory | |
S3UrlTest:: |
public | function | @expectedException \InvalidArgumentException @covers Drupal\amazons3\S3Url::factory | |
S3UrlTest:: |
public | function | @covers Drupal\amazons3\S3Url::setBucket @covers Drupal\amazons3\S3Url::getBucket | |
S3UrlTest:: |
public | function | @covers Drupal\amazons3\S3Url::getImageStyleUrl | |
S3UrlTest:: |
public | function | @covers Drupal\amazons3\S3Url::setKey @covers Drupal\amazons3\S3Url::getKey | |
S3UrlTest:: |
public | function | @covers Drupal\amazons3\S3Url::setPath |