]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1294569 - 100markdown.t doesn't work without a working DB
authorDylan William Hardison <dylan@hardison.net>
Sat, 10 Sep 2016 16:35:49 +0000 (12:35 -0400)
committerDylan William Hardison <dylan@hardison.net>
Sat, 10 Sep 2016 16:36:45 +0000 (12:36 -0400)
t/100markdown.t

index 5cc6ecd4e425d756085a9c8d4bea94d57bbc7aa6..70dece55f1a9f24f22735b7f77a008c2478a5342 100644 (file)
@@ -13,12 +13,42 @@ use warnings;
 
 use lib qw(. lib local/lib/perl5 t);
 use Test2::Bundle::Extended;
+use Bugzilla::Util;
+BEGIN {
+    my $terms = {
+        "bug"               => "bug",
+        "Bug"               => "Bug",
+        "abug"              => "a bug",
+        "Abug"              => "A bug",
+        "aBug"              => "a Bug",
+        "ABug"              => "A Bug",
+        "bugs"              => "bugs",
+        "Bugs"              => "Bugs",
+        "comment"           => "comment",
+        "comments"          => "comments",
+        "zeroSearchResults" => "Zarro Boogs found",
+        "Bugzilla"          => "Bugzilla"
+    };
+    no warnings 'redefine', 'once';
+    *Bugzilla::Util::template_var = sub {
+        my $name = shift;
+        if ($name eq 'terms') {
+            return $terms;
+        } else {
+            die "sorry!";
+        }
+    };
+}
 use Bugzilla;
+use Bugzilla::Constants;
 use Bugzilla::Bug;
 use Bugzilla::Comment;
 use Bugzilla::User;
 use Bugzilla::Markdown;
 
+Bugzilla->usage_mode(USAGE_MODE_TEST);
+Bugzilla->error_mode(ERROR_MODE_DIE);
+
 my $user_mock = mock 'Bugzilla::User' => (
     override_constructor => ['new', 'hash'],
 );