public function testCreate()
{
$request = $this->operation['request']['body'];
$obj = new Webhook($request);
// Adding a random url request to make it unique
$obj->setUrl($obj->getUrl() . '?rand=' . uniqid());
$result = null;
try {
$result = $obj->create($this->apiContext, $this->mockPayPalRestCall);
} catch (PayPalConnectionException $ex) {
$data = $ex->getData();
if (strpos($data, 'WEBHOOK_NUMBER_LIMIT_EXCEEDED') !== false) {
$this->deleteAll();
$result = $obj->create($this->apiContext, $this->mockPayPalRestCall);
} else {
$this->fail($ex->getMessage());
}
}
$this->assertNotNull($result);
return $result;
}