/[SVNBrowser]/trunk/t/00-model-Action.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-Action.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 59 - (hide annotations)
Mon Sep 3 19:11:26 2007 UTC (16 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1418 byte(s)
another test which pass
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 Action 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::Action');
15    
16     # Grab a system user
17     my $system_user = SVNBrowser::CurrentUser->superuser;
18     ok($system_user, "Found a system user");
19    
20     # Try testing a create
21     my $o = SVNBrowser::Model::Action->new(current_user => $system_user);
22 dpavlin 59 my ($id) = $o->create(
23     revision => 1,
24     type => 'A',
25     branch => '/trunk',
26     rel_path => '/foo',
27     );
28 dpavlin 1 ok($id, "Action create returned success");
29     ok($o->id, "New Action has valid id set");
30     is($o->id, $id, "Create returned the right id");
31    
32     # And another
33 dpavlin 59 $o->create(
34     revision => 2,
35     type => 'M',
36     branch => '/trunk',
37     rel_path => '/foo',
38     );
39 dpavlin 1 ok($o->id, "Action create returned another value");
40     isnt($o->id, $id, "And it is different from the previous one");
41    
42     # Searches in general
43     my $collection = SVNBrowser::Model::ActionCollection->new(current_user => $system_user);
44     $collection->unlimit;
45     is($collection->count, 2, "Finds two records");
46    
47     # Searches in specific
48     $collection->limit(column => 'id', value => $o->id);
49     is($collection->count, 1, "Finds one record with specific id");
50    
51     # Delete one of them
52     $o->delete;
53     $collection->redo_search;
54     is($collection->count, 0, "Deleted row is gone");
55    
56     # And the other one is still there
57     $collection->unlimit;
58     is($collection->count, 1, "Still one left");
59    

  ViewVC Help
Powered by ViewVC 1.1.26