Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Delete t/run/ and t/helperrels/ so that the reorganize_tests branch c…

…an merge in easly.
  • Loading branch information...
commit 263e41beb22b3753c1a263d923f09386b21c1d38 1 parent 9eba6e0
authored May 25, 2006

Showing 69 changed files with 0 additions and 3,050 deletions. Show diff stats Hide diff stats

  1. 7  t/helperrels/01core.t
  2. 7  t/helperrels/04db.t
  3. 7  t/helperrels/05multipk.t
  4. 7  t/helperrels/06relationship.t
  5. 7  t/helperrels/07pager.t
  6. 7  t/helperrels/08inflate.t
  7. 7  t/helperrels/08inflate_has_a.t
  8. 7  t/helperrels/08inflate_serialize.t
  9. 7  t/helperrels/09update.t
  10. 7  t/helperrels/10auto.t
  11. 7  t/helperrels/11mysql.t
  12. 7  t/helperrels/12pg.t
  13. 7  t/helperrels/13oracle.t
  14. 7  t/helperrels/145db2.t
  15. 7  t/helperrels/146db2_400.t
  16. 7  t/helperrels/14mssql.t
  17. 7  t/helperrels/15limit.t
  18. 7  t/helperrels/16joins.t
  19. 7  t/helperrels/17join_count.t
  20. 7  t/helperrels/18self_referencial.t
  21. 7  t/helperrels/19uuid.t
  22. 7  t/helperrels/20unique.t
  23. 7  t/helperrels/21transactions.t
  24. 7  t/helperrels/22cascade_copy.t
  25. 7  t/helperrels/23cache.t
  26. 7  t/helperrels/24serialize.t
  27. 7  t/helperrels/25utf8.t
  28. 7  t/helperrels/26might_have.t
  29. 224  t/helperrels/26sqlt.t
  30. 7  t/helperrels/27ordered.t
  31. 7  t/helperrels/28result_set_column.t
  32. 7  t/helperrels/29dbicadmin.t
  33. 7  t/helperrels/29inflate_datetime.t
  34. 7  t/helperrels/30ensure_class_loaded.t
  35. 7  t/helperrels/30join_torture.t
  36. 286  t/run/01core.tl
  37. 56  t/run/04db.tl
  38. 17  t/run/05multipk.tl
  39. 168  t/run/06relationship.tl
  40. 70  t/run/07pager.tl
  41. 35  t/run/08inflate.tl
  42. 58  t/run/08inflate_has_a.tl
  43. 75  t/run/08inflate_serialize.tl
  44. 29  t/run/09update.tl
  45. 22  t/run/10auto.tl
  46. 77  t/run/11mysql.tl
  47. 77  t/run/12pg.tl
  48. 95  t/run/13oracle.tl
  49. 74  t/run/145db2.tl
  50. 75  t/run/146db2_400.tl
  51. 49  t/run/14mssql.tl
  52. 70  t/run/15limit.tl
  53. 281  t/run/16joins.tl
  54. 31  t/run/17join_count.tl
  55. 42  t/run/18self_referencial.tl
  56. 20  t/run/19uuid.tl
  57. 127  t/run/20unique.tl
  58. 179  t/run/21transactions.tl
  59. 33  t/run/22cascade_copy.tl
  60. 181  t/run/23cache.tl
  61. 16  t/run/24serialize.tl
  62. 27  t/run/25utf8.tl
  63. 47  t/run/26might_have.tl
  64. 104  t/run/27ordered.tl
  65. 43  t/run/28result_set_column.tl
  66. 41  t/run/29dbicadmin.tl
  67. 18  t/run/29inflate_datetime.tl
  68. 40  t/run/30ensure_class_loaded.tl
  69. 25  t/run/30join_torture.tl
7  t/helperrels/01core.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/01core.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/04db.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/04db.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/05multipk.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/05multipk.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/06relationship.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/06relationship.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/07pager.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/07pager.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/08inflate.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/08inflate.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/08inflate_has_a.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/08inflate_has_a.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/08inflate_serialize.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/08inflate_serialize.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/09update.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/09update.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/10auto.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/10auto.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/11mysql.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/11mysql.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/12pg.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/12pg.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/13oracle.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/13oracle.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/145db2.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/145db2.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/146db2_400.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/146db2_400.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/14mssql.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/14mssql.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/15limit.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/15limit.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/16joins.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/16joins.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/17join_count.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/17join_count.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/18self_referencial.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/18self_referencial.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/19uuid.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/19uuid.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/20unique.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/20unique.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/21transactions.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/21transactions.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/22cascade_copy.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/22cascade_copy.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/23cache.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/23cache.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/24serialize.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/24serialize.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/25utf8.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/25utf8.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/26might_have.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/26might_have.tl";
7  
-run_tests(DBICTest->schema);
224  t/helperrels/26sqlt.t
... ...
@@ -1,224 +0,0 @@
1  
-use strict;
2  
-use warnings;
3  
-
4  
-use Test::More;
5  
-use lib qw(t/lib);
6  
-use DBICTest;
7  
-
8  
-eval "use SQL::Translator";
9  
-plan skip_all => 'SQL::Translator required' if $@;
10  
-
11  
-# do not taunt happy dave ball
12  
-
13  
-my $schema = DBICTest::Schema;
14  
-
15  
-plan tests => 31;
16  
-
17  
-my $translator           =  SQL::Translator->new( 
18  
-    parser_args          => {
19  
-        'DBIx::Schema'   => $schema,
20  
-    },
21  
-    producer_args   => {
22  
-    },
23  
-);
24  
-
25  
-$translator->parser('SQL::Translator::Parser::DBIx::Class');
26  
-$translator->producer('SQLite');
27  
-
28  
-my $output = $translator->translate();
29  
-
30  
-my @fk_constraints = 
31  
- (
32  
-  {'display' => 'twokeys->cd',
33  
-   'selftable' => 'twokeys', 'foreigntable' => 'cd', 
34  
-   'selfcols'  => ['cd'], 'foreigncols' => ['cdid'], 
35  
-   'needed' => 1, on_delete => '', on_update => ''},
36  
-  {'display' => 'twokeys->artist',
37  
-   'selftable' => 'twokeys', 'foreigntable' => 'artist', 
38  
-   'selfcols'  => ['artist'], 'foreigncols' => ['artistid'],
39  
-   'needed' => 1, on_delete => 'CASCADE', on_update => 'CASCADE'},
40  
-  {'display' => 'cd_to_producer->cd',
41  
-   'selftable' => 'cd_to_producer', 'foreigntable' => 'cd', 
42  
-   'selfcols'  => ['cd'], 'foreigncols' => ['cdid'],
43  
-   'needed' => 1, on_delete => 'CASCADE', on_update => 'CASCADE'},
44  
-  {'display' => 'cd_to_producer->producer',
45  
-   'selftable' => 'cd_to_producer', 'foreigntable' => 'producer', 
46  
-   'selfcols'  => ['producer'], 'foreigncols' => ['producerid'],
47  
-   'needed' => 1, on_delete => '', on_update => ''},
48  
-  {'display' => 'self_ref_alias -> self_ref for self_ref',
49  
-   'selftable' => 'self_ref_alias', 'foreigntable' => 'self_ref', 
50  
-   'selfcols'  => ['self_ref'], 'foreigncols' => ['id'],
51  
-   'needed' => 1, on_delete => 'CASCADE', on_update => 'CASCADE'},
52  
-  {'display' => 'self_ref_alias -> self_ref for alias',
53  
-   'selftable' => 'self_ref_alias', 'foreigntable' => 'self_ref', 
54  
-   'selfcols'  => ['alias'], 'foreigncols' => ['id'],
55  
-   'needed' => 1, on_delete => '', on_update => ''},
56  
-  {'display' => 'cd -> artist',
57  
-   'selftable' => 'cd', 'foreigntable' => 'artist', 
58  
-   'selfcols'  => ['artist'], 'foreigncols' => ['artistid'],
59  
-   'needed' => 1, on_delete => 'CASCADE', on_update => 'CASCADE'},
60  
-  {'display' => 'artist_undirected_map -> artist for id1',
61  
-   'selftable' => 'artist_undirected_map', 'foreigntable' => 'artist', 
62  
-   'selfcols'  => ['id1'], 'foreigncols' => ['artistid'],
63  
-   'needed' => 1, on_delete => 'CASCADE', on_update => ''},
64  
-  {'display' => 'artist_undirected_map -> artist for id2',
65  
-   'selftable' => 'artist_undirected_map', 'foreigntable' => 'artist', 
66  
-   'selfcols'  => ['id2'], 'foreigncols' => ['artistid'],
67  
-   'needed' => 1, on_delete => 'CASCADE', on_update => ''},
68  
-  {'display' => 'track->cd',
69  
-   'selftable' => 'track', 'foreigntable' => 'cd', 
70  
-   'selfcols'  => ['cd'], 'foreigncols' => ['cdid'],
71  
-   'needed' => 2, on_delete => 'CASCADE', on_update => 'CASCADE'},
72  
-  {'display' => 'treelike -> treelike for parent',
73  
-   'selftable' => 'treelike', 'foreigntable' => 'treelike', 
74  
-   'selfcols'  => ['parent'], 'foreigncols' => ['id'],
75  
-   'needed' => 1, on_delete => '', on_update => ''},
76  
-
77  
-  # shouldn't this be generated?
78  
-  # 
79  
-  #{'display' => 'twokeytreelike -> twokeytreelike for parent1,parent2',
80  
-  # 'selftable' => 'twokeytreelike', 'foreigntable' => 'twokeytreelike', 
81  
-  # 'selfcols'  => ['parent1', 'parent2'], 'foreigncols' => ['id1','id2'],
82  
-  # 'needed' => 1, on_delete => '', on_update => ''},
83  
-
84  
-  {'display' => 'tags -> cd',
85  
-   'selftable' => 'tags', 'foreigntable' => 'cd', 
86  
-   'selfcols'  => ['cd'], 'foreigncols' => ['cdid'],
87  
-   'needed' => 1, on_delete => 'CASCADE', on_update => 'CASCADE'},
88  
-  {'display' => 'bookmark -> link',
89  
-   'selftable' => 'bookmark', 'foreigntable' => 'link', 
90  
-   'selfcols'  => ['link'], 'foreigncols' => ['id'],
91  
-   'needed' => 1, on_delete => '', on_update => ''},
92  
- );
93  
-
94  
-my @unique_constraints = (
95  
-  {'display' => 'cd artist and title unique',
96  
-   'table' => 'cd', 'cols' => ['artist', 'title'],
97  
-   'needed' => 1},
98  
-  {'display' => 'twokeytreelike name unique',
99  
-   'table' => 'twokeytreelike', 'cols'  => ['name'],
100  
-   'needed' => 1},
101  
-#  {'display' => 'employee position and group_id unique',
102  
-#   'table' => 'employee', cols => ['position', 'group_id'],
103  
-#   'needed' => 1},
104  
-);
105  
-
106  
-my $tschema = $translator->schema();
107  
-for my $table ($tschema->get_tables) {
108  
-    my $table_name = $table->name;
109  
-    for my $c ( $table->get_constraints ) {
110  
-        if ($c->type eq 'FOREIGN KEY') {
111  
-            ok(check_fk($table_name, scalar $c->fields, 
112  
-                  $c->reference_table, scalar $c->reference_fields, 
113  
-                  $c->on_delete, $c->on_update), "Foreign key constraint on $table_name matches an expected constraint");
114  
-        }
115  
-        elsif ($c->type eq 'UNIQUE') {
116  
-            ok(check_unique($table_name, scalar $c->fields),
117  
-                  "Unique constraint on $table_name matches an expected constraint");
118  
-        }
119  
-    }
120  
-}
121  
-
122  
-# Make sure all the foreign keys are done.
123  
-my $i;
124  
-for ($i = 0; $i <= $#fk_constraints; ++$i) {
125  
- ok(!$fk_constraints[$i]->{'needed'}, "Constraint $fk_constraints[$i]->{display}");
126  
-}
127  
-# Make sure all the uniques are done.
128  
-for ($i = 0; $i <= $#unique_constraints; ++$i) {
129  
- ok(!$unique_constraints[$i]->{'needed'}, "Constraint $unique_constraints[$i]->{display}");
130  
-}
131  
-
132  
-sub check_fk {
133  
- my ($selftable, $selfcol, $foreigntable, $foreigncol, $ondel, $onupd) = @_;
134  
-
135  
- $ondel = '' if (!defined($ondel));
136  
- $onupd = '' if (!defined($onupd));
137  
-
138  
- my $i;
139  
- for ($i = 0; $i <= $#fk_constraints; ++$i) {
140  
-     if ($selftable eq $fk_constraints[$i]->{'selftable'} &&
141  
-         $foreigntable eq $fk_constraints[$i]->{'foreigntable'} &&
142  
-         ($ondel eq $fk_constraints[$i]->{on_delete}) &&
143  
-         ($onupd eq $fk_constraints[$i]->{on_update})) {
144  
-         # check columns
145  
-
146  
-         my $found = 0;
147  
-         for (my $j = 0; $j <= $#$selfcol; ++$j) {
148  
-             $found = 0;
149  
-             for (my $k = 0; $k <= $#{$fk_constraints[$i]->{'selfcols'}}; ++$k) {
150  
-                 if ($selfcol->[$j] eq $fk_constraints[$i]->{'selfcols'}->[$k] &&
151  
-                     $foreigncol->[$j] eq $fk_constraints[$i]->{'foreigncols'}->[$k]) {
152  
-                     $found = 1;
153  
-                     last;
154  
-                 }
155  
-             }
156  
-             last unless $found;
157  
-         }
158  
-
159  
-         if ($found) {
160  
-             for (my $j = 0; $j <= $#{$fk_constraints[$i]->{'selfcols'}}; ++$j) {
161  
-                 $found = 0;
162  
-                 for (my $k = 0; $k <= $#$selfcol; ++$k) {
163  
-                     if ($selfcol->[$k] eq $fk_constraints[$i]->{'selfcols'}->[$j] &&
164  
-                         $foreigncol->[$k] eq $fk_constraints[$i]->{'foreigncols'}->[$j]) {
165  
-                         $found = 1;
166  
-                         last;
167  
-                     }
168  
-                 }
169  
-                 last unless $found;
170  
-             }
171  
-         }
172  
-
173  
-         if ($found) {
174  
-             --$fk_constraints[$i]->{needed};
175  
-             return 1;
176  
-         }
177  
-     }
178  
- }
179  
- return 0;
180  
-}
181  
-
182  
-sub check_unique {
183  
- my ($selftable, $selfcol) = @_;
184  
-
185  
- $ondel = '' if (!defined($ondel));
186  
- $onupd = '' if (!defined($onupd));
187  
-
188  
- my $i;
189  
- for ($i = 0; $i <= $#unique_constraints; ++$i) {
190  
-     if ($selftable eq $unique_constraints[$i]->{'table'}) {
191  
-
192  
-         my $found = 0;
193  
-         for (my $j = 0; $j <= $#$selfcol; ++$j) {
194  
-             $found = 0;
195  
-             for (my $k = 0; $k <= $#{$unique_constraints[$i]->{'cols'}}; ++$k) {
196  
-                 if ($selfcol->[$j] eq $unique_constraints[$i]->{'cols'}->[$k]) {
197  
-                     $found = 1;
198  
-                     last;
199  
-                 }
200  
-             }
201  
-             last unless $found;
202  
-         }
203  
-
204  
-         if ($found) {
205  
-             for (my $j = 0; $j <= $#{$unique_constraints[$i]->{'cols'}}; ++$j) {
206  
-                 $found = 0;
207  
-                 for (my $k = 0; $k <= $#$selfcol; ++$k) {
208  
-                     if ($selfcol->[$k] eq $unique_constraints[$i]->{'cols'}->[$j]) {
209  
-                         $found = 1;
210  
-                         last;
211  
-                     }
212  
-                 }
213  
-                 last unless $found;
214  
-             }
215  
-         }
216  
-
217  
-         if ($found) {
218  
-             --$unique_constraints[$i]->{needed};
219  
-             return 1;
220  
-         }
221  
-     }
222  
- }
223  
- return 0;
224  
-}
7  t/helperrels/27ordered.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/27ordered.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/28result_set_column.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/28result_set_column.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/29dbicadmin.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/29dbicadmin.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/29inflate_datetime.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/29inflate_datetime.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/30ensure_class_loaded.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/30ensure_class_loaded.tl";
7  
-run_tests(DBICTest->schema);
7  t/helperrels/30join_torture.t
... ...
@@ -1,7 +0,0 @@
1  
-use Test::More;
2  
-use lib qw(t/lib);
3  
-use DBICTest;
4  
-use DBICTest::HelperRels;
5  
-
6  
-require "t/run/30join_torture.tl";
7  
-run_tests(DBICTest->schema);
286  t/run/01core.tl
... ...
@@ -1,286 +0,0 @@
1  
-use strict;
2  
-use warnings;  
3  
-
4  
-use Test::More;
5  
-use lib qw(t/lib);
6  
-use DBICTest;
7  
-
8  
-my $schema = DBICTest::init_schema();
9  
-
10  
-plan tests => 58;
11  
-
12  
-# figure out if we've got a version of sqlite that is older than 3.2.6, in
13  
-# which case COUNT(DISTINCT()) doesn't work
14  
-my $is_broken_sqlite = 0;
15  
-my ($sqlite_major_ver,$sqlite_minor_ver,$sqlite_patch_ver) =
16  
-    split /\./, $schema->storage->dbh->get_info(18);
17  
-if( $schema->storage->dbh->get_info(17) eq 'SQLite' &&
18  
-    ( ($sqlite_major_ver < 3) ||
19  
-      ($sqlite_major_ver == 3 && $sqlite_minor_ver < 2) ||
20  
-      ($sqlite_major_ver == 3 && $sqlite_minor_ver == 2 && $sqlite_patch_ver < 6) ) ) {
21  
-    $is_broken_sqlite = 1;
22  
-}
23  
-
24  
-
25  
-my @art = $schema->resultset("Artist")->search({ }, { order_by => 'name DESC'});
26  
-
27  
-cmp_ok(@art, '==', 3, "Three artists returned");
28  
-
29  
-my $art = $art[0];
30  
-
31  
-is($art->name, 'We Are Goth', "Correct order too");
32  
-
33  
-$art->name('We Are In Rehab');
34  
-
35  
-is($art->name, 'We Are In Rehab', "Accessor update ok");
36  
-
37  
-is($art->get_column("name"), 'We Are In Rehab', 'And via get_column');
38  
-
39  
-ok($art->update, 'Update run');
40  
-
41  
-my $record_jp = $schema->resultset("Artist")->search(undef, { join => 'cds' })->search(undef, { prefetch => 'cds' })->next;
42  
-
43  
-ok($record_jp, "prefetch on same rel okay");
44  
-
45  
-my $record_fn = $schema->resultset("Artist")->search(undef, { join => 'cds' })->search({'cds.cdid' => '1'}, {join => 'artist_undirected_maps'})->next;
46  
-
47  
-ok($record_fn, "funny join is okay");
48  
-
49  
-@art = $schema->resultset("Artist")->search({ name => 'We Are In Rehab' });
50  
-
51  
-cmp_ok(@art, '==', 1, "Changed artist returned by search");
52  
-
53  
-cmp_ok($art[0]->artistid, '==', 3,'Correct artist too');
54  
-
55  
-$art->delete;
56  
-
57  
-@art = $schema->resultset("Artist")->search({ });
58  
-
59  
-cmp_ok(@art, '==', 2, 'And then there were two');
60  
-
61  
-ok(!$art->in_storage, "It knows it's dead");
62  
-
63  
-eval { $art->delete; };
64  
-
65  
-ok($@, "Can't delete twice: $@");
66  
-
67  
-is($art->name, 'We Are In Rehab', 'But the object is still live');
68  
-
69  
-$art->insert;
70  
-
71  
-ok($art->in_storage, "Re-created");
72  
-
73  
-@art = $schema->resultset("Artist")->search({ });
74  
-
75  
-cmp_ok(@art, '==', 3, 'And now there are three again');
76  
-
77  
-my $new = $schema->resultset("Artist")->create({ artistid => 4 });
78  
-
79  
-cmp_ok($new->artistid, '==', 4, 'Create produced record ok');
80  
-
81  
-@art = $schema->resultset("Artist")->search({ });
82  
-
83  
-cmp_ok(@art, '==', 4, "Oh my god! There's four of them!");
84  
-
85  
-$new->set_column('name' => 'Man With A Fork');
86  
-
87  
-is($new->name, 'Man With A Fork', 'set_column ok');
88  
-
89  
-$new->discard_changes;
90  
-
91  
-ok(!defined $new->name, 'Discard ok');
92  
-
93  
-$new->name('Man With A Spoon');
94  
-
95  
-$new->update;
96  
-
97  
-my $new_again = $schema->resultset("Artist")->find(4);
98  
-
99  
-is($new_again->name, 'Man With A Spoon', 'Retrieved correctly');
100  
-
101  
-is($new_again->ID, 'DBICTest::Artist|artist|artistid=4', 'unique object id generated correctly');
102  
-
103  
-# Test backwards compatibility
104  
-{
105  
-  my $artist_by_hash = $schema->resultset('Artist')->find(artistid => 4);
106  
-  is($artist_by_hash->name, 'Man With A Spoon', 'Retrieved correctly');
107  
-  is($artist_by_hash->ID, 'DBICTest::Artist|artist|artistid=4', 'unique object id generated correctly');
108  
-}
109  
-
110  
-is($schema->resultset("Artist")->count, 4, 'count ok');
111  
-
112  
-# test find_or_new
113  
-{
114  
-  my $existing_obj = $schema->resultset('Artist')->find_or_new({
115  
-    artistid => 4,
116  
-  });
117  
-
118  
-  is($existing_obj->name, 'Man With A Spoon', 'find_or_new: found existing artist');
119  
-  ok($existing_obj->in_storage, 'existing artist is in storage');
120  
-
121  
-  my $new_obj = $schema->resultset('Artist')->find_or_new({
122  
-    artistid => 5,
123  
-    name     => 'find_or_new',
124  
-  });
125  
-
126  
-  is($new_obj->name, 'find_or_new', 'find_or_new: instantiated a new artist');
127  
-  ok(! $new_obj->in_storage, 'new artist is not in storage');
128  
-}
129  
-
130  
-my $cd = $schema->resultset("CD")->find(1);
131  
-my %cols = $cd->get_columns;
132  
-
133  
-cmp_ok(keys %cols, '==', 4, 'get_columns number of columns ok');
134  
-
135  
-is($cols{title}, 'Spoonful of bees', 'get_columns values ok');
136  
-
137  
-%cols = ( title => 'Forkful of bees', year => 2005);
138  
-$cd->set_columns(\%cols);
139  
-
140  
-is($cd->title, 'Forkful of bees', 'set_columns ok');
141  
-
142  
-is($cd->year, 2005, 'set_columns ok');
143  
-
144  
-$cd->discard_changes;
145  
-
146  
-# check whether ResultSource->columns returns columns in order originally supplied
147  
-my @cd = $schema->source("CD")->columns;
148  
-
149  
-is_deeply( \@cd, [qw/cdid artist title year/], 'column order');
150  
-
151  
-$cd = $schema->resultset("CD")->search({ title => 'Spoonful of bees' }, { columns => ['title'] })->next;
152  
-is($cd->title, 'Spoonful of bees', 'subset of columns returned correctly');
153  
-
154  
-$cd = $schema->resultset("CD")->search(undef, { include_columns => [ 'artist.name' ], join => [ 'artist' ] })->find(1);
155  
-
156  
-is($cd->title, 'Spoonful of bees', 'Correct CD returned with include');
157  
-is($cd->get_column('name'), 'Caterwauler McCrae', 'Additional column returned');
158  
-
159  
-# update_or_insert
160  
-$new = $schema->resultset("Track")->new( {
161  
-  trackid => 100,
162  
-  cd => 1,
163  
-  position => 1,
164  
-  title => 'Insert or Update',
165  
-} );
166  
-$new->update_or_insert;
167  
-ok($new->in_storage, 'update_or_insert insert ok');
168  
-
169  
-# test in update mode
170  
-$new->pos(5);
171  
-$new->update_or_insert;
172  
-is( $schema->resultset("Track")->find(100)->pos, 5, 'update_or_insert update ok');
173  
-
174  
-eval { $schema->class("Track")->load_components('DoesNotExist'); };
175  
-
176  
-ok $@, $@;
177  
-
178  
-is($schema->class("Artist")->field_name_for->{name}, 'artist name', 'mk_classdata usage ok');
179  
-
180  
-my $search = [ { 'tags.tag' => 'Cheesy' }, { 'tags.tag' => 'Blue' } ];
181  
-
182  
-my( $or_rs ) = $schema->resultset("CD")->search_rs($search, { join => 'tags',
183  
-                                                  order_by => 'cdid' });
184  
-
185  
-cmp_ok($or_rs->count, '==', 5, 'Search with OR ok');
186  
-
187  
-my $distinct_rs = $schema->resultset("CD")->search($search, { join => 'tags', distinct => 1 });
188  
-cmp_ok($distinct_rs->all, '==', 4, 'DISTINCT search with OR ok');
189  
-
190  
-SKIP: {
191  
-  skip "SQLite < 3.2.6 doesn't understand COUNT(DISTINCT())", 1
192  
-    if $is_broken_sqlite;
193  
-
194  
-  my $tcount = $schema->resultset("Track")->search(
195  
-    {},
196  
-    {       
197  
-       select => {count => {distinct => ['position', 'title']}},
198  
-	   as => ['count']
199  
-    }
200  
-  );
201  
-  cmp_ok($tcount->next->get_column('count'), '==', 13, 'multiple column COUNT DISTINCT ok');
202  
-
203  
-}
204  
-my $tag_rs = $schema->resultset('Tag')->search(
205  
-               [ { 'me.tag' => 'Cheesy' }, { 'me.tag' => 'Blue' } ]);
206  
-
207  
-my $rel_rs = $tag_rs->search_related('cd');
208  
-
209  
-cmp_ok($rel_rs->count, '==', 5, 'Related search ok');
210  
-
211  
-cmp_ok($or_rs->next->cdid, '==', $rel_rs->next->cdid, 'Related object ok');
212  
-$or_rs->reset;
213  
-$rel_rs->reset;
214  
-
215  
-my $tag = $schema->resultset('Tag')->search(
216  
-               [ { 'me.tag' => 'Blue' } ], { cols=>[qw/tagid/] } )->next;
217  
-
218  
-cmp_ok($tag->has_column_loaded('tagid'), '==', 1, 'Has tagid loaded');
219  
-cmp_ok($tag->has_column_loaded('tag'), '==', 0, 'Has not tag  loaded');
220  
-
221  
-ok($schema->storage(), 'Storage available');
222  
-
223  
-{
224  
-  my $rs = $schema->resultset("Artist")->search({
225  
-    -and => [
226  
-      artistid => { '>=', 1 },
227  
-      artistid => { '<', 3 }
228  
-    ]
229  
-  });
230  
-
231  
-  $rs->update({ name => 'Test _cond_for_update_delete' });
232  
-
233  
-  my $art;
234  
-
235  
-  $art = $schema->resultset("Artist")->find(1);
236  
-  is($art->name, 'Test _cond_for_update_delete', 'updated first artist name');
237  
-
238  
-  $art = $schema->resultset("Artist")->find(2);
239  
-  is($art->name, 'Test _cond_for_update_delete', 'updated second artist name');
240  
-}
241  
-
242  
-# test source_name
243  
-{
244  
-  # source_name should be set for normal modules
245  
-  is($schema->source('CD')->source_name, 'CD', 'source_name is set to moniker');
246  
-
247  
-  # test the result source that sets source_name explictly
248  
-  ok($schema->source('SourceNameArtists'), 'SourceNameArtists result source exists');
249  
-
250  
-  my @artsn = $schema->resultset('SourceNameArtists')->search({}, { order_by => 'name DESC' });
251  
-  cmp_ok(@artsn, '==', 4, "Four artists returned");
252  
-}
253  
-
254  
-my $newbook = $schema->resultset( 'Bookmark' )->find(1);
255  
-
256  
-$@ = '';
257  
-eval {
258  
-my $newlink = $newbook->link;
259  
-};
260  
-ok(!$@, "stringify to false value doesn't cause error");
261  
-
262  
-# test cascade_delete through many_to_many relations
263  
-{
264  
-  my $art_del = $schema->resultset("Artist")->find({ artistid => 1 });
265  
-  $art_del->delete;
266  
-  cmp_ok( $schema->resultset("CD")->search({artist => 1}), '==', 0, 'Cascading through has_many top level.');
267  
-  cmp_ok( $schema->resultset("CD_to_Producer")->search({cd => 1}), '==', 0, 'Cascading through has_many children.');
268  
-}
269  
-
270  
-# test column_info
271  
-{
272  
-  $schema->source("Artist")->{_columns}{'artistid'} = {};
273  
-
274  
-  my $typeinfo = $schema->source("Artist")->column_info('artistid');
275  
-  is($typeinfo->{data_type}, 'INTEGER', 'column_info ok');
276  
-  $schema->source("Artist")->column_info('artistid');
277  
-  ok($schema->source("Artist")->{_columns_info_loaded} == 1, 'Columns info flag set');
278  
-}
279  
-
280  
-# test remove_columns
281  
-{
282  
-  is_deeply([$schema->source('CD')->columns], [qw/cdid artist title year/]);
283  
-  $schema->source('CD')->remove_columns('year');
284  
-  is_deeply([$schema->source('CD')->columns], [qw/cdid artist title/]);
285  
-}
286  
-
56  t/run/04db.tl
... ...
@@ -1,56 +0,0 @@
1  
-use strict;
2  
-use warnings;  
3  
-
4  
-use Test::More;
5  
-use lib qw(t/lib);
6  
-use DBICTest;
7  
-
8  
-my $schema = DBICTest::init_schema();
9  
-
10  
-plan tests => 3;
11  
-
12  
-# add some rows inside a transaction and commit it
13  
-# XXX: Is storage->dbh the only way to get a dbh?
14  
-$schema->storage->txn_begin;
15  
-for (10..15) {
16  
-    $schema->resultset("Artist")->create( { 
17  
-        artistid => $_,
18  
-        name => "artist number $_",
19  
-    } );
20  
-}
21  
-$schema->storage->txn_commit;
22  
-my ($artist) = $schema->resultset("Artist")->find(15);
23  
-is($artist->name, 'artist number 15', "Commit ok");
24  
-
25  
-# add some rows inside a transaction and roll it back
26  
-$schema->storage->txn_begin;
27  
-for (21..30) {
28  
-    $schema->resultset("Artist")->create( {
29  
-        artistid => $_,
30  
-        name => "artist number $_",
31  
-    } );
32  
-}
33  
-$schema->storage->txn_rollback;
34  
-($artist) = $schema->resultset("Artist")->search( artistid => 25 );
35  
-is($artist, undef, "Rollback ok");
36  
-
37  
-my $type_info = $schema->storage->columns_info_for('artist');
38  
-
39  
-# I know this is gross but SQLite reports the size differently from release
40  
-# to release. At least this way the test still passes.
41  
-
42  
-delete $type_info->{artistid}{size};
43  
-delete $type_info->{name}{size};
44  
-
45  
-my $test_type_info = {
46  
-    'artistid' => {
47  
-        'data_type' => 'INTEGER',
48  
-        'is_nullable' => 0,
49  
-    },
50  
-    'name' => {
51  
-        'data_type' => 'varchar',
52  
-        'is_nullable' => 0,
53  
-    },
54  
-};
55  
-is_deeply($type_info, $test_type_info, 'columns_info_for - column data types');
56  
-
17  t/run/05multipk.tl
... ...
@@ -1,17 +0,0 @@
1  
-use strict;
2  
-use warnings;  
3  
-
4  
-use Test::More;
5  
-use lib qw(t/lib);
6  
-use DBICTest;
7  
-
8  
-my $schema = DBICTest::init_schema();
9  
-
10  
-plan tests => 4;
11  
-
12  
-my $artist = DBICTest::Artist->find(1);
13  
-ok($artist->find_related('twokeys', {cd => 1}), "find multiple pks using relationships + args");
14  
-ok($schema->resultset("FourKeys")->find(1,2,3,4), "find multiple pks without hash");
15  
-ok($schema->resultset("FourKeys")->find(5,4,3,6), "find multiple pks without hash");
16  
-is($schema->resultset("FourKeys")->find(1,2,3,4)->ID, 'DBICTest::FourKeys|fourkeys|bar=2|foo=1|goodbye=4|hello=3', 'unique object id ok for multiple pks');
17  
-
168  t/run/06relationship.tl
... ...
@@ -1,168 +0,0 @@
1  
-use strict;
2  
-use warnings;  
3  
-
4  
-use Test::More;
5  
-use lib qw(t/lib);
6  
-use DBICTest;
7  
-
8  
-my $schema = DBICTest::init_schema();
9  
-
10  
-plan tests => 32;
11  
-
12  
-# has_a test
13  
-my $cd = $schema->resultset("CD")->find(4);
14  
-my ($artist) = ($INC{'DBICTest/HelperRels'}
15  
-                  ? $cd->artist
16  
-                  : $cd->search_related('artist'));
17  
-is($artist->name, 'Random Boy Band', 'has_a search_related ok');
18  
-
19  
-# has_many test with an order_by clause defined
20  
-$artist = $schema->resultset("Artist")->find(1);
21  
-my @cds = ($INC{'DBICTest/HelperRels'}
22  
-             ? $artist->cds
23  
-             : $artist->search_related('cds'));
24  
-is( $cds[1]->title, 'Spoonful of bees', 'has_many search_related with order_by ok' );
25  
-
26  
-# search_related with additional abstract query
27  
-@cds = ($INC{'DBICTest/HelperRels'}
28  
-          ? $artist->cds({ title => { like => '%of%' } })
29  
-          : $artist->search_related('cds', { title => { like => '%of%' } } )
30  
-       );
31  
-is( $cds[1]->title, 'Forkful of bees', 'search_related with abstract query ok' );
32  
-
33  
-# creating a related object
34  
-if ($INC{'DBICTest/HelperRels.pm'}) {
35  
-  $artist->add_to_cds({ title => 'Big Flop', year => 2005 });
36  
-} else {
37  
-  $artist->create_related( 'cds', {
38  
-      title => 'Big Flop',
39  
-      year => 2005,
40  
-  } );
41  
-}
42  
-
43  
-is( ($artist->search_related('cds'))[3]->title, 'Big Flop', 'create_related ok' );
44  
-
45  
-my( $rs_from_list ) = $artist->search_related_rs('cds');
46  
-is( ref($rs_from_list), 'DBIx::Class::ResultSet', 'search_related_rs in list context returns rs' );
47  
-
48  
-( $rs_from_list ) = $artist->cds_rs();
49  
-is( ref($rs_from_list), 'DBIx::Class::ResultSet', 'relation_rs in list context returns rs' );
50  
-
51  
-# count_related
52  
-is( $artist->count_related('cds'), 4, 'count_related ok' );
53  
-
54  
-# set_from_related
55  
-my $track = $schema->resultset("Track")->create( {
56  
-  trackid => 1,
57  
-  cd => 3,
58  
-  position => 98,
59  
-  title => 'Hidden Track'
60  
-} );
61  
-$track->set_from_related( cd => $cd );
62  
-
63  
-is($track->disc->cdid, 4, 'set_from_related ok, including alternative accessor' );
64  
-
65  
-$track->set_from_related( cd => undef );
66  
-
67  
-ok( !defined($track->cd), 'set_from_related with undef ok');
68  
-
69  
-
70  
-# update_from_related, the same as set_from_related, but it calls update afterwards
71  
-$track = $schema->resultset("Track")->create( {
72  
-  trackid => 2,
73  
-  cd => 3,
74  
-  position => 99,
75  
-  title => 'Hidden Track'
76  
-} );
77  
-$track->update_from_related( cd => $cd );
78  
-
79  
-my $t_cd = ($schema->resultset("Track")->search( cd => 4, position => 99 ))[0]->cd;
80  
-
81  
-is( $t_cd->cdid, 4, 'update_from_related ok' );
82  
-
83  
-# find_or_create_related with an existing record
84  
-$cd = $artist->find_or_create_related( 'cds', { title => 'Big Flop' } );
85  
-is( $cd->year, 2005, 'find_or_create_related on existing record ok' );
86  
-
87  
-# find_or_create_related creating a new record
88  
-$cd = $artist->find_or_create_related( 'cds', {
89  
-  title => 'Greatest Hits',
90  
-  year => 2006,
91  
-} );
92  
-is( $cd->title, 'Greatest Hits', 'find_or_create_related new record ok' );
93  
-@cds = $artist->search_related('cds');
94  
-is( ($artist->search_related('cds'))[4]->title, 'Greatest Hits', 'find_or_create_related new record search ok' );
95  
-
96  
-$artist->delete_related( cds => { title => 'Greatest Hits' });
97  
-cmp_ok( $schema->resultset("CD")->search( title => 'Greatest Hits' ), '==', 0, 'delete_related ok' );
98  
-
99  
-# find_or_new_related with an existing record
100  
-$cd = $artist->find_or_new_related( 'cds', { title => 'Big Flop' } );
101  
-is( $cd->year, 2005, 'find_or_new_related on existing record ok' );
102  
-ok( $cd->in_storage, 'find_or_new_related on existing record: is in_storage' );
103  
-
104  
-# find_or_new_related instantiating a new record
105  
-$cd = $artist->find_or_new_related( 'cds', {
106  
-  title => 'Greatest Hits 2: Louder Than Ever',
107  
-  year => 2007,
108  
-} );
109  
-is( $cd->title, 'Greatest Hits 2: Louder Than Ever', 'find_or_new_related new record ok' );
110  
-ok( ! $cd->in_storage, 'find_or_new_related on a new record: not in_storage' );
111  
-
112  
-SKIP: {
113  
-  skip "relationship checking needs fixing", 1;
114  
-  # try to add a bogus relationship using the wrong cols
115  
-  eval {
116  
-      DBICTest::Schema::Artist->add_relationship(
117  
-          tracks => 'DBICTest::Schema::Track',
118  
-          { 'foreign.cd' => 'self.cdid' }
119  
-      );
120  
-  };
121  
-  like($@, qr/Unknown column/, 'failed when creating a rel with invalid key, ok');
122  
-}
123  
-  
124  
-# another bogus relationship using no join condition
125  
-eval {
126  
-    DBICTest::Schema::Artist->add_relationship( tracks => 'DBICTest::Track' );
127  
-};
128  
-like($@, qr/join condition/, 'failed when creating a rel without join condition, ok');
129  
-
130  
-# many_to_many helper test
131  
-$cd = $schema->resultset("CD")->find(1);
132  
-my @producers = $cd->producers();
133  
-is( $producers[0]->name, 'Matt S Trout', 'many_to_many ok' );
134  
-is( $cd->producers_sorted->next->name, 'Bob The Builder', 'sorted many_to_many ok' );
135  
-is( $cd->producers_sorted(producerid => 3)->next->name, 'Fred The Phenotype', 'sorted many_to_many with search condition ok' );
136  
-
137  
-# test undirected many-to-many relationship (e.g. "related artists")
138  
-my $undir_maps = $schema->resultset("Artist")->find(1)->artist_undirected_maps;
139  
-is($undir_maps->count, 1, 'found 1 undirected map for artist 1');
140  
-
141  
-$undir_maps = $schema->resultset("Artist")->find(2)->artist_undirected_maps;
142  
-is($undir_maps->count, 1, 'found 1 undirected map for artist 2');
143  
-
144  
-my $mapped_rs = $undir_maps->search_related('mapped_artists');
145  
-
146  
-my @art = $mapped_rs->all;
147  
-
148  
-cmp_ok(@art, '==', 2, "Both artist returned from map");
149  
-
150  
-my $searched = $mapped_rs->search({'mapped_artists.artistid' => {'!=', undef}});
151  
-
152  
-cmp_ok($searched->count, '==', 2, "Both artist returned from map after adding another condition");
153  
-
154  
-# check join through cascaded has_many relationships
155  
-$artist = $schema->resultset("Artist")->find(1);
156  
-my $trackset = $artist->cds->search_related('tracks');
157  
-# LEFT join means we also see the trackless additional album...
158  
-cmp_ok($trackset->count, '==', 11, "Correct number of tracks for artist");
159  
-
160  
-# now see about updating eveything that belongs to artist 2 to artist 3
161  
-$artist = $schema->resultset("Artist")->find(2);
162  
-my $nartist = $schema->resultset("Artist")->find(3);
163  
-cmp_ok($artist->cds->count, '==', 1, "Correct orig #cds for artist");
164  
-cmp_ok($nartist->cds->count, '==', 1, "Correct orig #cds for artist");
165  
-$artist->cds->update({artist => $nartist->id});
166  
-cmp_ok($artist->cds->count, '==', 0, "Correct new #cds for artist");
167  
-cmp_ok($nartist->cds->count, '==', 2, "Correct new #cds for artist");
168  
-
70  t/run/07pager.tl
... ...
@@ -1,70 +0,0 @@
1  
-use strict;
2  
-use warnings;  
3  
-
4  
-use Test::More;
5  
-use lib qw(t/lib);
6  
-use DBICTest;
7  
-
8  
-my $schema = DBICTest::init_schema();
9  
-
10  
-plan tests => 12;
11  
-
12  
-# first page
13  
-my $it = $schema->resultset("CD")->search(
14  
-    {},
15  
-    { order_by => 'title',
16  
-      rows => 3,
17  
-      page => 1 }
18  
-);
19  
-
20  
-is( $it->pager->entries_on_this_page, 3, "entries_on_this_page ok" );
21  
-
22  
-is( $it->pager->next_page, 2, "next_page ok" );
23  
-
24  
-is( $it->count, 3, "count on paged rs ok" );
25  
-
26  
-is( $it->next->title, "Caterwaulin' Blues", "iterator->next ok" );
27  
-
28  
-$it->next;
29  
-$it->next;
30  
-
31  
-is( $it->next, undef, "next past end of page ok" );
32  
-
33  
-# second page, testing with array
34  
-my @page2 = $schema->resultset("CD")->search( 
35  
-    {},
36  
-    { order_by => 'title',
37  
-      rows => 3,
38  
-      page => 2 }
39  
-);
40  
-
41  
-is( $page2[0]->title, "Generic Manufactured Singles", "second page first title ok" );
42  
-
43  
-# page a standard resultset
44  
-$it = $schema->resultset("CD")->search(
45  
-  {},
46  
-  { order_by => 'title',
47  
-    rows => 3 }
48  
-);
49  
-my $page = $it->page(2);
50  
-
51  
-is( $page->count, 2, "standard resultset paged rs count ok" );
52  
-
53  
-is( $page->next->title, "Generic Manufactured Singles", "second page of standard resultset ok" );
54  
-
55  
-# test software-based limit paging
56  
-$it = $schema->resultset("CD")->search(
57  
-  {},
58  
-  { order_by => 'title',
59  
-    rows => 3,
60  
-    page => 2,
61  
-    software_limit => 1 }
62  
-);
63  
-is( $it->pager->entries_on_this_page, 2, "software entries_on_this_page ok" );
64  
-
65  
-is( $it->pager->previous_page, 1, "software previous_page ok" );
66  
-
67  
-is( $it->count, 2, "software count on paged rs ok" );
68  
-
69  
-is( $it->next->title, "Generic Manufactured Singles", "software iterator->next ok" );
70  
-
35  t/run/08inflate.tl
... ...
@@ -1,35 +0,0 @@
1  
-use strict;
2  
-use warnings;  
3  
-
4  
-use Test::More;
5  
-use lib qw(t/lib);
6  
-use DBICTest;
7  
-
8  
-my $schema = DBICTest::init_schema();
9  
-
10  
-eval { require DateTime };
11  
-plan skip_all => "Need DateTime for inflation tests" if $@;
12