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