/[Arh]/t/00-model-UnitMaterial.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 /t/00-model-UnitMaterial.t

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

revision 14 by dpavlin, Fri Nov 30 16:43:53 2007 UTC revision 28 by dpavlin, Mon Dec 10 14:56:12 2007 UTC
# Line 8  A basic test harness for the UnitMateria Line 8  A basic test harness for the UnitMateria
8    
9  =cut  =cut
10    
11  use Jifty::Test tests => 11;  use Jifty::Test tests => 16;
12    
13  # Make sure we can load the model  # Make sure we can load the model
14  use_ok('Arh::Model::UnitMaterial');  use_ok('Arh::Model::UnitMaterial');
15    use_ok('Arh::Test');
16    
17  # Grab a system user  # Grab a system user
18  my $system_user = Arh::CurrentUser->superuser;  my $system_user = Arh::CurrentUser->superuser;
19  ok($system_user, "Found a system user");  ok($system_user, "Found a system user");
20    
21    ok( my $unit = Arh::Test->Unit, 'Unit' );
22    
23    ok( my $material = Arh::Model::Material->new, 'Material' );
24    ok( $material->create(
25            name => 'test material',
26    ), 'create' );
27    
28  # Try testing a create  # Try testing a create
29  my $o = Arh::Model::UnitMaterial->new(current_user => $system_user);  my $o = Arh::Model::UnitMaterial->new(current_user => $system_user);
30  my ($id) = $o->create();  my ($id) = $o->create(
31            unit => $unit,
32            material => $material,
33    );
34  ok($id, "UnitMaterial create returned success");  ok($id, "UnitMaterial create returned success");
35  ok($o->id, "New UnitMaterial has valid id set");  ok($o->id, "New UnitMaterial has valid id set");
36  is($o->id, $id, "Create returned the right id");  is($o->id, $id, "Create returned the right id");
37    
38    ok( $material->create( name => 'another' ), 'another material' );
39    
40  # And another  # And another
41  $o->create();  $o->create(
42            unit => $unit,
43            material => $material,
44    );
45  ok($o->id, "UnitMaterial create returned another value");  ok($o->id, "UnitMaterial create returned another value");
46  isnt($o->id, $id, "And it is different from the previous one");  isnt($o->id, $id, "And it is different from the previous one");
47    

Legend:
Removed from v.14  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26