|
@@ -335,4 +335,75 @@ class ElementSearcherTest extends UnitTest
|
335
|
335
|
|
336
|
336
|
}
|
337
|
337
|
|
|
338
|
+ public function testTagStrict()
|
|
339
|
+ {
|
|
340
|
+ $r = $this->getDoctrine();
|
|
341
|
+ $bux = $r->getRepository('MuzichCoreBundle:User')
|
|
342
|
+ ->findOneByUsername('bux')
|
|
343
|
+ ;
|
|
344
|
+ $hardtek = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Hardtek');
|
|
345
|
+ $tribe = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Tribe');
|
|
346
|
+ $electro = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Electro');
|
|
347
|
+ $metal = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Metal');
|
|
348
|
+ $hardcore = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Hardcore');
|
|
349
|
+ $psytrance = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Psytrance');
|
|
350
|
+ $dubstep = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Dubstep');
|
|
351
|
+
|
|
352
|
+ $es = new ElementSearcher();
|
|
353
|
+ $es->init(array(
|
|
354
|
+ 'network' => ElementSearcher::NETWORK_PUBLIC,
|
|
355
|
+ 'tags' => array(
|
|
356
|
+ $hardtek->getId() => 'Hardtek',
|
|
357
|
+ $tribe->getId() => 'Tribe'
|
|
358
|
+ ),
|
|
359
|
+ 'count' => 5,
|
|
360
|
+ 'tag_strict' => true
|
|
361
|
+ ));
|
|
362
|
+
|
|
363
|
+ $this->checkElementSearchResults(
|
|
364
|
+ $es->getElements($r, $bux->getId()),
|
|
365
|
+ array(
|
|
366
|
+ 0 => 'All Is Full Of Pain',
|
|
367
|
+ 1 => 'Dj antoine'
|
|
368
|
+ )
|
|
369
|
+ );
|
|
370
|
+
|
|
371
|
+ $es = new ElementSearcher();
|
|
372
|
+ $es->init(array(
|
|
373
|
+ 'network' => ElementSearcher::NETWORK_PUBLIC,
|
|
374
|
+ 'tags' => array(
|
|
375
|
+ $electro->getId() => 'Electro',
|
|
376
|
+ $hardtek->getId() => 'Hardtek'
|
|
377
|
+ ),
|
|
378
|
+ 'count' => 5,
|
|
379
|
+ 'tag_strict' => true
|
|
380
|
+ ));
|
|
381
|
+
|
|
382
|
+ $this->checkElementSearchResults(
|
|
383
|
+ $es->getElements($r, $bux->getId()),
|
|
384
|
+ array(
|
|
385
|
+ 'KoinkOin - H5N1'
|
|
386
|
+ )
|
|
387
|
+ );
|
|
388
|
+
|
|
389
|
+ $es = new ElementSearcher();
|
|
390
|
+ $es->init(array(
|
|
391
|
+ 'network' => ElementSearcher::NETWORK_PUBLIC,
|
|
392
|
+ 'tags' => array(
|
|
393
|
+ $metal->getId() => 'Metal',
|
|
394
|
+ $hardcore->getId() => 'Hardcore'
|
|
395
|
+ ),
|
|
396
|
+ 'count' => 5,
|
|
397
|
+ 'tag_strict' => true
|
|
398
|
+ ));
|
|
399
|
+
|
|
400
|
+ $this->checkElementSearchResults(
|
|
401
|
+ $es->getElements($r, $bux->getId()),
|
|
402
|
+ array(
|
|
403
|
+ 'Babylon Pression - Des Tasers et des Pauvres'
|
|
404
|
+ )
|
|
405
|
+ );
|
|
406
|
+
|
|
407
|
+ }
|
|
408
|
+
|
338
|
409
|
}
|