[Rt-commit] rt branch, 4.0/autoload-fixes, created. rt-4.0.0-283-gb37a527

Shawn Moore sartak at bestpractical.com
Mon May 16 17:32:58 EDT 2011


The branch, 4.0/autoload-fixes has been created
        at  b37a527e7e4d780f18c0a7a227c2719154b4b635 (commit)

- Log -----------------------------------------------------------------
commit b37a527e7e4d780f18c0a7a227c2719154b4b635
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon May 16 17:31:15 2011 -0400

    Tests for #17421, articles in links that don't show names

diff --git a/t/web/articles-links.t b/t/web/articles-links.t
new file mode 100644
index 0000000..c255db0
--- /dev/null
+++ b/t/web/articles-links.t
@@ -0,0 +1,52 @@
+use strict;
+use warnings;
+
+use RT::Test tests => 17;
+
+$RT::MasonLocalComponentRoot = RT::Test::get_abs_relocatable_dir('html');
+
+my ($baseurl, $m) = RT::Test->started_ok;
+
+my $queue = RT::Queue->new(RT->SystemUser);
+$queue->Load('General');
+
+my $class = RT::Class->new(RT->SystemUser);
+my ($ok, $msg) = $class->Create(Name => "issues");
+ok($ok, "created class: $msg");
+
+($ok, $msg) = $class->AddToObject($queue);
+ok($ok, "applied class to General: $msg");
+
+my $article = RT::Article->new(RT->SystemUser);
+($ok, $msg) = $article->Create(Name => "instance of ticket #17421", Class => $class->id);
+ok($ok, "created article: $msg");
+
+ok($m->login, "logged in");
+
+my $ticket = RT::Test->create_ticket(Queue => $queue->Id, Subject => 'oh wow! an AUTOLOAD bug');
+
+$m->goto_ticket($ticket->id);
+$m->follow_link_ok({text => 'Reply'});
+
+$m->form_name('TicketUpdate');
+$m->field('Articles-Include-Article-Named' => $article->Name);
+$m->submit;
+
+$m->content_contains('instance of ticket #17421', 'got the name of the article in the ticket');
+
+# delete RT::Article's Name method on the server so we'll need to AUTOLOAD it
+my $clone = $m->clone;
+$clone->get_ok('/delete-article-name-method.html');
+like($clone->content, qr/{deleted}/);
+
+$m->form_name('TicketUpdate');
+$m->click('SubmitTicket');
+
+$m->follow_link_ok({text => 'Links'});
+
+$m->text_contains('Article ' . $article->id . ': instance of ticket #17421', 'Article appears with its name in the links table');
+
+my $refers_to = $ticket->RefersTo;
+is($refers_to->Count, 1, 'the ticket has a refers-to link');
+is($refers_to->First->TargetURI->URI, 'fsck.com-article://example.com/article/' . $article->Id, 'when we included the article it created a refers-to');
+
diff --git a/t/web/html/delete-article-name-method.html b/t/web/html/delete-article-name-method.html
new file mode 100644
index 0000000..520f1cc
--- /dev/null
+++ b/t/web/html/delete-article-name-method.html
@@ -0,0 +1,15 @@
+<%INIT>
+# This is used by t/web/articles-links.t. Since we fork off a server
+# under most test configurations, and we need a way to run code in th  e
+# middle of the test script, we have to play at shenanigans to delet e
+# RT::Article's Name method. Other options were a Plack::Middleware that
+# eval'd code given by paths like /__perl/(.+) (is scary), a signal
+# handler under apache), and only running articles-links.t for (fails
+# inline tests (fails under apache and standalone)
+
+delete $RT::Article::{Name};
+
+</%INIT>
+
+<% RT::Article->can('Name') ? '{exists}' : '{deleted}' %>
+

-----------------------------------------------------------------------


More information about the Rt-commit mailing list