File: 06-version-custom-column.t

package info (click to toggle)
libdbix-class-optimisticlocking-perl 0.02-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 220 kB
  • sloc: perl: 270; sql: 51; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 631 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use strict;
use warnings;
use Test::More;


BEGIN {
    eval "use DBD::SQLite";
    plan $@
      ? ( skip_all => 'needs DBD::SQLite for testing' )
      : ( tests => 5 );
    $DBD::SQLite::sqlite_version; # get rid of warnings
}

use lib 't/lib';

use_ok('DBIx::Class::OptimisticLocking');

use_ok( 'OLTest' );

use_ok( 'OLTest::Schema' );

my $s = OLTest->init_schema();

my $r1 = $s->resultset('TestVersionAlt')->new({
	col1 => 'a',
	col2 => 'a',
});
$r1->insert;
$r1->discard_changes;
is($r1->myversion, 0, 'myversion at 0');

$r1->col1('b');
$r1->update;
$r1->discard_changes;

is($r1->myversion, 1, 'myversion incremented');