| @@ 140-168 (lines=29) @@ | ||
| 137 | ->seeIsSoftDeletedInDatabase('transactions', ['payee_name' => $transaction->payee_name]); // must not be deleted! just soft deleted. |
|
| 138 | } |
|
| 139 | ||
| 140 | public function testDownloadTransactions() |
|
| 141 | { |
|
| 142 | // Arrange |
|
| 143 | /** @var Transaction $transaction */ |
|
| 144 | $transaction = factory(Transaction::class)->create(); |
|
| 145 | $this->addReceiptsToTransaction($transaction); |
|
| 146 | $url = $this->buildUrl('', ['download_transaction' => 'true']); |
|
| 147 | ||
| 148 | // Act & Assert |
|
| 149 | $this->get($url) |
|
| 150 | ->seeStatusCode(200) |
|
| 151 | ->seeJson( |
|
| 152 | [ |
|
| 153 | 'ID' => $transaction->id, |
|
| 154 | 'Date' => $transaction->date, |
|
| 155 | 'Account' => $transaction->account_name, |
|
| 156 | 'ToAccount' => $transaction->to_account_name, |
|
| 157 | 'Status' => $transaction->status->slug, |
|
| 158 | 'Type' => $transaction->type->name, |
|
| 159 | 'Payee' => $transaction->payee_name, |
|
| 160 | 'Category' => $transaction->category_name, |
|
| 161 | 'SubCategory' => $transaction->sub_category_name, |
|
| 162 | 'Amount' => (string) $transaction->amount, |
|
| 163 | 'Notes' => $transaction->notes, |
|
| 164 | 'Attachments' => 'Transaction_'.$transaction->id.'_test-receipt.png;Transaction_'.$transaction->id |
|
| 165 | .'_test-receipt-2.png;Transaction_'.$transaction->id.'_test-receipt-3.png', |
|
| 166 | ] |
|
| 167 | ); |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * Attachment file name will be provided as comma separated list in the transaction download. |
|
| @@ 32-62 (lines=31) @@ | ||
| 29 | $this->seeIsSoftDeletedInDatabase('transactions', ['payee_name' => $transaction->payee_name]); // must not be deleted! just soft deleted. |
|
| 30 | } |
|
| 31 | ||
| 32 | public function testDownloadTransactions() |
|
| 33 | { |
|
| 34 | // Arrange |
|
| 35 | /** @var Transaction $transaction */ |
|
| 36 | $transaction = factory(Transaction::class)->create(); |
|
| 37 | $this->addReceiptsToTransaction($transaction); |
|
| 38 | $url = $this->buildUrl('', ['download_transaction' => 'true']); |
|
| 39 | ||
| 40 | // Act |
|
| 41 | $response = $this->get($url); |
|
| 42 | ||
| 43 | // Assert |
|
| 44 | $response->assertStatus(200) |
|
| 45 | ->assertJsonFragment( |
|
| 46 | [ |
|
| 47 | 'ID' => $transaction->id, |
|
| 48 | 'Date' => $transaction->date, |
|
| 49 | 'Account' => $transaction->account_name, |
|
| 50 | 'ToAccount' => $transaction->to_account_name, |
|
| 51 | 'Status' => $transaction->status->slug, |
|
| 52 | 'Type' => $transaction->type->name, |
|
| 53 | 'Payee' => $transaction->payee_name, |
|
| 54 | 'Category' => $transaction->category_name, |
|
| 55 | 'SubCategory' => $transaction->sub_category_name, |
|
| 56 | 'Amount' => (string)$transaction->amount, |
|
| 57 | 'Notes' => $transaction->notes, |
|
| 58 | 'Attachments' => 'Transaction_'.$transaction->id.'_test-receipt.png;Transaction_'.$transaction->id |
|
| 59 | .'_test-receipt-2.png;Transaction_'.$transaction->id.'_test-receipt-3.png', |
|
| 60 | ] |
|
| 61 | ); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Attachment file name will be provided as comma separated list in the transaction download. |
|