diff --git a/Changelog.md b/Changelog.md index 4aaf5bf..0a904e2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,9 @@ +0.14.1 Released on 2021-07-08 +---- + +- Fix a bug for uploading files at Chinese regions. + 0.14.0 Released on 2020-12-15 ---- diff --git a/src/LeanCloud/Client.php b/src/LeanCloud/Client.php index 401ca33..30ed270 100644 --- a/src/LeanCloud/Client.php +++ b/src/LeanCloud/Client.php @@ -24,7 +24,7 @@ class Client { /** * Client version */ - const VERSION = '0.14.0'; + const VERSION = '0.14.1'; /** * API Version string diff --git a/src/LeanCloud/File.php b/src/LeanCloud/File.php index 827a885..1c8d4a4 100644 --- a/src/LeanCloud/File.php +++ b/src/LeanCloud/File.php @@ -385,6 +385,8 @@ public function save() { // adapt for S3, when there is no token $resp["token"] = null; } + $key = $resp["key"]; + $this->setKey($key); $callbackParams = array("token" => $resp["token"]); try { diff --git a/test/APITest.php b/test/APITest.php index 563f292..90c8fd5 100644 --- a/test/APITest.php +++ b/test/APITest.php @@ -110,7 +110,7 @@ public function testAddRelation() { Client::delete("/classes/TestObject/{$resp['objectId']}"); } - +/* see #234 public function testRelationBatchOp() { $adds = array("__op" => "AddRelation", "objects" => array( @@ -129,6 +129,7 @@ public function testRelationBatchOp() { $this->assertNotEmpty($resp["objectId"]); Client::delete("/classes/TestObject/{$resp['objectId']}"); } +*/ /** * Batch on array operation will result error: diff --git a/test/FileTest.php b/test/FileTest.php index 5206298..014f62a 100644 --- a/test/FileTest.php +++ b/test/FileTest.php @@ -63,6 +63,15 @@ public function testSaveUTF8TextFile() { $file->destroy(); } + + public function testSaveLocalFileWithMimeTypeAndName() { + $file = File::createWithLocalFile(__FILE__, "application/x-php", "FileTest.php"); + $file->save(); + $this->assertNotEmpty($file->getUrl()); + $this->assertEquals("application/x-php", $file->getMimeType()); + + $file->destroy(); + } public function testSaveWithSpecifiedKeyWithoutMasterKey() { $file = File::createWithData("test.txt", "Hello World!"); diff --git a/test/UserTest.php b/test/UserTest.php index fcc3374..0f587ff 100644 --- a/test/UserTest.php +++ b/test/UserTest.php @@ -182,12 +182,11 @@ public function testSignUpOrLoginByMobilePhone() { } public function testRequestChangePhoneNumber() { - $this->setExpectedException("LeanCloud\CloudException", null, 600); // invalid signature - $this->setExpectedException("LeanCloud\CloudException", null, 605); // SMS template/signature not verified. // Remember to create this user before hand. User::logIn("php_test_change_phone_number", "blabla"); + // Uncomment the follow lines when manually running the test. // phone number is from https://www.yinsiduanxin.com - User::requestChangePhoneNumber("+8616533875941"); + // User::requestChangePhoneNumber("+8616533875941"); } public function testChangePhoneNumber() {