5 use RT::Test tests => undef;
8 use_ok "RT::URI::fsck_com_article";
9 my $uri = RT::URI::fsck_com_article->new( $RT::SystemUser );
12 isa_ok $uri, 'RT::URI::fsck_com_article';
13 isa_ok $uri, 'RT::URI::base';
14 isa_ok $uri, 'RT::Base';
16 is $uri->LocalURIPrefix, 'fsck.com-article://example.com';
18 my $class = RT::Class->new( $RT::SystemUser );
19 $class->Create( Name => 'URItest - '. $$ );
20 ok $class->id, 'created a class';
21 my $article = RT::Article->new( $RT::SystemUser );
22 my ($id, $msg) = $article->Create(
23 Name => 'Testing URI parsing - '. $$,
24 Summary => 'In which this should load',
29 $uri = RT::URI::fsck_com_article->new( $article->CurrentUser );
30 is $uri->URIForObject( $article ),
31 'fsck.com-article://example.com/article/' . $article->id,
32 'Got correct URIForObject';
33 my $article_id = $article->Id;
34 ok ($uri->ParseURI("fsck.com-article://example.com/article/$article_id"),
37 ok ($article->Delete(), 'Deleted article');
41 $ret = $uri->ParseURI("fsck.com-article://example.com/article/$article_id");
42 } qr/Unable to load article for id $article_id. It may have been deleted/,
43 "Warned about missing article";
45 ok (!$ret, 'Returned false on missing article');
47 ok (!$uri->ParseURI("fsck.com-article://foo.com/article/$article_id"),
48 'ParseURI returned false with incorrect Organization');