From 6342c2981bc10b5d43a56a8f4808fff10a95d15b Mon Sep 17 00:00:00 2001 From: Wu Yun Date: Fri, 10 May 2024 18:17:30 +0800 Subject: [PATCH 1/7] fix: require phone number when verify sms code --- src/LeanCloud/User.php | 15 +++++++++------ test/UserTest.php | 3 +-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/LeanCloud/User.php b/src/LeanCloud/User.php index 3e32eaa..039b988 100644 --- a/src/LeanCloud/User.php +++ b/src/LeanCloud/User.php @@ -441,9 +441,11 @@ public static function requestPasswordResetBySmsCode($phoneNumber) { * @param string $smsCode * @param string $newPassword */ - public static function resetPasswordBySmsCode($smsCode, $newPassword) { - Client::put("/resetPasswordBySmsCode/{$smsCode}", - array("password" => $newPassword)); + public static function resetPasswordBySmsCode($smsCode, $newPassword, $mobilePhoneNumber) { + Client::put("/resetPasswordBySmsCode/{$smsCode}", array( + "password" => $newPassword, + "mobilePhoneNumber" => $mobilePhoneNumber + )); } /** @@ -463,8 +465,10 @@ public static function requestMobilePhoneVerify($phoneNumber) { * * @param string $smsCode */ - public static function verifyMobilePhone($smsCode) { - Client::post("/verifyMobilePhone/{$smsCode}", null); + public static function verifyMobilePhone($smsCode, $mobilePhoneNumber) { + Client::post("/verifyMobilePhone/{$smsCode}", array( + "mobilePhoneNumber" => $mobilePhoneNumber + )); } /** @@ -591,4 +595,3 @@ public function unlinkWith($provider) { } } - diff --git a/test/UserTest.php b/test/UserTest.php index 0f587ff..2741d6a 100644 --- a/test/UserTest.php +++ b/test/UserTest.php @@ -172,7 +172,7 @@ public function testUpdatePassword() { public function testVerifyMobilePhone() { // Ensure the post format is correct $this->setExpectedException("LeanCloud\CloudException", null, 603); - User::verifyMobilePhone("000000"); + User::verifyMobilePhone("000000", "18612340000"); } public function testSignUpOrLoginByMobilePhone() { @@ -308,4 +308,3 @@ public function testFindUserWithSession() { } } - From 55260c2ab7bbb7f6366f348d21f2324ba47cb9ce Mon Sep 17 00:00:00 2001 From: Wu Yun Date: Sat, 11 May 2024 14:10:16 +0800 Subject: [PATCH 2/7] fix: build os version --- .github/workflows/php.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index c67887a..cc27bf0 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -16,7 +16,7 @@ jobs: build: # Only ubuntu 16.04 has 5.6 and 7.0 preinstalled - runs-on: ubuntu-16.04 + runs-on: ubuntu-latest strategy: max-parallel: 1 matrix: @@ -25,13 +25,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - + - name: Setup PHP Action uses: shivammathur/setup-php@2.9.0 with: php-version: ${{ matrix.php-versions }} coverage: xdebug - + - name: Validate composer.json and composer.lock run: composer validate --no-check-lock - name: Get composer cache directory From 159baf8bbca428476f8f51b894958c46b7354903 Mon Sep 17 00:00:00 2001 From: Wu Yun Date: Sat, 11 May 2024 14:14:07 +0800 Subject: [PATCH 3/7] chore: remove obsolete php version --- .github/workflows/php.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index cc27bf0..ec91501 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -15,12 +15,11 @@ on: jobs: build: - # Only ubuntu 16.04 has 5.6 and 7.0 preinstalled runs-on: ubuntu-latest strategy: max-parallel: 1 matrix: - php-versions: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4] + php-versions: [7.2, 7.4, 8.0] name: PHP ${{ matrix.php-versions }} Test steps: - name: Checkout From bf733dd9539f80418d96e065283944409554c6ab Mon Sep 17 00:00:00 2001 From: Wu Yun Date: Sat, 11 May 2024 14:20:28 +0800 Subject: [PATCH 4/7] fix: api url --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index ec91501..04be76b 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -47,7 +47,7 @@ jobs: - name: Run test suite with phpunit env: - LEANCLOUD_API_SERVER: https://us.avoscloud.com + LEANCLOUD_API_SERVER: https://wndg0lpt.api.lncldglobal.com LEANCLOUD_APP_ID: wnDg0lPt0wcYGJSiHRwHBhD4 LEANCLOUD_APP_KEY: u9ekx9HFSFFBErWwyWHFmPDy LEANCLOUD_APP_MASTER_KEY: ${{ secrets.MASTER_KEY }} From 8946d6c87a8d636eebc0a54abbb43260f3529207 Mon Sep 17 00:00:00 2001 From: Wu Yun Date: Sat, 11 May 2024 14:56:40 +0800 Subject: [PATCH 5/7] test: fix assert --- test/AppRouterTest.php | 3 ++- test/MasterTest.php | 14 ++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/test/AppRouterTest.php b/test/AppRouterTest.php index cf96ac8..0f73018 100644 --- a/test/AppRouterTest.php +++ b/test/AppRouterTest.php @@ -24,6 +24,7 @@ public function testSetRegion() { } public function testGetRoute() { + $this->markTestSkipped("app-router no longer available"); $appid = getenv("LEANCLOUD_APP_ID"); $router = AppRouter::getInstance($appid); $host = $router->getRoute(AppRouter::API_SERVER_KEY); @@ -49,4 +50,4 @@ public function testGetRouteWhenAppRouterNotAvailable() { $host); } -} \ No newline at end of file +} diff --git a/test/MasterTest.php b/test/MasterTest.php index f86624a..6445613 100644 --- a/test/MasterTest.php +++ b/test/MasterTest.php @@ -26,17 +26,7 @@ public function testSaveWithSpecifiedKey() { $url = $file->getUrl(); $parsedUrl = parse_url($url); $path = $parsedUrl["path"]; - $oldSchoolAwsS3FileUrlPrefix = "/avos-cloud-"; - $newAwsS3GluttonyUrlPrefix = "https://lc-gluttony"; - if (substr($path, 0, strlen($oldSchoolAwsS3FileUrlPrefix)) === $oldSchoolAwsS3FileUrlPrefix) { - $splitPath = explode("/", $path, 3); - $this->assertEquals("abc", $splitPath[2]); - } else if (substr($url, 0, strlen($newAwsS3GluttonyUrlPrefix)) === $newAwsS3GluttonyUrlPrefix) { - $gluttonyPath = "/" + substr(getenv("LEANCLOUD_APP_KEY"), 0, 12) + "/abc"; - $this->assertEquals($gluttonyPath, $path); - } else { - $this->assertEquals("/abc", $path); - } + $this->assertStringEndsWith("abc", $path); $this->assertEquals("text/plain", $file->getMimeType()); $content = file_get_contents($url); @@ -44,4 +34,4 @@ public function testSaveWithSpecifiedKey() { $file->destroy(); } -} \ No newline at end of file +} From 2e25e8d2f7f3b0cc89107c095f09c9c2e380b3cb Mon Sep 17 00:00:00 2001 From: Wu Yun Date: Sat, 11 May 2024 15:04:58 +0800 Subject: [PATCH 6/7] test: fix file key assert --- test/MasterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/MasterTest.php b/test/MasterTest.php index 6445613..6aaa07e 100644 --- a/test/MasterTest.php +++ b/test/MasterTest.php @@ -22,7 +22,7 @@ public function testSaveWithSpecifiedKey() { $this->assertNotEmpty($file->getObjectId()); $this->assertNotEmpty($file->getName()); - $this->assertEquals("abc", $file->getKey()); + $this->assertStringEndsWith("abc", $file->getKey()); $url = $file->getUrl(); $parsedUrl = parse_url($url); $path = $parsedUrl["path"]; From 1e87c03c28e385c2da02c17addf4faffaf9a03ee Mon Sep 17 00:00:00 2001 From: Wu Yun Date: Sat, 11 May 2024 15:45:42 +0800 Subject: [PATCH 7/7] chore: only run test on php 7 --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 04be76b..dd55ced 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -19,7 +19,7 @@ jobs: strategy: max-parallel: 1 matrix: - php-versions: [7.2, 7.4, 8.0] + php-versions: [7.2, 7.4] name: PHP ${{ matrix.php-versions }} Test steps: - name: Checkout