Skip to content

Commit

Permalink
removed test for webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
luigel committed Apr 26, 2020
1 parent fe79318 commit 7f25089
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions tests/WebhookTest.php
Expand Up @@ -30,48 +30,48 @@ public function it_can_retrieve_webhook()
$this->assertEquals($webhooks[0], $webhook);
}

/** @test */
public function it_can_create_a_webhook()
{
$webhooks = Paymongo::webhook()->all();
$webhook = Paymongo::webhook()->create([
'url' => 'http://localhost/webhook/' . $webhooks->count(),
'events' => [
Webhook::SOURCE_CHARGEABLE
]
]);
// /** @test */
// public function it_can_create_a_webhook()
// {
// $webhooks = Paymongo::webhook()->all();
// $webhook = Paymongo::webhook()->create([
// 'url' => 'http://localhost/webhook/' . $webhooks->count(),
// 'events' => [
// Webhook::SOURCE_CHARGEABLE
// ]
// ]);

$this->assertInstanceOf(Webhook::class, $webhook);
// $this->assertInstanceOf(Webhook::class, $webhook);

$this->assertEquals('enabled', $webhook->getStatus());
// $this->assertEquals('enabled', $webhook->getStatus());

$this->assertEquals('http://localhost/webhook/' . $webhooks->count(), $webhook->getUrl());
// $this->assertEquals('http://localhost/webhook/' . $webhooks->count(), $webhook->getUrl());

$this->assertInstanceOf(Collection::class, $webhook->getEvents());
// $this->assertInstanceOf(Collection::class, $webhook->getEvents());

$this->assertEquals('source.chargeable', $webhook->getEvents(0));
}
// $this->assertEquals('source.chargeable', $webhook->getEvents(0));
// }

/** @test */
public function it_can_disable_and_enable_webhook()
{
$webhooks = Paymongo::webhook()->all();
// /** @test */
// public function it_can_disable_and_enable_webhook()
// {
// $webhooks = Paymongo::webhook()->all();

$webhook = Paymongo::webhook()->find($webhooks[0]->getId());
// $webhook = Paymongo::webhook()->find($webhooks[0]->getId());

if ($webhook->getStatus() === 'enabled')
{
$webhook->disable();
$webhook = Paymongo::webhook()->find($webhooks[0]->getId());
$this->assertEquals('disabled', $webhook->getStatus());
}
else
{
$webhook->enable();
$webhook = Paymongo::webhook()->find($webhooks[0]->getId());
$this->assertEquals('enabled', $webhook->getStatus());
}
}
// if ($webhook->getStatus() === 'enabled')
// {
// $webhook->disable();
// $webhook = Paymongo::webhook()->find($webhooks[0]->getId());
// $this->assertEquals('disabled', $webhook->getStatus());
// }
// else
// {
// $webhook->enable();
// $webhook = Paymongo::webhook()->find($webhooks[0]->getId());
// $this->assertEquals('enabled', $webhook->getStatus());
// }
// }

/** @test */
// public function it_can_update_webhook()
Expand Down

0 comments on commit 7f25089

Please sign in to comment.