File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,24 @@ public function testAfterEnqueueEventCallbackFires()
101
101
));
102
102
$ this ->assertContains ($ callback , $ this ->callbacksHit , $ event . ' callback ( ' . $ callback .') was not called ' );
103
103
}
104
+
105
+ public function testStopListeningRemovesListener ()
106
+ {
107
+ $ callback = 'beforePerformEventCallback ' ;
108
+ $ event = 'beforePerform ' ;
109
+
110
+ Resque_Event::listen ($ event , array ($ this , $ callback ));
111
+ Resque_Event::stopListening ($ event , array ($ this , $ callback ));
112
+
113
+ $ job = $ this ->getEventTestJob ();
114
+ $ this ->worker ->perform ($ job );
115
+ $ this ->worker ->work (0 );
116
+
117
+ $ this ->assertNotContains ($ callback , $ this ->callbacksHit ,
118
+ $ event . ' callback ( ' . $ callback .') was called though Resque_Event::stopListening was called '
119
+ );
120
+ }
121
+
104
122
105
123
public function beforePerformEventDontPerformCallback ($ instance )
106
124
{
@@ -146,4 +164,4 @@ public function afterForkEventCallback($job)
146
164
{
147
165
$ this ->assertValidEventCallback (__FUNCTION__ , $ job );
148
166
}
149
- }
167
+ }
You can’t perform that action at this time.
0 commit comments