OSDN Git Service

t: add test for Model::Users::Param
authorhylom <hylom@users.sourceforge.jp>
Wed, 7 Nov 2018 12:16:55 +0000 (21:16 +0900)
committerhylom <hylom@users.sourceforge.jp>
Wed, 7 Nov 2018 12:16:55 +0000 (21:16 +0900)
src/newslash_web/t/models/users.t

index b4c2613..5ed7f71 100644 (file)
@@ -203,6 +203,24 @@ subtest 'param' => sub {
     $params = $param->select(uid => $uid);
     is($params->{test_param}, "updated_param", "update param correctly");
 
+    # set test (update)
+    $rs = $param->set(uid => $uid,
+                      name => "test_param",
+                      value => "updated_param2");
+    ok($rs, "set param1");
+    diag $param->last_error if !$rs;
+    $params = $param->select(uid => $uid);
+    is($params->{test_param}, "updated_param2", "set param (update) correctly");
+
+    # set test (insert)
+    $rs = $param->set(uid => $uid,
+                      name => "test_param2",
+                      value => "test_param2");
+    ok($rs, "set param2");
+    diag $param->last_error if !$rs;
+    $params = $param->select(uid => $uid);
+    is($params->{test_param2}, "test_param2", "set param (insert) correctly");
+
     # delete test
     $rs = $param->delete(uid => $uid,
                          name => "test_param");