|
@@ -6,6 +6,7 @@ use Muzich\CoreBundle\lib\FunctionalTest;
|
6
|
6
|
use Muzich\CoreBundle\Tests\lib\Security\Context as SecurityContextTest;
|
7
|
7
|
use Muzich\CoreBundle\Security\Context as SecurityContext;
|
8
|
8
|
use Muzich\CoreBundle\Tests\lib\Security\ContextTestCases;
|
|
9
|
+use Muzich\CoreBundle\lib\Collection\ElementCollectionManager;
|
9
|
10
|
|
10
|
11
|
class PlaylistControllerTest extends FunctionalTest
|
11
|
12
|
{
|
|
@@ -269,4 +270,48 @@ class PlaylistControllerTest extends FunctionalTest
|
269
|
270
|
}
|
270
|
271
|
}
|
271
|
272
|
|
|
273
|
+ public function testUpdateOrder()
|
|
274
|
+ {
|
|
275
|
+ $this->init();
|
|
276
|
+ $this->initOrderContextData();
|
|
277
|
+ $this->connectUser('bux', 'toor');
|
|
278
|
+
|
|
279
|
+ $this->checkPlaylistOrder($this->playlists['bux_2_priv'], array(
|
|
280
|
+ $this->elements['heretik'], $this->elements['fab']
|
|
281
|
+ ));
|
|
282
|
+ $this->updatePlaylistOrder($this->playlists['bux_2_priv'], array(
|
|
283
|
+ $this->elements['fab'], $this->elements['heretik']
|
|
284
|
+ ));
|
|
285
|
+ $this->playlists['bux_2_priv'] = $this->findOneBy('Playlist', 'Ma playlist perso');
|
|
286
|
+ $this->checkPlaylistOrder($this->playlists['bux_2_priv'], array(
|
|
287
|
+ $this->elements['fab'], $this->elements['heretik']
|
|
288
|
+ ));
|
|
289
|
+ }
|
|
290
|
+
|
|
291
|
+ protected function initOrderContextData()
|
|
292
|
+ {
|
|
293
|
+ $this->initReadContextData();
|
|
294
|
+ $this->elements['heretik'] = $this->findOneBy('Element', 'Heretik System Popof - Resistance');
|
|
295
|
+ $this->elements['fab'] = $this->findOneBy('Element', 'DJ FAB');
|
|
296
|
+ }
|
|
297
|
+
|
|
298
|
+ protected function checkPlaylistOrder($playlist, $elements)
|
|
299
|
+ {
|
|
300
|
+ $collection_manager = new ElementCollectionManager(array());
|
|
301
|
+
|
|
302
|
+ foreach ($elements as $element)
|
|
303
|
+ {
|
|
304
|
+ $collection_manager->add($element);
|
|
305
|
+ }
|
|
306
|
+
|
|
307
|
+ $this->assertEquals($collection_manager->getContent(), $playlist->getelements());
|
|
308
|
+ }
|
|
309
|
+
|
|
310
|
+ protected function updatePlaylistOrder($playlist, $elements)
|
|
311
|
+ {
|
|
312
|
+ $response = $this->tests_cases->playlistUpdateOrder($playlist->getId(), $elements);
|
|
313
|
+ $this->outputDebug();
|
|
314
|
+ $this->jsonResponseIsSuccess($response);
|
|
315
|
+ }
|
|
316
|
+
|
272
|
317
|
}
|