Commit | Line | Data |
ecfc76d5 |
1 | use strict; |
2 | use warnings; |
3 | use Test::More; |
4 | |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | |
8 | my $schema = DBICTest->init_schema( no_connect => 1, no_deploy => 1 ); |
9 | |
e9bab9d0 |
10 | use Devel::Dwarn; |
11 | |
ecfc76d5 |
12 | is_deeply($schema->source_tree, { |
d092eb1f |
13 | Artist => {}, |
14 | ArtistSubclass => {}, |
15 | ArtistUndirectedMap => { |
e9bab9d0 |
16 | Artist => 1 |
ecfc76d5 |
17 | }, |
d092eb1f |
18 | Artwork => { |
e9bab9d0 |
19 | CD => 1, |
20 | Genre => 1, |
21 | Track => 1 |
d092eb1f |
22 | }, |
23 | Artwork_to_Artist => { |
e9bab9d0 |
24 | Artist => 1, |
25 | Artwork => 1, |
26 | CD => 1, |
27 | Genre => 1, |
28 | Track => 1 |
ecfc76d5 |
29 | }, |
d092eb1f |
30 | BindType => {}, |
31 | Bookmark => { |
e9bab9d0 |
32 | Link => 1 |
ecfc76d5 |
33 | }, |
d092eb1f |
34 | BooksInLibrary => { |
e9bab9d0 |
35 | Owners => 1 |
ecfc76d5 |
36 | }, |
d092eb1f |
37 | CD => { |
e9bab9d0 |
38 | Genre => 1, |
39 | Track => 1 |
ecfc76d5 |
40 | }, |
d092eb1f |
41 | CD_to_Producer => { |
e9bab9d0 |
42 | CD => 1, |
43 | Genre => 1, |
44 | Producer => 1, |
45 | Track => 1 |
ecfc76d5 |
46 | }, |
d092eb1f |
47 | Collection => {}, |
48 | CollectionObject => { |
e9bab9d0 |
49 | Collection => 1, |
50 | TypedObject => 1 |
ecfc76d5 |
51 | }, |
d092eb1f |
52 | CustomSql => {}, |
53 | Dummy => {}, |
54 | Employee => { |
e9bab9d0 |
55 | Encoded => 1 |
ecfc76d5 |
56 | }, |
d092eb1f |
57 | Encoded => {}, |
58 | Event => {}, |
59 | EventTZ => {}, |
60 | ForceForeign => { |
e9bab9d0 |
61 | Artist => 1 |
ecfc76d5 |
62 | }, |
d092eb1f |
63 | FourKeys => {}, |
64 | FourKeys_to_TwoKeys => { |
e9bab9d0 |
65 | Artist => 1, |
66 | CD => 1, |
67 | FourKeys => 1, |
68 | Genre => 1, |
69 | Track => 1, |
70 | TwoKeys => 1 |
ecfc76d5 |
71 | }, |
d092eb1f |
72 | Genre => {}, |
73 | Image => { |
e9bab9d0 |
74 | Artwork => 1, |
75 | CD => 1, |
76 | Genre => 1, |
77 | Track => 1 |
ecfc76d5 |
78 | }, |
d092eb1f |
79 | LinerNotes => { |
e9bab9d0 |
80 | CD => 1, |
81 | Genre => 1, |
82 | Track => 1 |
ecfc76d5 |
83 | }, |
d092eb1f |
84 | Link => {}, |
85 | LyricVersion => { |
e9bab9d0 |
86 | CD => 1, |
87 | Lyrics => 1, |
88 | Track => 1 |
ecfc76d5 |
89 | }, |
d092eb1f |
90 | Lyrics => { |
e9bab9d0 |
91 | CD => 1, |
92 | Track => 1 |
ecfc76d5 |
93 | }, |
d092eb1f |
94 | Money => {}, |
95 | NoPrimaryKey => {}, |
96 | OneKey => {}, |
97 | Owners => {}, |
98 | Producer => {}, |
99 | SelfRef => {}, |
100 | SelfRefAlias => { |
e9bab9d0 |
101 | SelfRef => 1 |
ecfc76d5 |
102 | }, |
d092eb1f |
103 | SequenceTest => {}, |
104 | Serialized => {}, |
105 | SourceNameArtists => {}, |
106 | Tag => { |
e9bab9d0 |
107 | CD => 1, |
108 | Genre => 1, |
109 | Track => 1 |
ecfc76d5 |
110 | }, |
d092eb1f |
111 | TimestampPrimaryKey => {}, |
112 | Track => { |
e9bab9d0 |
113 | CD => 1 |
ecfc76d5 |
114 | }, |
d092eb1f |
115 | TreeLike => {}, |
116 | TwoKeyTreeLike => {}, |
117 | TwoKeys => { |
e9bab9d0 |
118 | Artist => 1, |
119 | CD => 1, |
120 | Genre => 1, |
121 | Track => 1 |
ecfc76d5 |
122 | }, |
d092eb1f |
123 | TypedObject => {} |
ecfc76d5 |
124 | }, 'got correct source tree'); |
125 | |
d092eb1f |
126 | use Devel::Dwarn; |
127 | |
128 | my $sans_TwoKeys = { |
129 | Artist => {}, |
130 | ArtistSubclass => {}, |
131 | ArtistUndirectedMap => { |
e9bab9d0 |
132 | Artist => 1 |
ecfc76d5 |
133 | }, |
d092eb1f |
134 | Artwork => { |
e9bab9d0 |
135 | CD => 1, |
136 | Genre => 1, |
137 | Track => 1 |
ecfc76d5 |
138 | }, |
d092eb1f |
139 | Artwork_to_Artist => { |
e9bab9d0 |
140 | Artist => 1, |
141 | Artwork => 1, |
142 | CD => 1, |
143 | Genre => 1, |
144 | Track => 1 |
ecfc76d5 |
145 | }, |
d092eb1f |
146 | BindType => {}, |
147 | Bookmark => { |
e9bab9d0 |
148 | Link => 1 |
ecfc76d5 |
149 | }, |
d092eb1f |
150 | BooksInLibrary => { |
e9bab9d0 |
151 | Owners => 1 |
ecfc76d5 |
152 | }, |
d092eb1f |
153 | CD => { |
e9bab9d0 |
154 | Genre => 1, |
155 | Track => 1 |
ecfc76d5 |
156 | }, |
d092eb1f |
157 | CD_to_Producer => { |
e9bab9d0 |
158 | CD => 1, |
159 | Genre => 1, |
160 | Producer => 1, |
161 | Track => 1 |
ecfc76d5 |
162 | }, |
d092eb1f |
163 | Collection => {}, |
164 | CollectionObject => { |
e9bab9d0 |
165 | Collection => 1, |
166 | TypedObject => 1 |
ecfc76d5 |
167 | }, |
d092eb1f |
168 | CustomSql => {}, |
169 | Dummy => {}, |
170 | Employee => { |
e9bab9d0 |
171 | Encoded => 1 |
ecfc76d5 |
172 | }, |
d092eb1f |
173 | Encoded => {}, |
174 | Event => {}, |
175 | EventTZ => {}, |
176 | ForceForeign => { |
e9bab9d0 |
177 | Artist => 1 |
ecfc76d5 |
178 | }, |
d092eb1f |
179 | FourKeys => {}, |
180 | FourKeys_to_TwoKeys => { |
e9bab9d0 |
181 | FourKeys => 1 |
ecfc76d5 |
182 | }, |
d092eb1f |
183 | Genre => {}, |
184 | Image => { |
e9bab9d0 |
185 | Artwork => 1, |
186 | CD => 1, |
187 | Genre => 1, |
188 | Track => 1 |
ecfc76d5 |
189 | }, |
d092eb1f |
190 | LinerNotes => { |
e9bab9d0 |
191 | CD => 1, |
192 | Genre => 1, |
193 | Track => 1 |
ecfc76d5 |
194 | }, |
d092eb1f |
195 | Link => {}, |
196 | LyricVersion => { |
e9bab9d0 |
197 | CD => 1, |
198 | Lyrics => 1, |
199 | Track => 1 |
ecfc76d5 |
200 | }, |
d092eb1f |
201 | Lyrics => { |
e9bab9d0 |
202 | CD => 1, |
203 | Track => 1 |
ecfc76d5 |
204 | }, |
d092eb1f |
205 | Money => {}, |
206 | NoPrimaryKey => {}, |
207 | OneKey => {}, |
208 | Owners => {}, |
209 | Producer => {}, |
210 | SelfRef => {}, |
211 | SelfRefAlias => { |
e9bab9d0 |
212 | SelfRef => 1 |
ecfc76d5 |
213 | }, |
d092eb1f |
214 | SequenceTest => {}, |
215 | Serialized => {}, |
216 | SourceNameArtists => {}, |
217 | Tag => { |
e9bab9d0 |
218 | CD => 1, |
219 | Genre => 1, |
220 | Track => 1 |
ecfc76d5 |
221 | }, |
d092eb1f |
222 | TimestampPrimaryKey => {}, |
223 | Track => { |
e9bab9d0 |
224 | CD => 1 |
ecfc76d5 |
225 | }, |
d092eb1f |
226 | TreeLike => {}, |
227 | TwoKeyTreeLike => {}, |
228 | TypedObject => {} |
229 | }; |
230 | |
231 | is_deeply( |
232 | $schema->source_tree({ limit_sources => ['TwoKeys'] }), |
233 | $sans_TwoKeys, |
234 | 'got correct source tree with limit_sources => [ ... ]', |
235 | ); |
236 | |
237 | is_deeply( |
238 | $schema->source_tree({ limit_sources => { TwoKeys => 1 } }), |
239 | $sans_TwoKeys, |
240 | 'got correct source tree with limit_sources => { ... }', |
241 | ); |
ecfc76d5 |
242 | |
e9bab9d0 |
243 | # We probably also want a "collapsed" tree thingy |
ecfc76d5 |
244 | |
245 | done_testing; |