File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ class Resque_Redis
98
98
*/
99
99
public static function prefix ($ namespace )
100
100
{
101
- if (strpos ($ namespace , ' : ' ) === false ) {
101
+ if (substr ($ namespace , - 1 ) !== ' : ' ) {
102
102
$ namespace .= ': ' ;
103
103
}
104
104
self ::$ defaultNamespace = $ namespace ;
Original file line number Diff line number Diff line change @@ -166,7 +166,21 @@ public function testJobWithTearDownCallbackFiresTearDown()
166
166
167
167
$ this ->assertTrue (Test_Job_With_TearDown::$ called );
168
168
}
169
-
169
+
170
+ public function testNamespaceNaming () {
171
+ $ fixture = array (
172
+ array ('test ' => 'more:than:one:with: ' , 'assertValue ' => 'more:than:one:with: ' ),
173
+ array ('test ' => 'more:than:one:without ' , 'assertValue ' => 'more:than:one:without: ' ),
174
+ array ('test ' => 'resque ' , 'assertValue ' => 'resque: ' ),
175
+ array ('test ' => 'resque: ' , 'assertValue ' => 'resque: ' ),
176
+ );
177
+
178
+ foreach ($ fixture as $ item ) {
179
+ Resque_Redis::prefix ($ item ['test ' ]);
180
+ $ this ->assertEquals (Resque_Redis::getPrefix (), $ item ['assertValue ' ]);
181
+ }
182
+ }
183
+
170
184
public function testJobWithNamespace ()
171
185
{
172
186
Resque_Redis::prefix ('php ' );
@@ -176,7 +190,7 @@ public function testJobWithNamespace()
176
190
177
191
$ this ->assertEquals (Resque::queues (), array ('jobs ' ));
178
192
$ this ->assertEquals (Resque::size ($ queue ), 1 );
179
-
193
+
180
194
Resque_Redis::prefix ('resque ' );
181
195
$ this ->assertEquals (Resque::size ($ queue ), 0 );
182
196
}
You can’t perform that action at this time.
0 commit comments