OssClient::OSS_SIGNATURE_VERSION_V4, 'hostType' => OssClient::OSS_HOST_TYPE_PATH_STYLE, ); $this->ossClient = Common::getOssClient($config); try { $this->ossClient->getBucketInfo($this->bucket); } catch (OssException $e) { $this->assertEquals($e->getErrorCode(), "SecondLevelDomainForbidden"); $this->assertTrue(true); } try { $object = "oss-php-sdk-test/upload-test-object-name.txt"; $this->ossClient->putObject($this->bucket, $object, 'hi oss'); } catch (OssException $e) { $this->assertEquals($e->getErrorCode(), "SecondLevelDomainForbidden"); $this->assertTrue(true); } try { $endpoint = Common::getEndpoint(); $endpoint = str_replace(array('http://', 'https://'), '', $endpoint); $strUrl = $this->bucket . '.' . $endpoint . "/" . $object; $signUrl = $this->ossClient->signUrl($this->bucket, $object, 3600); $this->assertTrue(strpos($signUrl, $strUrl) !== false); } catch (OssException $e) { $this->assertFalse(true); } } }