[Rt-commit] rt 02/05: Add tests for per-class article uniqueness

Steven Burr steve at bestpractical.com
Fri Jul 9 11:54:21 EDT 2021


This is an automated email from the git hooks/post-receive script.

jbrandt pushed a commit to branch 5.0/articles-unique-only-within-own-class2
in repository rt.

commit 13d16080c9c53d57a5b69c1f47842b349ba5502a
Author: Steven Burr <steve at bestpractical.com>
AuthorDate: Thu May 20 11:47:59 2021 -0400

    Add tests for per-class article uniqueness
---
 t/articles/article.t | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/t/articles/article.t b/t/articles/article.t
index 4af62be303..716650c0d9 100644
--- a/t/articles/article.t
+++ b/t/articles/article.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 67;
+use RT::Test tests => undef;
 
 use_ok 'RT::Articles';
 use_ok 'RT::Classes';
@@ -82,6 +82,30 @@ ok ($val, "Article Deleted: $msg");
 $a2->Load($id);
 ok ($a2->Disabled, "the article is disabled");
 
+
+
+my $class1 = RT::Class->new($RT::SystemUser);
+($id, $msg) = $class1->Create(Name => "ScopedClassTest1-$$");
+ok ($id, $msg);
+
+my $class2 = RT::Class->new($RT::SystemUser);
+($id, $msg) = $class2->Create(Name => "ScopedClassTest2-$$");
+ok ($id, $msg);
+
+my $a4 = RT::Article->new($RT::SystemUser);
+($id, $msg) = $a4->Create(Class => $class1->id, Name => "ScopedClassTest$$" );
+ok ($id, $msg);
+
+my $a5 = RT::Article->new($RT::SystemUser);
+($id, $msg) = $a5->Create(Class => $class1->id, Name => "ScopedClassTest$$" );
+ok (!$id, $msg);
+
+my $a6 = RT::Article->new($RT::SystemUser);
+($id, $msg) = $a6->Create(Class => $class2->id, Name => "ScopedClassTest$$" );
+ok ($id, $msg);
+
+
+
 # NOT OK
 #$RT::Handle->SimpleQuery("DELETE FROM Links");
 
@@ -227,3 +251,4 @@ ok ($trans->Field eq 'Summary', "it is about setting the Summary");
 is  ($trans->NewValue , 'testFoo', "The new content is 'foo'");
 is ($trans->OldValue,$s, "the old value was preserved");
 
+done_testing();

-- 
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.


More information about the rt-commit mailing list