| 
				
			 | 
			
			
				@@ -209,4 +209,64 @@ class PlaylistControllerTest extends FunctionalTest 
			 | 
		
	
		
			
			| 
				209
			 | 
			
				209
			 | 
			
			
				     return $playlist; 
			 | 
		
	
		
			
			| 
				210
			 | 
			
				210
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				211
			 | 
			
				211
			 | 
			
			
				    
			 | 
		
	
		
			
			| 
				
			 | 
			
				212
			 | 
			
			
				+  public function testAutoplayDatas() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				213
			 | 
			
			
				+  { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				214
			 | 
			
			
				+    $this->init(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				215
			 | 
			
			
				+    $this->initReadContextData(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				216
			 | 
			
			
				+     
			 | 
		
	
		
			
			| 
				
			 | 
			
				217
			 | 
			
			
				+    $this->checkPublicPlaylist(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				218
			 | 
			
			
				+    $this->checkPrivatePlaylist(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				219
			 | 
			
			
				+    $this->connectUser('bob', 'toor'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				220
			 | 
			
			
				+    $this->checkPublicPlaylist(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				221
			 | 
			
			
				+    $this->checkPrivatePlaylist(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				222
			 | 
			
			
				+    $this->disconnectUser(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				223
			 | 
			
			
				+    $this->connectUser('bux', 'toor'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				224
			 | 
			
			
				+    $this->checkPublicPlaylist(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				225
			 | 
			
			
				+    $this->checkPrivatePlaylist(true); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				226
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				227
			 | 
			
			
				+   
			 | 
		
	
		
			
			| 
				
			 | 
			
				228
			 | 
			
			
				+  protected function checkPublicPlaylist() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				229
			 | 
			
			
				+  { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				230
			 | 
			
			
				+    $response = $this->tests_cases->playlistAutoplay($this->playlists['bux_1_pub']->getId()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				231
			 | 
			
			
				+    $this->jsonResponseIsSuccess($response); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				232
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				233
			 | 
			
			
				+   
			 | 
		
	
		
			
			| 
				
			 | 
			
				234
			 | 
			
			
				+  protected function checkPrivatePlaylist($success = false) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				235
			 | 
			
			
				+  { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				236
			 | 
			
			
				+    $response = $this->tests_cases->playlistAutoplay($this->playlists['bux_2_priv']->getId()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				237
			 | 
			
			
				+     
			 | 
		
	
		
			
			| 
				
			 | 
			
				238
			 | 
			
			
				+    if (!$success) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				239
			 | 
			
			
				+      $this->jsonResponseIsError($response); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				240
			 | 
			
			
				+    if ($success) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				241
			 | 
			
			
				+      $this->jsonResponseIsSuccess($response); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				242
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				243
			 | 
			
			
				+   
			 | 
		
	
		
			
			| 
				
			 | 
			
				244
			 | 
			
			
				+  public function testPrompt() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				245
			 | 
			
			
				+  { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				246
			 | 
			
			
				+    $this->init(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				247
			 | 
			
			
				+    $this->initCreateContextData(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				248
			 | 
			
			
				+     
			 | 
		
	
		
			
			| 
				
			 | 
			
				249
			 | 
			
			
				+    $this->setCrawlerWithJsonResponseData($this->tests_cases->playlistPrompt($this->elements['babylon']->getId())); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				250
			 | 
			
			
				+    $this->checkPlaylistsInPrompt(array()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				251
			 | 
			
			
				+     
			 | 
		
	
		
			
			| 
				
			 | 
			
				252
			 | 
			
			
				+    $this->connectUser('bux', 'toor'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				253
			 | 
			
			
				+     
			 | 
		
	
		
			
			| 
				
			 | 
			
				254
			 | 
			
			
				+    $this->setCrawlerWithJsonResponseData($this->tests_cases->playlistPrompt($this->elements['babylon']->getId())); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				255
			 | 
			
			
				+     
			 | 
		
	
		
			
			| 
				
			 | 
			
				256
			 | 
			
			
				+    $this->checkPlaylistsInPrompt(array( 
			 | 
		
	
		
			
			| 
				
			 | 
			
				257
			 | 
			
			
				+      $this->playlists['bux_1_pub'], 
			 | 
		
	
		
			
			| 
				
			 | 
			
				258
			 | 
			
			
				+      $this->playlists['bux_2_priv'], 
			 | 
		
	
		
			
			| 
				
			 | 
			
				259
			 | 
			
			
				+      $this->playlists['bob_pub'], 
			 | 
		
	
		
			
			| 
				
			 | 
			
				260
			 | 
			
			
				+    )); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				261
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				262
			 | 
			
			
				+   
			 | 
		
	
		
			
			| 
				
			 | 
			
				263
			 | 
			
			
				+  protected function checkPlaylistsInPrompt($playlists) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				264
			 | 
			
			
				+  { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				265
			 | 
			
			
				+    $this->assertEquals(count($playlists), $this->crawler->filter('ul.playlists_for_element li.playlist')->count()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				266
			 | 
			
			
				+    foreach ($playlists as $playlist) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				267
			 | 
			
			
				+    { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				268
			 | 
			
			
				+      $this->exist('a:contains("'.$playlist->getName().'")'); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				269
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				270
			 | 
			
			
				+  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				271
			 | 
			
			
				+   
			 | 
		
	
		
			
			| 
				212
			 | 
			
				272
			 | 
			
			
				 } 
			 |