Skip to content

Commit afe7d87

Browse files
authored
Merge pull request #308 from qiniu/develop
delete checkCrc
2 parents 464f3eb + a6f70d6 commit afe7d87

20 files changed

+52
-92
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ php:
66
- 5.5
77
- 5.6
88
- 7.0
9-
- 7.2
109

1110
before_script:
1211
- export QINIU_TEST_ENV="travis"

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"php": ">=5.3.3"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "~8.0",
19+
"phpunit/phpunit": "~4.0",
2020
"squizlabs/php_codesniffer": "~2.3"
2121
},
2222
"autoload": {

src/Qiniu/Config.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
final class Config
55
{
6-
const SDK_VER = '7.3.0';
6+
const SDK_VER = '7.2.9';
77

88
const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改
99

src/Qiniu/Storage/FormUploader.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public static function put(
3131
$config,
3232
$params,
3333
$mime,
34-
$fname,
35-
$checkCrc
34+
$fname
3635
) {
3736
$fields = array('token' => $upToken);
3837
if ($key === null) {

src/Qiniu/Storage/UploadManager.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public function put(
4646
$data,
4747
$params = null,
4848
$mime = 'application/octet-stream',
49-
$fname = null,
50-
$checkCrc = false
49+
$fname = null
5150
) {
5251

5352
$params = self::trimParams($params);
@@ -58,8 +57,7 @@ public function put(
5857
$this->config,
5958
$params,
6059
$mime,
61-
$fname,
62-
$checkCrc
60+
$fname
6361
);
6462
}
6563

@@ -110,8 +108,7 @@ public function putFile(
110108
$this->config,
111109
$params,
112110
$mime,
113-
basename($filePath),
114-
$checkCrc
111+
basename($filePath)
115112
);
116113
}
117114

tests/Qiniu/Tests/AuthTest.php

100644100755
+10-13
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
function time()
66
{
77
return isset($_SERVER['override_qiniu_auth_time'])
8-
? 2234567890
8+
? 1234567890
99
: \time();
1010
}
1111
}
1212

1313
namespace Qiniu\Tests {
1414
use Qiniu\Auth;
15-
use PHPUnit\Framework\TestCase;
1615

1716
// @codingStandardsIgnoreEnd
1817

19-
class AuthTest extends TestCase
18+
class AuthTest extends \PHPUnit_Framework_TestCase
2019
{
2120

2221
public function testSign()
@@ -30,10 +29,7 @@ public function testSignWithData()
3029
{
3130
global $dummyAuth;
3231
$token = $dummyAuth->signWithData('test');
33-
$this->assertEquals(
34-
'abcdefghklmnopq:-jP8eEV9v48MkYiBGs81aDxl60E=:dGVzdA==',
35-
$token
36-
);
32+
$this->assertEquals('abcdefghklmnopq:-jP8eEV9v48MkYiBGs81aDxl60E=:dGVzdA==', $token);
3733
}
3834

3935
public function testSignRequest()
@@ -43,18 +39,15 @@ public function testSignRequest()
4339
$this->assertEquals('abcdefghklmnopq:cFyRVoWrE3IugPIMP5YJFTO-O-Y=', $token);
4440
$ctype = 'application/x-www-form-urlencoded';
4541
$token = $dummyAuth->signRequest('http://www.qiniu.com?go=1', 'test', $ctype);
46-
$this->assertEquals(
47-
$token,
48-
'abcdefghklmnopq:svWRNcacOE-YMsc70nuIYdaa1e4='
49-
);
42+
$this->assertEquals($token, 'abcdefghklmnopq:svWRNcacOE-YMsc70nuIYdaa1e4=');
5043
}
5144

5245
public function testPrivateDownloadUrl()
5346
{
5447
global $dummyAuth;
5548
$_SERVER['override_qiniu_auth_time'] = true;
5649
$url = $dummyAuth->privateDownloadUrl('http://www.qiniu.com?go=1');
57-
$expect = 'http://www.qiniu.com?go=1&e=2234571490&token=abcdefghklmnopq:Hvi3R79Sl6wZy1c331nv0iIFoJk=';
50+
$expect = 'http://www.qiniu.com?go=1&e=1234571490&token=abcdefghklmnopq:8vzBeLZ9W3E4kbBLFLW0Xe0u7v4=';
5851
$this->assertEquals($expect, $url);
5952
unset($_SERVER['override_qiniu_auth_time']);
6053
}
@@ -65,10 +58,14 @@ public function testUploadToken()
6558
$_SERVER['override_qiniu_auth_time'] = true;
6659
$token = $dummyAuth->uploadToken('1', '2', 3600, array('endUser' => 'y'));
6760
// @codingStandardsIgnoreStart
68-
$exp = 'abcdefghklmnopq:GracWhW1iGwVL6haVH5dr4gjqeo=:eyJlbmRVc2VyIjoieSIsInNjb3BlIjoiMToyIiwiZGVhZGxpbmUiOjIyMzQ1NzE0OTB9';
61+
$exp = 'abcdefghklmnopq:yyeexeUkPOROoTGvwBjJ0F0VLEo=:eyJlbmRVc2VyIjoieSIsInNjb3BlIjoiMToyIiwiZGVhZGxpbmUiOjEyMzQ1NzE0OTB9';
6962
// @codingStandardsIgnoreEnd
7063
$this->assertEquals($exp, $token);
7164
unset($_SERVER['override_qiniu_auth_time']);
7265
}
66+
67+
public function testVerifyCallback()
68+
{
69+
}
7370
}
7471
}

tests/Qiniu/Tests/Base64Test.php

100644100755
+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
namespace Qiniu\Tests;
33

44
use Qiniu;
5-
use PHPUnit\Framework\TestCase;
65

7-
class Base64Test extends TestCase
6+
class Base64Test extends \PHPUnit_Framework_TestCase
87
{
98
public function testUrlSafe()
109
{

tests/Qiniu/Tests/BucketTest.php

100644100755
+2-3
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
namespace Qiniu\Tests;
33

44
use Qiniu\Storage\BucketManager;
5-
use PHPUnit\Framework\TestCase;
65

7-
class BucketTest extends TestCase
6+
class BucketTest extends \PHPUnit_Framework_TestCase
87
{
98
protected $bucketManager;
109
protected $dummyBucketManager;
1110
protected $bucketName;
1211
protected $key;
1312
protected $key2;
1413

15-
protected function setUp(): void
14+
protected function setUp()
1615
{
1716
global $bucketName;
1817
global $key;

tests/Qiniu/Tests/CdnManagerTest.php

100644100755
+3-13
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010

1111
use Qiniu\Cdn\CdnManager;
1212
use Qiniu\Http\Client;
13-
use PHPUnit\Framework\TestCase;
1413

15-
class CdnManagerTest extends TestCase
14+
class CdnManagerTest extends \PHPUnit_Framework_TestCase
1615
{
1716
protected $cdnManager;
1817
protected $encryptKey;
1918
protected $imgUrl;
2019

21-
protected function setUp(): void
20+
protected function setUp()
2221
{
2322
global $timestampAntiLeechEncryptKey;
2423
global $customDomain;
@@ -35,17 +34,8 @@ public function testCreateTimestampAntiLeechUrl()
3534
$signUrl = $this->cdnManager->createTimestampAntiLeechUrl($this->imgUrl, $this->encryptKey, 3600);
3635

3736
$response = Client::get($signUrl);
37+
3838
$this->assertEquals($response->statusCode, 200);
3939
$this->assertNull($response->error);
40-
41-
$url2 = $this->imgUrl . '?imageInfo';
42-
$signUrl2 = $this->cdnManager->createTimestampAntiLeechUrl($url2, $this->encryptKey, 3600);
43-
44-
$response = Client::get($signUrl2);
45-
$imgInfo = $response->json();
46-
47-
$this->assertEquals($response->statusCode, 200);
48-
$this->assertEquals($imgInfo['size'], 2196145);
49-
$this->assertNull($response->error);
5040
}
5141
}

tests/Qiniu/Tests/Crc32Test.php

100644100755
+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
namespace Qiniu\Tests;
33

44
use Qiniu;
5-
use PHPUnit\Framework\TestCase;
65

7-
class Crc32Test extends TestCase
6+
class Crc32Test extends \PHPUnit_Framework_TestCase
87
{
98
public function testData()
109
{

tests/Qiniu/Tests/DownloadTest.php

100644100755
+3-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
namespace Qiniu\Tests;
33

44
use Qiniu\Http\Client;
5-
use PHPUnit\Framework\TestCase;
65

7-
class DownloadTest extends TestCase
6+
class DownloadTest extends \PHPUnit_Framework_TestCase
87
{
98
public function test()
109
{
1110
global $testAuth;
12-
$base_url = 'http://pojiwyou0.bkt.clouddn.com/demo.png';
11+
$base_url = 'http://private-res.qiniudn.com/gogopher.jpg';
1312
$private_url = $testAuth->privateDownloadUrl($base_url);
1413
$response = Client::get($private_url);
1514
$this->assertEquals(200, $response->statusCode);
@@ -18,7 +17,7 @@ public function test()
1817
public function testFop()
1918
{
2019
global $testAuth;
21-
$base_url = 'http://pojiwyou0.bkt.clouddn.com/demo.png?imageInfo';
20+
$base_url = 'http://private-res.qiniudn.com/gogopher.jpg?exif';
2221
$private_url = $testAuth->privateDownloadUrl($base_url);
2322
$response = Client::get($private_url);
2423
$this->assertEquals(200, $response->statusCode);

tests/Qiniu/Tests/EtagTest.php

100644100755
+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
namespace Qiniu\Tests;
33

44
use Qiniu\Etag;
5-
use PHPUnit\Framework\TestCase;
65

7-
class EtagTest extends TestCase
6+
class EtagTest extends \PHPUnit_Framework_TestCase
87
{
98
public function test0M()
109
{

tests/Qiniu/Tests/FopTest.php

100644100755
+8-9
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33

44
use Qiniu\Processing\Operation;
55
use Qiniu\Processing\PersistentFop;
6-
use PHPUnit\Framework\TestCase;
76

8-
class FopTest extends TestCase
7+
class FopTest extends \PHPUnit_Framework_TestCase
98
{
109
public function testExifPub()
1110
{
12-
$fop = new Operation('7xkv1q.com1.z0.glb.clouddn.com');
13-
list($exif, $error) = $fop->execute('grape.jpg', 'exif');
11+
$fop = new Operation('testres.qiniudn.com');
12+
list($exif, $error) = $fop->execute('gogopher.jpg', 'exif');
1413
$this->assertNull($error);
1514
$this->assertNotNull($exif);
1615
}
@@ -27,12 +26,12 @@ public function testExifPrivate()
2726
public function testbuildUrl()
2827
{
2928
$fops = 'imageView2/2/h/200';
30-
$fop = new Operation('7xkv1q.com1.z0.glb.clouddn.com');
31-
$url = $fop->buildUrl('grape.jpg', $fops);
32-
$this->assertEquals($url, 'http://7xkv1q.com1.z0.glb.clouddn.com/grape.jpg?imageView2/2/h/200');
29+
$fop = new Operation('testres.qiniudn.com');
30+
$url = $fop->buildUrl('gogopher.jpg', $fops);
31+
$this->assertEquals($url, 'http://testres.qiniudn.com/gogopher.jpg?imageView2/2/h/200');
3332

3433
$fops = array('imageView2/2/h/200', 'imageInfo');
35-
$url = $fop->buildUrl('grape.jpg', $fops);
36-
$this->assertEquals($url, 'http://7xkv1q.com1.z0.glb.clouddn.com/grape.jpg?imageView2/2/h/200|imageInfo');
34+
$url = $fop->buildUrl('gogopher.jpg', $fops);
35+
$this->assertEquals($url, 'http://testres.qiniudn.com/gogopher.jpg?imageView2/2/h/200|imageInfo');
3736
}
3837
}

tests/Qiniu/Tests/FormUpTest.php

100644100755
+6-16
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
use Qiniu\Storage\FormUploader;
55
use Qiniu\Storage\UploadManager;
66
use Qiniu\Config;
7-
use PHPUnit\Framework\TestCase;
87

9-
class FormUpTest extends TestCase
8+
class FormUpTest extends \PHPUnit_Framework_TestCase
109
{
1110
protected $bucketName;
1211
protected $auth;
1312
protected $cfg;
1413

15-
protected function setUp(): void
14+
protected function setUp()
1615
{
1716
global $bucketName;
1817
$this->bucketName = $bucketName;
@@ -25,16 +24,7 @@ protected function setUp(): void
2524
public function testData()
2625
{
2726
$token = $this->auth->uploadToken($this->bucketName);
28-
list($ret, $error) = FormUploader::put(
29-
$token,
30-
'formput',
31-
'hello world',
32-
$this->cfg,
33-
null,
34-
'text/plain',
35-
null,
36-
false
37-
);
27+
list($ret, $error) = FormUploader::put($token, 'formput', 'hello world', $this->cfg, null, 'text/plain', null);
3828
$this->assertNull($error);
3929
$this->assertNotNull($ret['hash']);
4030
}
@@ -43,7 +33,7 @@ public function testData2()
4333
{
4434
$upManager = new UploadManager();
4535
$token = $this->auth->uploadToken($this->bucketName);
46-
list($ret, $error) = $upManager->put($token, 'formput', 'hello world', null, 'text/plain', null, false);
36+
list($ret, $error) = $upManager->put($token, 'formput', 'hello world', null, 'text/plain', null);
4737
$this->assertNull($error);
4838
$this->assertNotNull($ret['hash']);
4939
}
@@ -52,7 +42,7 @@ public function testFile()
5242
{
5343
$key = 'formPutFile';
5444
$token = $this->auth->uploadToken($this->bucketName, $key);
55-
list($ret, $error) = FormUploader::putFile($token, $key, __file__, $this->cfg, null, 'text/plain', null, false);
45+
list($ret, $error) = FormUploader::putFile($token, $key, __file__, $this->cfg, null, 'text/plain', null);
5646
$this->assertNull($error);
5747
$this->assertNotNull($ret['hash']);
5848
}
@@ -62,7 +52,7 @@ public function testFile2()
6252
$key = 'formPutFile';
6353
$token = $this->auth->uploadToken($this->bucketName, $key);
6454
$upManager = new UploadManager();
65-
list($ret, $error) = $upManager->putFile($token, $key, __file__, null, 'text/plain', null, false);
55+
list($ret, $error) = $upManager->putFile($token, $key, __file__, null, 'text/plain', null);
6656
$this->assertNull($error);
6757
$this->assertNotNull($ret['hash']);
6858
}

tests/Qiniu/Tests/HttpTest.php

100644100755
+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
namespace Qiniu\Tests;
33

44
use Qiniu\Http\Client;
5-
use PHPUnit\Framework\TestCase;
65

7-
class HttpTest extends TestCase
6+
class HttpTest extends \PHPUnit_Framework_TestCase
87
{
98
public function testGet()
109
{

tests/Qiniu/Tests/ImageUrlBuilderTest.php

100644100755
+1-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
namespace Qiniu\Tests;
44

5-
use PHPUnit\Framework\TestCase;
6-
75
/**
86
* imageprocess test
97
*
108
* @package Qiniu
119
* @subpackage test
1210
* @author Sherlock Ren <[email protected]>
1311
*/
14-
class ImageUrlBuilderTest extends TestCase
12+
class ImageUrlBuilderTest extends \PHPUnit_Framework_TestCase
1513
{
1614
/**
1715
* 缩略图测试

tests/Qiniu/Tests/PfopTest.php

100644100755
+1-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33

44
use Qiniu\Processing\Operation;
55
use Qiniu\Processing\PersistentFop;
6-
use PHPUnit\Framework\TestCase;
76

8-
class PfopTest extends TestCase
7+
class PfopTest extends \PHPUnit_Framework_TestCase
98
{
109
public function testPfop()
1110
{

0 commit comments

Comments
 (0)