|
@@ -20,12 +20,12 @@ class PlaylistControllerTest extends FunctionalTest
|
20
|
20
|
$this->tests_cases = new ContextTestCases($this->client, $this);
|
21
|
21
|
}
|
22
|
22
|
|
23
|
|
-// public function testActionsSecurityRoles()
|
24
|
|
-// {
|
25
|
|
-// $this->init();
|
26
|
|
-// $this->checkProhibedActionsForAnonymous();
|
27
|
|
-// $this->checkAutorizedsActionsForAnonymous();
|
28
|
|
-// }
|
|
23
|
+ public function testActionsSecurityRoles()
|
|
24
|
+ {
|
|
25
|
+ $this->init();
|
|
26
|
+ $this->checkProhibedActionsForAnonymous();
|
|
27
|
+ $this->checkAutorizedsActionsForAnonymous();
|
|
28
|
+ }
|
29
|
29
|
|
30
|
30
|
protected function checkProhibedActionsForAnonymous()
|
31
|
31
|
{
|
|
@@ -99,15 +99,15 @@ class PlaylistControllerTest extends FunctionalTest
|
99
|
99
|
);
|
100
|
100
|
}
|
101
|
101
|
|
102
|
|
-// public function testPlaylistsRead()
|
103
|
|
-// {
|
104
|
|
-// $this->init();
|
105
|
|
-// $this->initReadContextData();
|
106
|
|
-//
|
107
|
|
-// $this->checkReadablePlaylistsForAnonymous();
|
108
|
|
-// $this->checkReadablePlaylistsForConnected();
|
109
|
|
-// $this->checkReadablePlaylistsForOwner();
|
110
|
|
-// }
|
|
102
|
+ public function testPlaylistsRead()
|
|
103
|
+ {
|
|
104
|
+ $this->init();
|
|
105
|
+ $this->initReadContextData();
|
|
106
|
+
|
|
107
|
+ $this->checkReadablePlaylistsForAnonymous();
|
|
108
|
+ $this->checkReadablePlaylistsForConnected();
|
|
109
|
+ $this->checkReadablePlaylistsForOwner();
|
|
110
|
+ }
|
111
|
111
|
|
112
|
112
|
protected function initReadContextData()
|
113
|
113
|
{
|
|
@@ -122,7 +122,7 @@ class PlaylistControllerTest extends FunctionalTest
|
122
|
122
|
$this->checkReadPlaylists($this->users['bux'], array($this->playlists['bux_1_pub']));
|
123
|
123
|
}
|
124
|
124
|
|
125
|
|
- protected function checkReadPlaylists($user, $playlists)
|
|
125
|
+ protected function checkReadPlaylists($user, $playlists, $elements = null)
|
126
|
126
|
{
|
127
|
127
|
$this->tests_cases->playlistsShow($user->getSlug());
|
128
|
128
|
$this->isResponseSuccess();
|
|
@@ -132,13 +132,12 @@ class PlaylistControllerTest extends FunctionalTest
|
132
|
132
|
{
|
133
|
133
|
$this->tests_cases->playlistShow($user->getSlug(), $playlist->getId());
|
134
|
134
|
$this->isResponseSuccess();
|
135
|
|
- $this->checkReadPlaylist($playlist);
|
|
135
|
+ $this->checkReadPlaylist($playlist, $elements);
|
136
|
136
|
}
|
137
|
137
|
}
|
138
|
138
|
|
139
|
139
|
protected function checkReadPlaylistsDom($playlists)
|
140
|
140
|
{
|
141
|
|
- $this->outputDebug();
|
142
|
141
|
$this->assertEquals(count($playlists), $this->crawler->filter('ul.playlists li.playlist')->count());
|
143
|
142
|
foreach ($playlists as $playlist)
|
144
|
143
|
{
|
|
@@ -146,9 +145,23 @@ class PlaylistControllerTest extends FunctionalTest
|
146
|
145
|
}
|
147
|
146
|
}
|
148
|
147
|
|
149
|
|
- protected function checkReadPlaylist($playlist)
|
|
148
|
+ protected function checkReadPlaylist($playlist, $elements = null)
|
150
|
149
|
{
|
151
|
150
|
$this->exist('h2:contains("'.$playlist->getName().'")');
|
|
151
|
+
|
|
152
|
+ if ($elements !== null)
|
|
153
|
+ {
|
|
154
|
+ $this->checkPlaylistElements($playlist, $elements[$playlist->getId()]);
|
|
155
|
+ }
|
|
156
|
+ }
|
|
157
|
+
|
|
158
|
+ protected function checkPlaylistElements($playlist, $elements)
|
|
159
|
+ {
|
|
160
|
+ $this->assertEquals(count($elements), $this->crawler->filter('li.playlist_element')->count());
|
|
161
|
+ foreach ($elements as $element)
|
|
162
|
+ {
|
|
163
|
+ $this->exist('a[data-id="'.$element->getId().'"]');
|
|
164
|
+ }
|
152
|
165
|
}
|
153
|
166
|
|
154
|
167
|
protected function checkReadablePlaylistsForConnected()
|
|
@@ -175,7 +188,10 @@ class PlaylistControllerTest extends FunctionalTest
|
175
|
188
|
$this->connectUser('joelle', 'toor');
|
176
|
189
|
|
177
|
190
|
$this->playlists['joelle_1'] = $this->createPlaylistWithElement($this->elements['babylon']);
|
178
|
|
- $this->checkReadPlaylists($this->users['joelle'], array($this->playlists['joelle_1']));
|
|
191
|
+ $this->checkReadPlaylists($this->users['joelle'],
|
|
192
|
+ array($this->playlists['joelle_1']),
|
|
193
|
+ array($this->playlists['joelle_1']->getId() => array($this->elements['babylon']))
|
|
194
|
+ );
|
179
|
195
|
}
|
180
|
196
|
|
181
|
197
|
protected function initCreateContextData()
|