aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/model/comment.t
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2021-10-07 13:32:40 +0200
committerMarius Halden <marius.h@lden.org>2021-10-07 13:32:40 +0200
commit09dacfc6b8bf62addeee16c20b1d90c2a256da96 (patch)
tree7caa2bf9e92227ab74448f9b746dd28bbcb81b2a /t/app/model/comment.t
parent585e57484f9c6332668bf1ac0a6a3b39dbe32223 (diff)
parentcea89fb87a96943708a1db0f646492fbfaaf000f (diff)
Merge tag 'v3.1' into fiksgatami-devfiksgatami-dev
Diffstat (limited to 't/app/model/comment.t')
-rw-r--r--t/app/model/comment.t25
1 files changed, 16 insertions, 9 deletions
diff --git a/t/app/model/comment.t b/t/app/model/comment.t
index 3f30b3a1e..dd9af9eb9 100644
--- a/t/app/model/comment.t
+++ b/t/app/model/comment.t
@@ -1,20 +1,27 @@
use FixMyStreet::Test;
-my $comment_rs = FixMyStreet::DB->resultset('Comment');
+my $user = FixMyStreet::DB->resultset('User')->new({ name => 'Test User', is_superuser => 1 });
+my $comment_rs = FixMyStreet::DB->resultset('Comment');
my $comment = $comment_rs->new(
{
- user_id => 1,
+ user => $user,
problem_id => 1,
text => '',
- state => 'confirmed',
- anonymous => 0,
- mark_fixed => 0,
- cobrand => 'default',
- cobrand_data => '',
}
);
-is $comment->confirmed, undef, 'inflating null confirmed ok';
-is $comment->created, undef, 'inflating null confirmed ok';
+is $comment->created, undef, 'inflating null created ok';
+is $comment->mark_fixed, 0, 'mark fixed default set';
+is $comment->state, 'confirmed', 'state default is confirmed';
+is $comment->name, 'an administrator';
+
+$user->is_superuser(0);
+$comment = $comment_rs->new({
+ user => $user,
+ problem_id => 1,
+ text => '',
+});
+is $comment->name, 'Test User';
+
done_testing();