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
9898 */
9999 public static function prefix ($ namespace )
100100 {
101- if (strpos ($ namespace , ' : ' ) === false ) {
101+ if (substr ($ namespace , - 1 ) !== ' : ' ) {
102102 $ namespace .= ': ' ;
103103 }
104104 self ::$ defaultNamespace = $ namespace ;
Original file line number Diff line number Diff line change @@ -166,7 +166,21 @@ public function testJobWithTearDownCallbackFiresTearDown()
166166
167167 $ this ->assertTrue (Test_Job_With_TearDown::$ called );
168168 }
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+
170184 public function testJobWithNamespace ()
171185 {
172186 Resque_Redis::prefix ('php ' );
@@ -176,7 +190,7 @@ public function testJobWithNamespace()
176190
177191 $ this ->assertEquals (Resque::queues (), array ('jobs ' ));
178192 $ this ->assertEquals (Resque::size ($ queue ), 1 );
179-
193+
180194 Resque_Redis::prefix ('resque ' );
181195 $ this ->assertEquals (Resque::size ($ queue ), 0 );
182196 }
You can’t perform that action at this time.
0 commit comments