mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
unit test to verify fix of Resque_Event::stopListening
This commit is contained in:
parent
fab92ef114
commit
010384b296
1 changed files with 19 additions and 1 deletions
|
@ -102,6 +102,24 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase
|
||||||
$this->assertContains($callback, $this->callbacksHit, $event . ' callback (' . $callback .') was not called');
|
$this->assertContains($callback, $this->callbacksHit, $event . ' callback (' . $callback .') was not called');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testStopListeningRemovesListener()
|
||||||
|
{
|
||||||
|
$callback = 'beforePerformEventCallback';
|
||||||
|
$event = 'beforePerform';
|
||||||
|
|
||||||
|
Resque_Event::listen($event, array($this, $callback));
|
||||||
|
Resque_Event::stopListening($event, array($this, $callback));
|
||||||
|
|
||||||
|
$job = $this->getEventTestJob();
|
||||||
|
$this->worker->perform($job);
|
||||||
|
$this->worker->work(0);
|
||||||
|
|
||||||
|
$this->assertNotContains($callback, $this->callbacksHit,
|
||||||
|
$event . ' callback (' . $callback .') was called though Resque_Event::stopListening was called'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function beforePerformEventDontPerformCallback($instance)
|
public function beforePerformEventDontPerformCallback($instance)
|
||||||
{
|
{
|
||||||
$this->callbacksHit[] = __FUNCTION__;
|
$this->callbacksHit[] = __FUNCTION__;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue