[Bast-commits] r5612 - in DBIx-Class/0.08/trunk/t: . lib
lib/DBICTest/Schema
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Sat Feb 21 23:16:04 GMT 2009
Author: ribasushi
Date: 2009-02-21 23:16:04 +0000 (Sat, 21 Feb 2009)
New Revision: 5612
Modified:
DBIx-Class/0.08/trunk/t/87ordered.t
DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Employee.pm
DBIx-Class/0.08/trunk/t/lib/sqlite.sql
Log:
Somewhat fix bloody messy test
Modified: DBIx-Class/0.08/trunk/t/87ordered.t
===================================================================
--- DBIx-Class/0.08/trunk/t/87ordered.t 2009-02-21 16:28:13 UTC (rev 5611)
+++ DBIx-Class/0.08/trunk/t/87ordered.t 2009-02-21 23:16:04 UTC (rev 5612)
@@ -43,6 +43,7 @@
my $to_group = 1;
my $to_pos = undef;
while (my $employee = $group_3->next) {
+ $employee->discard_changes; # since we are effective shift()ing the $rs
$employee->move_to_group($to_group, $to_pos);
$to_pos++;
$to_group = $to_group==1 ? 2 : 1;
@@ -97,20 +98,20 @@
);
# multicol tests begin here
-DBICTest::Employee->grouping_column(['group_id', 'group_id_2']);
+DBICTest::Employee->grouping_column(['group_id_2', 'group_id_3']);
$employees->delete();
-foreach my $group_id (1..4) {
- foreach my $group_id_2 (1..4) {
+foreach my $group_id_2 (1..4) {
+ foreach my $group_id_3 (1..4) {
foreach (1..4) {
- $employees->create({ name=>'temp', group_id=>$group_id, group_id_2=>$group_id_2 });
+ $employees->create({ name=>'temp', group_id_2=>$group_id_2, group_id_3=>$group_id_3 });
}
}
}
-$employees = $employees->search(undef,{order_by=>'group_id,group_id_2,position'});
+$employees = $employees->search(undef,{order_by=>[qw/group_id_2 group_id_3 position/]});
-foreach my $group_id (1..3) {
- foreach my $group_id_2 (1..3) {
- my $group_employees = $employees->search({group_id=>$group_id, group_id_2=>$group_id_2});
+foreach my $group_id_2 (1..3) {
+ foreach my $group_id_3 (1..3) {
+ my $group_employees = $employees->search({group_id_2=>$group_id_2, group_id_3=>$group_id_3});
$group_employees->all();
ok( check_rs($group_employees), "group intial positions" );
hammer_rs( $group_employees );
@@ -118,72 +119,72 @@
}
# move_to_group, specifying group by hash
-my $group_4 = $employees->search({group_id=>4});
+my $group_4 = $employees->search({group_id_2=>4});
$to_group = 1;
my $to_group_2_base = 7;
my $to_group_2 = 1;
$to_pos = undef;
while (my $employee = $group_4->next) {
- $employee->move_to_group({group_id=>$to_group, group_id_2=>$to_group_2}, $to_pos);
+ $employee->move_to_group({group_id_2=>$to_group, group_id_3=>$to_group_2}, $to_pos);
$to_pos++;
$to_group = ($to_group % 3) + 1;
$to_group_2_base++;
$to_group_2 = (ceil($to_group_2_base/3.0) %3) +1
}
-foreach my $group_id (1..4) {
- foreach my $group_id_2 (1..4) {
- my $group_employees = $employees->search({group_id=>$group_id,group_id_2=>$group_id_2});
+foreach my $group_id_2 (1..4) {
+ foreach my $group_id_3 (1..4) {
+ my $group_employees = $employees->search({group_id_2=>$group_id_2,group_id_3=>$group_id_3});
$group_employees->all();
ok( check_rs($group_employees), "group positions after move_to_group" );
}
}
$employees->delete();
-foreach my $group_id (1..4) {
- foreach my $group_id_2 (1..4) {
+foreach my $group_id_2 (1..4) {
+ foreach my $group_id_3 (1..4) {
foreach (1..4) {
- $employees->create({ name=>'temp', group_id=>$group_id, group_id_2=>$group_id_2 });
+ $employees->create({ name=>'temp', group_id_2=>$group_id_2, group_id_3=>$group_id_3 });
}
}
}
-$employees = $employees->search(undef,{order_by=>'group_id,group_id_2,position'});
+$employees = $employees->search(undef,{order_by=>[qw/group_id_2 group_id_3 position/]});
-$employee = $employees->search({group_id=>4, group_id_2=>1})->first;
-$employee->group_id(1);
+$employee = $employees->search({group_id_2=>4, group_id_3=>1})->first;
+$employee->group_id_2(1);
$employee->update;
ok(
- check_rs($employees->search_rs({group_id=>4, group_id_2=>1}))
- && check_rs($employees->search_rs({group_id=>1, group_id_2=>1})),
+ check_rs($employees->search_rs({group_id_2=>4, group_id_3=>1}))
+ && check_rs($employees->search_rs({group_id_2=>1, group_id_3=>1})),
"overloaded multicol update 1"
);
-$employee = $employees->search({group_id=>4, group_id_2=>1})->first;
-$employee->update({group_id=>2});
-ok( check_rs($employees->search_rs({group_id=>4, group_id_2=>1}))
- && check_rs($employees->search_rs({group_id=>2, group_id_2=>1})),
- "overloaded multicol update 2"
+$employee = $employees->search({group_id_2=>4, group_id_3=>1})->first;
+$employee->update({group_id_2=>2});
+ok( check_rs($employees->search_rs({group_id_2=>4, group_id_3=>1}))
+ && check_rs($employees->search_rs({group_id_2=>2, group_id_3=>1})),
+ "overloaded multicol update 2"
);
-$employee = $employees->search({group_id=>3, group_id_2=>1})->first;
-$employee->group_id(1);
-$employee->group_id_2(3);
+$employee = $employees->search({group_id_2=>3, group_id_3=>1})->first;
+$employee->group_id_2(1);
+$employee->group_id_3(3);
$employee->update();
-ok( check_rs($employees->search_rs({group_id=>3, group_id_2=>1}))
- && check_rs($employees->search_rs({group_id=>1, group_id_2=>3})),
+ok( check_rs($employees->search_rs({group_id_2=>3, group_id_3=>1}))
+ && check_rs($employees->search_rs({group_id_2=>1, group_id_3=>3})),
"overloaded multicol update 3"
);
-$employee = $employees->search({group_id=>3, group_id_2=>1})->first;
-$employee->update({group_id=>2, group_id_2=>3});
-ok( check_rs($employees->search_rs({group_id=>3, group_id_2=>1}))
- && check_rs($employees->search_rs({group_id=>2, group_id_2=>3})),
+$employee = $employees->search({group_id_2=>3, group_id_3=>1})->first;
+$employee->update({group_id_2=>2, group_id_3=>3});
+ok( check_rs($employees->search_rs({group_id_2=>3, group_id_3=>1}))
+ && check_rs($employees->search_rs({group_id_2=>2, group_id_3=>3})),
"overloaded multicol update 4"
);
-$employee = $employees->search({group_id=>3, group_id_2=>2})->first;
-$employee->update({group_id=>2, group_id_2=>4, position=>2});
-ok( check_rs($employees->search_rs({group_id=>3, group_id_2=>2}))
- && check_rs($employees->search_rs({group_id=>2, group_id_2=>4})),
+$employee = $employees->search({group_id_2=>3, group_id_3=>2})->first;
+$employee->update({group_id_2=>2, group_id_3=>4, position=>2});
+ok( check_rs($employees->search_rs({group_id_2=>3, group_id_3=>2}))
+ && check_rs($employees->search_rs({group_id_2=>2, group_id_3=>4})),
"overloaded multicol update 5"
);
Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Employee.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Employee.pm 2009-02-21 16:28:13 UTC (rev 5611)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/Employee.pm 2009-02-21 23:16:04 UTC (rev 5612)
@@ -23,6 +23,10 @@
data_type => 'integer',
is_nullable => 1,
},
+ group_id_3 => {
+ data_type => 'integer',
+ is_nullable => 1,
+ },
name => {
data_type => 'varchar',
size => 100,
Modified: DBIx-Class/0.08/trunk/t/lib/sqlite.sql
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/sqlite.sql 2009-02-21 16:28:13 UTC (rev 5611)
+++ DBIx-Class/0.08/trunk/t/lib/sqlite.sql 2009-02-21 23:16:04 UTC (rev 5612)
@@ -1,6 +1,6 @@
--
-- Created by SQL::Translator::Producer::SQLite
--- Created on Thu Feb 19 22:09:32 2009
+-- Created on Sun Feb 22 00:15:06 2009
--
@@ -48,6 +48,7 @@
);
CREATE INDEX artwork_to_artist_idx_artist_id_artwork_to_arti ON artwork_to_artist (artist_id);
+
CREATE INDEX artwork_to_artist_idx_artwork_cd_id_artwork_to_ ON artwork_to_artist (artwork_cd_id);
--
@@ -143,6 +144,7 @@
position integer NOT NULL,
group_id integer,
group_id_2 integer,
+ group_id_3 integer,
name varchar(100)
);
More information about the Bast-commits
mailing list