~ubuntu-branches/ubuntu/wily/liborlite-perl/wily

« back to all changes in this revision

Viewing changes to t/24_rowid.t

  • Committer: Package Import Robot
  • Author(s): Angel Abad
  • Date: 2012-02-27 22:45:43 UTC
  • mfrom: (1.2.21)
  • Revision ID: package-import@ubuntu.com-20120227224543-ih32kq2x6r5n3dxi
Tags: 1.96-1
ImportedĀ UpstreamĀ versionĀ 1.96

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
        $^W = 1;
10
10
}
11
11
 
12
 
use Test::More tests => 43;
 
12
use Test::More tests => 51;
13
13
use File::Spec::Functions ':ALL';
14
14
use t::lib::Test;
15
15
 
27
27
use strict;
28
28
use ORLite {
29
29
        file     => '$file',
 
30
        array    => 1,
30
31
        x_update => 1,
31
32
};
32
33
 
174
175
        is( $object->lastname, 'Kennedy', '->lastname ok' );
175
176
        is( $object->age, 123, '->age ok' );
176
177
}
 
178
 
 
179
 
 
180
 
 
181
 
 
182
 
 
183
#####################################################################
 
184
# Table with a single non-integer primary key
 
185
 
 
186
SCOPE: {
 
187
        my $object = Foo::Bar::Seven->create(
 
188
                name => 'Adam',
 
189
                age  => '123',
 
190
        );
 
191
        isa_ok( $object, 'Foo::Bar::Seven' );
 
192
        is( $object->rowid, 1, '->rowid ok' );
 
193
        is( $object->name, 'Adam', '->firstname ok' );
 
194
        is( $object->age, 123, '->age ok' );
 
195
        
 
196
        # Update the object
 
197
        $object->update( age => 125 );
 
198
        
 
199
        # Load it back from the database
 
200
        my $loaded = Foo::Bar::Seven->load('Adam');
 
201
        isa_ok( $loaded, 'Foo::Bar::Seven' );
 
202
        is( $loaded->rowid, 1, '->rowid ok' );
 
203
        is( $loaded->name, 'Adam', '->firstname ok' );
 
204
        is( $loaded->age, 125, '->age ok' );
 
205
        
 
206
        # Delete the object
 
207
        $object->delete;
 
208
}