View | Details | Raw Unified | Return to bug 15159
Collapse All | Expand All

(-)a/t/db_dependent/TestBuilder.t (-2 / +24 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 41;
22
use Test::More tests => 42;
23
23
24
use Koha::Database;
24
use Koha::Database;
25
25
Lines 257-262 delete $bookseller->{_fk}; Link Here
257
$bookseller_from_db = $rs_aqbookseller->find($bookseller);
257
$bookseller_from_db = $rs_aqbookseller->find($bookseller);
258
is( $bookseller_from_db->in_storage, 1, 'build with only_fk = 0 stores the entry correctly' );
258
is( $bookseller_from_db->in_storage, 1, 'build with only_fk = 0 stores the entry correctly' );
259
259
260
subtest 'Auto-increment values tests' => sub {
261
262
    plan tests => 2;
263
264
    # Pick a table with AI PK
265
    my $source  = 'Biblio'; # table
266
    my $column  = 'biblionumber'; # ai column
267
268
    my $col_info = $schema->source( $source )->column_info( $column );
269
    is( $col_info->{is_auto_increment}, 1, "biblio.biblionumber is detected as autoincrement");
270
271
    # Create a biblio
272
    my $biblio_1 = $builder->build({ source => $source });
273
    # Get the AI value
274
    my $ai_value = $biblio_1->{ biblionumber };
275
    # Create a biblio
276
    my $biblio_2 = $builder->build({ source => $source });
277
    # Get the next AI value
278
    my $next_ai_value = $biblio_2->{ biblionumber };
279
    is( $ai_value + 1, $next_ai_value, "AI values are consecutive");
280
281
};
282
260
$schema->storage->txn_rollback;
283
$schema->storage->txn_rollback;
261
284
262
1;
285
1;
263
- 

Return to bug 15159