public function testUpdate($webhook)
{
$patches = array();
foreach ($this->operation['request']['body'] as $request) {
/** @var Patch[] $request */
$patch = new Patch();
$patch->setOp($request['op']);
$patch->setPath($request['path']);
$patch->setValue($request['value']);
if ($request['path'] == "/url") {
$new_url = $request['value'] . '?rand=' . uniqid();
$patch->setValue($new_url);
}
$patches[] = $patch;
}
$patchRequest = new PatchRequest();
$patchRequest->setPatches($patches);
$result = $webhook->update($patchRequest, $this->apiContext, $this->mockPayPalRestCall);
$this->assertNotNull($result);
$found = false;
$foundObject = null;
foreach ($result->getEventTypes() as $eventType) {
if ($eventType->getName() == "PAYMENT.SALE.REFUNDED") {
$found = true;
break;
}
}
$this->assertTrue($found);
}