/[SVNBrowser]/trunk/t/00-model-Revision.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/t/00-model-Revision.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 58 - (hide annotations)
Mon Sep 3 19:09:32 2007 UTC (16 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1655 byte(s)
fix another test
1 dpavlin 1 #!/usr/bin/env perl
2     use warnings;
3     use strict;
4    
5     =head1 DESCRIPTION
6    
7     A basic test harness for the Revision model.
8    
9     =cut
10    
11     use Jifty::Test tests => 11;
12    
13     # Make sure we can load the model
14     use_ok('SVNBrowser::Model::Revision');
15    
16     # Grab a system user
17     my $system_user = SVNBrowser::CurrentUser->superuser;
18     ok($system_user, "Found a system user");
19    
20 dpavlin 58 my $repository = SVNBrowser::Model::Repository->new( current_user => $system_user );
21     $repository->load_or_create( uri => 'file://foobar' );
22    
23 dpavlin 1 # Try testing a create
24     my $o = SVNBrowser::Model::Revision->new(current_user => $system_user);
25 dpavlin 58 my ($id) = $o->create(
26     repository => $repository,
27     revision => 1,
28     author => 'text@example.com',
29     commit_date => Jifty::DateTime->now,
30     );
31 dpavlin 1 ok($id, "Revision create returned success");
32     ok($o->id, "New Revision has valid id set");
33     is($o->id, $id, "Create returned the right id");
34    
35     # And another
36 dpavlin 58 $o->create(
37     repository => $repository,
38     revision => 2,
39     author => 'text@example.com',
40     commit_date => Jifty::DateTime->now,
41     );
42 dpavlin 1 ok($o->id, "Revision create returned another value");
43     isnt($o->id, $id, "And it is different from the previous one");
44    
45     # Searches in general
46     my $collection = SVNBrowser::Model::RevisionCollection->new(current_user => $system_user);
47     $collection->unlimit;
48     is($collection->count, 2, "Finds two records");
49    
50     # Searches in specific
51     $collection->limit(column => 'id', value => $o->id);
52     is($collection->count, 1, "Finds one record with specific id");
53    
54     # Delete one of them
55     $o->delete;
56     $collection->redo_search;
57     is($collection->count, 0, "Deleted row is gone");
58    
59     # And the other one is still there
60     $collection->unlimit;
61     is($collection->count, 1, "Still one left");
62    

  ViewVC Help
Powered by ViewVC 1.1.26