예제 #1
0
 public function testGetBucket()
 {
     /* @var $component Component */
     $component = Yii::createObject(['class' => Component::className(), 'accessKey' => '111', 'secretKey' => '222', 'disks' => ['testBucket' => ['bucket' => 'bucketOnQiniu', 'baseUrl' => 'http://xxx.xx.xx']]]);
     $this->assertEquals('bucketOnQiniu', $component->getDisk('testBucket')->bucket);
     $this->assertEquals('bucketOnQiniu', $component->getDisk('testBucket')->getBucket());
 }
예제 #2
0
 public function testCreateComponentWithDisk()
 {
     /* @var $component Component */
     $component = Yii::createObject(['class' => Component::className(), 'accessKey' => '111', 'secretKey' => '222', 'disks' => ['testBucket' => ['bucket' => 'bucketOnQiniu', 'baseUrl' => 'http://xxx.xx.clouddn.com']]]);
     $this->assertInstanceOf(Component::className(), $component);
     $this->assertInstanceOf(Filesystem::className(), $component->getDisk('testBucket'));
 }
예제 #3
0
 /**
  * @dataProvider setVisibilityDataProvider
  */
 public function testSetVisibility($isPrivate)
 {
     $v = Yii::createObject(['class' => Component::className(), 'accessKey' => '111', 'secretKey' => '222', 'disks' => ['testBucket' => ['isPrivate' => $isPrivate, 'bucket' => 'testBucket', 'baseUrl' => 'http://xxx.xx.clouddn.com']]])->getDisk('testBucket')->setVisibility('/', AdapterInterface::VISIBILITY_PUBLIC);
     $this->assertTrue($v);
 }