Skip to content

Commit eee5d58

Browse files
committed
Disabling invalid watchers must not throw now
1 parent 0f5460f commit eee5d58

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Test.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ function testWatcherRegistrationAndCancellationInfo($type, $args)
349349
$info = $loop->info();
350350
$expected = ["enabled" => 0, "disabled" => 0];
351351
$this->assertSame($expected, $info[$type]);
352+
353+
$loop->disable($watcherId);
354+
$info = $loop->info();
355+
$expected = ["enabled" => 0, "disabled" => 0];
356+
$this->assertSame($expected, $info[$type]);
352357
}
353358

354359
/** @dataProvider provideRegistrationArgs */
@@ -610,8 +615,7 @@ function testExceptionOnEnableNonexistentWatcher()
610615
$this->loop->enable("nonexistentWatcher");
611616
}
612617

613-
/** @expectedException \Interop\Async\Loop\InvalidWatcherException */
614-
function testExceptionOnDisableNonexistentWatcher()
618+
function testSuccessOnDisableNonexistentWatcher()
615619
{
616620
$this->loop->disable("nonexistentWatcher");
617621
}
@@ -637,7 +641,7 @@ function testExceptionOnUnreferenceNonexistentWatcher()
637641
function testWatcherInvalidityOnDefer() {
638642
$this->start(function(Driver $loop) {
639643
$loop->defer(function($watcher) use ($loop) {
640-
$loop->disable($watcher);
644+
$loop->enable($watcher);
641645
});
642646
});
643647
}
@@ -646,7 +650,7 @@ function testWatcherInvalidityOnDefer() {
646650
function testWatcherInvalidityOnDelay() {
647651
$this->start(function(Driver $loop) {
648652
$loop->delay($msDelay = 0, function($watcher) use ($loop) {
649-
$loop->disable($watcher);
653+
$loop->enable($watcher);
650654
});
651655
});
652656
}

0 commit comments

Comments
 (0)