|
7 | 7 | use Diff\DiffOp\DiffOpChange; |
8 | 8 | use Diff\DiffOp\DiffOpRemove; |
9 | 9 | use Wikibase\DataModel\Claim\Claims; |
10 | | -use Wikibase\DataModel\Entity\Diff\ItemDiff; |
11 | 10 | use Wikibase\DataModel\Entity\Item; |
12 | 11 | use Wikibase\DataModel\Entity\ItemId; |
13 | 12 | use Wikibase\DataModel\Entity\PropertyId; |
@@ -95,283 +94,6 @@ public function itemProvider() { |
95 | 94 | return $argLists; |
96 | 95 | } |
97 | 96 |
|
98 | | - public function diffProvider() { |
99 | | - $argLists = parent::diffProvider(); |
100 | | - |
101 | | - // Addition of a sitelink |
102 | | - $entity0 = $this->getNewEmpty(); |
103 | | - $entity1 = $this->getNewEmpty(); |
104 | | - $entity1->getSiteLinkList()->addSiteLink( new SiteLink( 'enwiki', 'Berlin' ) ); |
105 | | - |
106 | | - $expected = new ItemDiff( array( |
107 | | - 'links' => new Diff( array( |
108 | | - 'enwiki' => new Diff( array( |
109 | | - 'page' => new DiffOpAdd( 'Berlin' ) |
110 | | - ), true), |
111 | | - ), true ), |
112 | | - ) ); |
113 | | - |
114 | | - $argLists[] = array( $entity0, $entity1, $expected ); |
115 | | - |
116 | | - |
117 | | - // Addition of badges |
118 | | - $entity0 = $this->getNewEmpty(); |
119 | | - $entity0->getSiteLinkList()->addSiteLink( |
120 | | - new SiteLink( |
121 | | - 'enwiki', |
122 | | - 'Berlin', |
123 | | - array( |
124 | | - new ItemId( 'Q42' ) |
125 | | - ) |
126 | | - ) |
127 | | - ); |
128 | | - $entity1 = $this->getNewEmpty(); |
129 | | - $entity1->getSiteLinkList()->addSiteLink( |
130 | | - new SiteLink( |
131 | | - 'enwiki', |
132 | | - 'Berlin', |
133 | | - array( |
134 | | - new ItemId( 'Q42' ), |
135 | | - new ItemId( 'Q3' ) |
136 | | - ) |
137 | | - ) |
138 | | - ); |
139 | | - |
140 | | - $expected = new ItemDiff( array( |
141 | | - 'links' => new Diff( array( |
142 | | - 'enwiki' => new Diff( array( |
143 | | - 'badges' => new Diff( array( |
144 | | - new DiffOpAdd( 'Q3' ) |
145 | | - ), false ), |
146 | | - ), true ), |
147 | | - ), true ), |
148 | | - ) ); |
149 | | - |
150 | | - $argLists[] = array( $entity0, $entity1, $expected ); |
151 | | - |
152 | | - |
153 | | - // Addition of a sitelink with badges |
154 | | - $entity0 = $this->getNewEmpty(); |
155 | | - $entity1 = $this->getNewEmpty(); |
156 | | - $entity1->getSiteLinkList()->addSiteLink( |
157 | | - new SiteLink( |
158 | | - 'enwiki', |
159 | | - 'Berlin', |
160 | | - array( |
161 | | - new ItemId( 'Q42' ) |
162 | | - ) |
163 | | - ) |
164 | | - ); |
165 | | - |
166 | | - $expected = new ItemDiff( array( |
167 | | - 'links' => new Diff( array( |
168 | | - 'enwiki' => new Diff( array( |
169 | | - 'page' => new DiffOpAdd( 'Berlin' ), |
170 | | - 'badges' => new Diff( array( |
171 | | - new DiffOpAdd( 'Q42' ) |
172 | | - ), false ), |
173 | | - ), true ), |
174 | | - ), true ), |
175 | | - ) ); |
176 | | - |
177 | | - $argLists[] = array( $entity0, $entity1, $expected ); |
178 | | - |
179 | | - |
180 | | - // Removal of a sitelink |
181 | | - $entity0 = $this->getNewEmpty(); |
182 | | - $entity0->getSiteLinkList()->addSiteLink( new SiteLink( 'enwiki', 'Berlin' ) ); |
183 | | - $entity1 = $this->getNewEmpty(); |
184 | | - |
185 | | - $expected = new ItemDiff( array( |
186 | | - 'links' => new Diff( array( |
187 | | - 'enwiki' => new Diff( array( |
188 | | - 'page' => new DiffOpRemove( 'Berlin' ), |
189 | | - ), true ), |
190 | | - ), true ), |
191 | | - ) ); |
192 | | - |
193 | | - $argLists[] = array( $entity0, $entity1, $expected ); |
194 | | - |
195 | | - |
196 | | - // Removal of badges |
197 | | - $entity0 = $this->getNewEmpty(); |
198 | | - $entity0->getSiteLinkList()->addSiteLink( |
199 | | - new SiteLink( |
200 | | - 'enwiki', |
201 | | - 'Berlin', |
202 | | - array( |
203 | | - new ItemId( 'Q42' ), |
204 | | - new ItemId( 'Q3' ) |
205 | | - ) |
206 | | - ) |
207 | | - ); |
208 | | - $entity1 = $this->getNewEmpty(); |
209 | | - $entity1->getSiteLinkList()->addSiteLink( |
210 | | - new SiteLink( |
211 | | - 'enwiki', |
212 | | - 'Berlin', |
213 | | - array( |
214 | | - new ItemId( 'Q42' ) |
215 | | - ) |
216 | | - ) |
217 | | - ); |
218 | | - |
219 | | - $expected = new ItemDiff( array( |
220 | | - 'links' => new Diff( array( |
221 | | - 'enwiki' => new Diff( array( |
222 | | - 'badges' => new Diff( array( |
223 | | - new DiffOpRemove( 'Q3' ) |
224 | | - ), false ), |
225 | | - ), true ), |
226 | | - ), true ), |
227 | | - ) ); |
228 | | - |
229 | | - $argLists[] = array( $entity0, $entity1, $expected ); |
230 | | - |
231 | | - |
232 | | - // Removal of sitelink with badges |
233 | | - $entity0 = $this->getNewEmpty(); |
234 | | - $entity0->getSiteLinkList()->addSiteLink( |
235 | | - new SiteLink( |
236 | | - 'enwiki', |
237 | | - 'Berlin', |
238 | | - array( |
239 | | - new ItemId( 'Q42' ), |
240 | | - new ItemId( 'Q3' ) |
241 | | - ) |
242 | | - ) |
243 | | - ); |
244 | | - $entity1 = $this->getNewEmpty(); |
245 | | - |
246 | | - $expected = new ItemDiff( array( |
247 | | - 'links' => new Diff( array( |
248 | | - 'enwiki' => new Diff( array( |
249 | | - 'name' => new DiffOpRemove( 'Berlin' ), |
250 | | - 'badges' => new Diff( array( |
251 | | - new DiffOpRemove( 'Q42' ), |
252 | | - new DiffOpRemove( 'Q3' ) |
253 | | - ), false ), |
254 | | - ), true ), |
255 | | - ), true ), |
256 | | - ) ); |
257 | | - |
258 | | - $argLists[] = array( $entity0, $entity1, $expected ); |
259 | | - |
260 | | - |
261 | | - // Modification of a sitelink |
262 | | - $entity0 = $this->getNewEmpty(); |
263 | | - $entity0->getSiteLinkList()->addSiteLink( |
264 | | - new SiteLink( |
265 | | - 'enwiki', |
266 | | - 'Berlin', |
267 | | - array( |
268 | | - new ItemId( 'Q42' ), |
269 | | - new ItemId( 'Q3' ) |
270 | | - ) |
271 | | - ) |
272 | | - ); |
273 | | - $entity1 = $this->getNewEmpty(); |
274 | | - $entity1->getSiteLinkList()->addSiteLink( |
275 | | - new SiteLink( |
276 | | - 'enwiki', |
277 | | - 'Foobar', |
278 | | - array( |
279 | | - new ItemId( 'Q42' ), |
280 | | - new ItemId( 'Q3' ) |
281 | | - ) |
282 | | - ) |
283 | | - ); |
284 | | - |
285 | | - $expected = new ItemDiff( array( |
286 | | - 'links' => new Diff( array( |
287 | | - 'enwiki' => new Diff( array( |
288 | | - 'name' => new DiffOpChange( 'Berlin', 'Foobar' ), |
289 | | - ), true ), |
290 | | - ), true ), |
291 | | - ) ); |
292 | | - |
293 | | - $argLists[] = array( $entity0, $entity1, $expected ); |
294 | | - |
295 | | - |
296 | | - // Modification of badges |
297 | | - $entity0 = $this->getNewEmpty(); |
298 | | - $entity0->getSiteLinkList()->addSiteLink( |
299 | | - new SiteLink( |
300 | | - 'enwiki', |
301 | | - 'Berlin', |
302 | | - array( |
303 | | - new ItemId( 'Q42' ), |
304 | | - new ItemId( 'Q3' ) |
305 | | - ) |
306 | | - ) |
307 | | - ); |
308 | | - $entity1 = $this->getNewEmpty(); |
309 | | - $entity1->getSiteLinkList()->addSiteLink( |
310 | | - new SiteLink( |
311 | | - 'enwiki', |
312 | | - 'Berlin', |
313 | | - array( |
314 | | - new ItemId( 'Q42' ), |
315 | | - new ItemId( 'Q4' ) |
316 | | - ) |
317 | | - ) |
318 | | - ); |
319 | | - |
320 | | - $expected = new ItemDiff( array( |
321 | | - 'links' => new Diff( array( |
322 | | - 'enwiki' => new Diff( array( |
323 | | - 'badges' => new Diff( array( |
324 | | - new DiffOpRemove( 'Q3' ), |
325 | | - new DiffOpAdd( 'Q4' ) |
326 | | - ), false ), |
327 | | - ), true ), |
328 | | - ), true ), |
329 | | - ) ); |
330 | | - |
331 | | - $argLists[] = array( $entity0, $entity1, $expected ); |
332 | | - |
333 | | - |
334 | | - // Modification of a sitelink and badges |
335 | | - $entity0 = $this->getNewEmpty(); |
336 | | - $entity0->getSiteLinkList()->addSiteLink( |
337 | | - new SiteLink( |
338 | | - 'enwiki', |
339 | | - 'Berlin', |
340 | | - array( |
341 | | - new ItemId( 'Q42' ), |
342 | | - new ItemId( 'Q3' ) |
343 | | - ) |
344 | | - ) |
345 | | - ); |
346 | | - $entity1 = $this->getNewEmpty(); |
347 | | - $entity1->getSiteLinkList()->addSiteLink( |
348 | | - new SiteLink( |
349 | | - 'enwiki', |
350 | | - 'Foobar', |
351 | | - array( |
352 | | - new ItemId( 'Q42' ), |
353 | | - new ItemId( 'Q4' ) |
354 | | - ) |
355 | | - ) |
356 | | - ); |
357 | | - |
358 | | - $expected = new ItemDiff( array( |
359 | | - 'links' => new Diff( array( |
360 | | - 'enwiki' => new Diff( array( |
361 | | - 'name' => new DiffOpChange( 'Berlin', 'Foobar' ), |
362 | | - 'badges' => new Diff( array( |
363 | | - new DiffOpRemove( 'Q3' ), |
364 | | - new DiffOpAdd( 'Q4' ) |
365 | | - ), false ), |
366 | | - ), true ), |
367 | | - ), true ), |
368 | | - ) ); |
369 | | - |
370 | | - $argLists[] = array( $entity0, $entity1, $expected ); |
371 | | - |
372 | | - return $argLists; |
373 | | - } |
374 | | - |
375 | 97 | public function testGetSiteLinkWithNonSetSiteId() { |
376 | 98 | $item = new Item(); |
377 | 99 |
|
|
0 commit comments