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()); }
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')); }
/** * @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); }