@@ 56-81 (lines=26) @@ | ||
53 | $this->assertSame(0, $commandTester->getStatusCode(), 'Returns 0 on success'); |
|
54 | } |
|
55 | ||
56 | public function testThrowGeneralException() |
|
57 | { |
|
58 | $webhookExchange = new WebhookExchange('https://www.example.com'); |
|
59 | ||
60 | $webhookQueueItem = new WebhookQueueItem('content', $webhookExchange); |
|
61 | ||
62 | $webhookExchange |
|
63 | ->addWebhookQueueItem($webhookQueueItem); |
|
64 | ||
65 | $webhookExchangeRepository = $this->getWebhookExchangeRepository(['findAll', 'flush']); |
|
66 | $webhookExchangeRepository |
|
67 | ->method('findAll') |
|
68 | ->willReturn([$webhookExchange]); |
|
69 | ||
70 | $command = $this->getCommand($webhookExchangeRepository); |
|
71 | ||
72 | $client = $this->createMock(ClientInterface::class); |
|
73 | $client->method('send')->willThrowException(new \Exception()); |
|
74 | ||
75 | $command->setHttpClient($client); |
|
76 | ||
77 | $commandTester = $this->execute($command); |
|
78 | ||
79 | $this->assertTrue($webhookQueueItem->isStatus(WebhookQueueItem::STATUS_ERROR)); |
|
80 | $this->assertSame(0, $commandTester->getStatusCode(), 'Returns 0 on success'); |
|
81 | } |
|
82 | ||
83 | public function testThrowTransferException() |
|
84 | { |
|
@@ 83-108 (lines=26) @@ | ||
80 | $this->assertSame(0, $commandTester->getStatusCode(), 'Returns 0 on success'); |
|
81 | } |
|
82 | ||
83 | public function testThrowTransferException() |
|
84 | { |
|
85 | $webhookExchange = new WebhookExchange('https://www.example.com'); |
|
86 | ||
87 | $webhookQueueItem = new WebhookQueueItem('content', $webhookExchange); |
|
88 | ||
89 | $webhookExchange |
|
90 | ->addWebhookQueueItem($webhookQueueItem); |
|
91 | ||
92 | $webhookExchangeRepository = $this->getWebhookExchangeRepository(['findAll', 'flush']); |
|
93 | $webhookExchangeRepository |
|
94 | ->method('findAll') |
|
95 | ->willReturn([$webhookExchange]); |
|
96 | ||
97 | $command = $this->getCommand($webhookExchangeRepository); |
|
98 | ||
99 | $client = $this->createMock(ClientInterface::class); |
|
100 | $client->method('send')->willThrowException(new TransferException()); |
|
101 | ||
102 | $command->setHttpClient($client); |
|
103 | ||
104 | $commandTester = $this->execute($command); |
|
105 | ||
106 | $this->assertTrue($webhookQueueItem->isStatus(WebhookQueueItem::STATUS_ERROR)); |
|
107 | $this->assertSame(0, $commandTester->getStatusCode(), 'Returns 0 on success'); |
|
108 | } |
|
109 | ||
110 | public function testResponseNot200() |
|
111 | { |