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

Diff of /trunk/t/00-model-UserOnLandscape.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 52 by dpavlin, Mon Jun 5 14:06:58 2006 UTC revision 53 by dpavlin, Mon Jun 5 14:14:19 2006 UTC
# Line 10  A basic test harness for the UserOnLands Line 10  A basic test harness for the UserOnLands
10    
11  use Jifty::Test tests => 11;  use Jifty::Test tests => 11;
12    
13    my $nr = 3;
14    
15  # Make sure we can load the model  # Make sure we can load the model
16  use_ok('Transports::Model::UserOnLandscape');  use_ok('Transports::Model::UserOnLandscape');
17    
# Line 19  ok($system_user, "Found a system user"); Line 21  ok($system_user, "Found a system user");
21    
22  # Try testing a create  # Try testing a create
23  my $o = Transports::Model::UserOnLandscape->new(current_user => $system_user);  my $o = Transports::Model::UserOnLandscape->new(current_user => $system_user);
24  my ($id) = $o->create();  my ($id) = $o->create(
25            user_on => 1,
26            landscape => 1,
27    );
28  ok($id, "UserOnLandscape create returned success");  ok($id, "UserOnLandscape create returned success");
29  ok($o->id, "New UserOnLandscape has valid id set");  ok($o->id, "New UserOnLandscape has valid id set");
30  is($o->id, $id, "Create returned the right id");  is($o->id, $id, "Create returned the right id");
31    
32  # And another  # And another
33  $o->create();  $o->create(
34            user_on => 2,
35            landscape => 2,
36    );
37  ok($o->id, "UserOnLandscape create returned another value");  ok($o->id, "UserOnLandscape create returned another value");
38  isnt($o->id, $id, "And it is different from the previous one");  isnt($o->id, $id, "And it is different from the previous one");
39    
40  # Searches in general  # Searches in general
41  my $collection =  Transports::Model::UserOnLandscapeCollection->new(current_user => $system_user);  my $collection =  Transports::Model::UserOnLandscapeCollection->new(current_user => $system_user);
42  $collection->unlimit;  $collection->unlimit;
43  is($collection->count, 2, "Finds two records");  is($collection->count, $nr + 2, "Finds two records");
44    
45  # Searches in specific  # Searches in specific
46  $collection->limit(column => 'id', value => $o->id);  $collection->limit(column => 'id', value => $o->id);
# Line 45  is($collection->count, 0, "Deleted row i Line 53  is($collection->count, 0, "Deleted row i
53    
54  # And the other one is still there  # And the other one is still there
55  $collection->unlimit;  $collection->unlimit;
56  is($collection->count, 1, "Still one left");  is($collection->count, $nr + 1, "Still one left");
57    

Legend:
Removed from v.52  
changed lines
  Added in v.53

  ViewVC Help
Powered by ViewVC 1.1.26