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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 45 - (hide annotations)
Tue May 30 14:34:58 2006 UTC (18 years ago) by dpavlin
File MIME type: application/x-troff
File size: 1380 byte(s)
added class and description to transports
1 dpavlin 45 #!/usr/bin/perl
2     use warnings;
3     use strict;
4    
5     =head1 DESCRIPTION
6    
7     A basic test harness for the TransportClass model.
8    
9     =cut
10    
11     use Jifty::Test tests => 11;
12    
13     my $nr = 2;
14    
15     # Make sure we can load the model
16     use_ok('Transports::Model::TransportClass');
17    
18     # Grab a system use
19     my $system_user = Transports::CurrentUser->superuser;
20     ok($system_user, "Found a system user");
21    
22     # Try testing a create
23     my $o = Transports::Model::TransportClass->new(current_user => $system_user);
24     my ($id) = $o->create(
25     name => 'foo'
26     );
27     ok($id, "TransportClass create returned success");
28     ok($o->id, "New TransportClass has valid id set");
29     is($o->id, $id, "Create returned the right id");
30    
31     # And another
32     $o->create(
33     name => 'bar'
34     );
35     ok($o->id, "TransportClass create returned another value");
36     isnt($o->id, $id, "And it is different from the previous one");
37    
38     # Searches in general
39     my $collection = Transports::Model::TransportClassCollection->new(current_user => $system_user);
40     $collection->unlimit;
41     is($collection->count, $nr + 2, "Finds two records");
42    
43     # Searches in specific
44     $collection->limit(column => 'id', value => $o->id);
45     is($collection->count, 1, "Finds one record with specific id");
46    
47     # Delete one of them
48     $o->delete;
49     $collection->redo_search;
50     is($collection->count, 0, "Deleted row is gone");
51    
52     # And the other one is still there
53     $collection->unlimit;
54     is($collection->count, $nr + 1, "Still one left");
55    

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26