laowu 19 horas atrás
pai
commit
8874c1bbab
1 arquivos alterados com 10 adições e 4 exclusões
  1. 10 4
      tests/Unit/SignInRewardLogicTest.php

+ 10 - 4
tests/Unit/SignInRewardLogicTest.php

@@ -245,6 +245,8 @@ class SignInRewardLogicTest extends TestCase
     /**
      * 测试更新不存在的记录
      *
+     * update() 内部 catch 了异常,应返回 false 而非向外抛出
+     *
      * @return void
      */
     public function test_update_nonexistent_record()
@@ -253,8 +255,9 @@ class SignInRewardLogicTest extends TestCase
             'RewardScore' => 300,
         ];
 
-        $this->expectException(\Illuminate\Database\Eloquent\ModelNotFoundException::class);
-        $this->logic->update(999, $updateData);
+        $result = $this->logic->update(999, $updateData);
+
+        $this->assertFalse($result);
     }
 
     /**
@@ -283,12 +286,15 @@ class SignInRewardLogicTest extends TestCase
     /**
      * 测试删除不存在的记录
      *
+     * delete() 内部 catch 了异常,应返回 false 而非向外抛出
+     *
      * @return void
      */
     public function test_delete_nonexistent_record()
     {
-        $this->expectException(\Illuminate\Database\Eloquent\ModelNotFoundException::class);
-        $this->logic->delete(999);
+        $result = $this->logic->delete(999);
+
+        $this->assertFalse($result);
     }
 
     /**