public function testToArray() { $hook = new WebHookReceipt($this->url, $this->parameter, $this->body); $data = $hook->toArray(); $this->assertArrayHasKey('url', $data); $this->assertArrayHasKey('parameter', $data); $this->assertArrayHasKey('useBody', $data); }
/** * Create a new WebHookReceipt * * @param string $url The URL of the WebHook * @param string $parameter If provided, the post parameter to attach Json * @param Boolean $useBody If set to true, Json will be provided in the request body * * @return WebHookReceipt */ public static function create($url, $parameter, $useBody = false) { $hook = new WebHookReceipt(); return $hook->setUrl($url)->setParameter($parameter)->setUseBody($useBody); }
public function testFromArray() { $webhook = WebHookReceipt::create('htpp://www.example.com/webhook', 'grosse-charge'); $this->assertEquals($webhook, Factory::fromArray($webhook->toArray())); }