diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index c67887a..dd55ced 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -15,23 +15,22 @@ on: 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: - php-versions: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4] + php-versions: [7.2, 7.4] name: PHP ${{ matrix.php-versions }} Test 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 @@ -48,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 }} 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/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..6aaa07e 100644 --- a/test/MasterTest.php +++ b/test/MasterTest.php @@ -22,21 +22,11 @@ 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"]; - $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 +} 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() { } } -