| @@ 173-190 (lines=18) @@ | ||
| 170 | /** |
|
| 171 | * Attachment file name will be provided as comma separated list in the transaction download. |
|
| 172 | */ |
|
| 173 | public function testDownloadAttachment() |
|
| 174 | { |
|
| 175 | // Arrange |
|
| 176 | /** @var Transaction $transaction */ |
|
| 177 | $transaction = factory(Transaction::class)->create(); |
|
| 178 | $this->addReceiptsToTransaction($transaction); |
|
| 179 | $fileName = 'Transaction_'.$transaction->id.'_test-receipt-3.png'; |
|
| 180 | $url = $this->buildUrl('', ['download_attachment' => $fileName]); |
|
| 181 | ||
| 182 | // Act & Assert |
|
| 183 | $this->get($url) |
|
| 184 | ->seeStatusCode(200) |
|
| 185 | ->seeHeader('Content-Type', '') |
|
| 186 | ->seeHeader('Cache-Control', 'public') |
|
| 187 | ->seeHeader('Content-Description', 'File Transfer') |
|
| 188 | ->seeHeader('Content-Disposition', 'attachment; filename= '.$fileName) |
|
| 189 | ->seeHeader('Content-Transfer-Encoding', 'binary'); |
|
| 190 | } |
|
| 191 | ||
| 192 | /** |
|
| 193 | * @param $transaction |
|
| @@ 67-86 (lines=20) @@ | ||
| 64 | /** |
|
| 65 | * Attachment file name will be provided as comma separated list in the transaction download. |
|
| 66 | */ |
|
| 67 | public function testDownloadAttachment() |
|
| 68 | { |
|
| 69 | // Arrange |
|
| 70 | /** @var Transaction $transaction */ |
|
| 71 | $transaction = factory(Transaction::class)->create(); |
|
| 72 | $this->addReceiptsToTransaction($transaction); |
|
| 73 | $fileName = 'Transaction_'.$transaction->id.'_test-receipt-3.png'; |
|
| 74 | $url = $this->buildUrl('', ['download_attachment' => $fileName]); |
|
| 75 | ||
| 76 | // Act |
|
| 77 | $response = $this->get($url); |
|
| 78 | ||
| 79 | // Assert |
|
| 80 | $response->assertStatus(200) |
|
| 81 | ->assertHeader('Content-Type', '') |
|
| 82 | ->assertHeader('Cache-Control', 'public') |
|
| 83 | ->assertHeader('Content-Description', 'File Transfer') |
|
| 84 | ->assertHeader('Content-Disposition', 'attachment; filename= '.$fileName) |
|
| 85 | ->assertHeader('Content-Transfer-Encoding', 'binary'); |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * @param $transaction |
|