10 |
|
|
11 |
use Jifty::Test tests => 13; |
use Jifty::Test tests => 13; |
12 |
|
|
13 |
|
my $nr = 7; |
14 |
|
|
15 |
# Make sure we can load the model |
# Make sure we can load the model |
16 |
use_ok('Transports::Model::Transport'); |
use_ok('Transports::Model::Transport'); |
17 |
|
|
32 |
destination => $d_id, |
destination => $d_id, |
33 |
request_nr => 12345, |
request_nr => 12345, |
34 |
client_dependent => 0, |
client_dependent => 0, |
35 |
|
created_by => 1, |
36 |
); |
); |
37 |
ok($id, "Transport create returned success"); |
ok($id, "Transport create returned success"); |
38 |
ok($o->id, "New Transport has valid id set"); |
ok($o->id, "New Transport has valid id set"); |
44 |
destination => $d_id, |
destination => $d_id, |
45 |
request_nr => 54321, |
request_nr => 54321, |
46 |
client_dependent => 1, |
client_dependent => 1, |
47 |
|
created_by => 1, |
48 |
); |
); |
49 |
ok($o->id, "Transport create returned another value"); |
ok($o->id, "Transport create returned another value"); |
50 |
isnt($o->id, $id, "And it is different from the previous one"); |
isnt($o->id, $id, "And it is different from the previous one"); |
52 |
# Searches in general |
# Searches in general |
53 |
my $collection = Transports::Model::TransportCollection->new(current_user => $system_user); |
my $collection = Transports::Model::TransportCollection->new(current_user => $system_user); |
54 |
$collection->unlimit; |
$collection->unlimit; |
55 |
is($collection->count, 2, "Finds two records"); |
is($collection->count, $nr + 2, "Finds two records"); |
56 |
|
|
57 |
# Searches in specific |
# Searches in specific |
58 |
$collection->limit(column => 'id', value => $o->id); |
$collection->limit(column => 'id', value => $o->id); |
65 |
|
|
66 |
# And the other one is still there |
# And the other one is still there |
67 |
$collection->unlimit; |
$collection->unlimit; |
68 |
is($collection->count, 1, "Still one left"); |
is($collection->count, $nr + 1, "Still one left"); |
69 |
|
|