RT 4.0.13
[freeside.git] / rt / t / articles / uri-articles.t
1
2 use strict;
3 use warnings;
4
5 use RT::Test tests => 9;
6
7 use_ok "RT::URI::fsck_com_article";
8 my $uri = RT::URI::fsck_com_article->new( $RT::SystemUser );
9
10 ok $uri;
11 isa_ok $uri, 'RT::URI::fsck_com_article';
12 isa_ok $uri, 'RT::URI::base';
13 isa_ok $uri, 'RT::Base';
14
15 is $uri->LocalURIPrefix, 'fsck.com-article://example.com/article/';
16
17 my $class = RT::Class->new( $RT::SystemUser );
18 $class->Create( Name => 'URItest - '. $$ );
19 ok $class->id, 'created a class';
20 my $article = RT::Article->new( $RT::SystemUser );
21 my ($id, $msg) = $article->Create(
22     Name    => 'Testing URI parsing - '. $$,
23     Summary => 'In which this should load',
24     Class => $class->Id
25 );
26 ok($id,$msg);
27
28 $uri = RT::URI::fsck_com_article->new( $article->CurrentUser );
29 is $uri->LocalURIPrefix . $article->id, $uri->URIForObject( $article );
30