__PACKAGE__->meta->table(
'Bazzle'
);
has
'identifier'
=> (
is
=>
'rw'
,
traits
=> [
qw( PrimaryKey )
] );
has
'foo'
=> (
is
=>
'rw'
);
has
'bar'
=> (
is
=>
'rw'
);
has
'baz'
=> (
is
=>
'rw'
);
my
$storm
= Storm->new(
source
=> [
'DBI:SQLite:dbname=:memory:'
] );
$storm
->aeolus->install_class(
'Bazzle'
);
my
$query
= Storm::Query::Insert->new(
$storm
,
'Bazzle'
);
my
$o
= Bazzle->new(
identifier
=> 1,
foo
=>
'foo'
,
bar
=>
'bar'
,
baz
=>
'baz'
);
$query
->insert(
$o
);
my
$original
=
$o
;
$o
->foo(
'foobar'
);
$o
->bar(
'foobar'
);
$o
->baz(
'foobar'
);
$query
= Storm::Query::Update->new(
$storm
,
'Bazzle'
);
$query
->update(
$o
);
ok
$o
,
'update query returned true'
;
$query
= Storm::Query::Refresh->new(
$storm
,
'Bazzle'
);
$query
->refresh(
$original
);
is_deeply [
$o
->foo,
$o
->bar,
$o
->baz], [
qw/foobar foobar foobar/
],
'refresh successful'
;