OSS\Tests\ContentTypeTest::testByUser PHP Метод

testByUser() публичный Метод

public testByUser ( )
    public function testByUser()
    {
        $client = Common::getOssClient();
        $bucket = Common::getBucketName();
        $object = "test/x.txt";
        $client->putObject($bucket, $object, "hello world", array('Content-Type' => 'text/html'));
        $type = $this->getContentType($bucket, $object);
        $this->assertEquals('text/html', $type);
        $file = '/tmp/x.html';
        $object = 'test/x';
        $this->runCmd('touch ' . $file);
        $client->uploadFile($bucket, $object, $file, array('Content-Type' => 'application/json'));
        $type = $this->getContentType($bucket, $object);
        $this->assertEquals('application/json', $type);
        $file = '/tmp/x.json';
        $object = 'test/y';
        $this->runCmd('dd if=/dev/urandom of=' . $file . ' bs=1024 count=100');
        $client->multiuploadFile($bucket, $object, $file, array('partSize' => 100, 'Content-Type' => 'audio/mpeg'));
        $type = $this->getContentType($bucket, $object);
        $this->assertEquals('audio/mpeg', $type);
    }