Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / rt / t / articles / uri-articles.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use RT::Test tests => 9;
7
8 use_ok "RT::URI::fsck_com_article";
9 my $uri = RT::URI::fsck_com_article->new( $RT::SystemUser );
10
11 ok $uri;
12 isa_ok $uri, 'RT::URI::fsck_com_article';
13 isa_ok $uri, 'RT::URI::base';
14 isa_ok $uri, 'RT::Base';
15
16 is $uri->LocalURIPrefix, 'fsck.com-article://example.com/article/';
17
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',
25     Class => $class->Id
26 );
27 ok($id,$msg);
28
29 $uri = RT::URI::fsck_com_article->new( $article->CurrentUser );
30 is $uri->LocalURIPrefix . $article->id, $uri->URIForObject( $article );
31