public function testApiCancel_ThrowsExceptionInDone_WhenCancellationHandlerRejects()
{
$deferred = $this->createDeferred();
$test = $this->getTest();
$test->setExpectedException(CancellationException::class);
$test->assertNull($deferred->getPromise()->done(null, null, function () {
return Promise::doCancel();
}));
$deferred->cancel(1);
}