1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/tests/Feature/Export/ClientCsvTest.php

79 lines
1.7 KiB
PHP
Raw Normal View History

2022-05-10 06:25:16 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
2022-06-08 06:25:44 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2022-05-10 06:25:16 +02:00
*/
namespace Tests\Feature\Export;
use App\Models\Invoice;
use App\Utils\Traits\MakesHash;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Support\Facades\Storage;
use League\Csv\Writer;
use Tests\MockAccountData;
use Tests\TestCase;
/**
* @test
*/
class ClientCsvTest extends TestCase
{
use MakesHash;
use MockAccountData;
public function setUp() :void
{
parent::setUp();
$this->withoutMiddleware(
ThrottleRequests::class
);
$this->makeTestData();
$this->withoutExceptionHandling();
}
public function testClientExportCsv()
{
$data = [
"date_range" => "this_year",
"report_keys" => [],
2022-05-21 00:37:19 +02:00
"send_email" => false
2022-05-10 06:25:16 +02:00
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/reports/clients' , $data);
$response->assertStatus(200);
}
public function testContactExportCsv()
{
$data = [
"date_range" => "this_year",
"report_keys" => [],
2022-05-21 00:37:19 +02:00
"send_email" => false
2022-05-10 06:25:16 +02:00
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/reports/contacts' , $data);
$response->assertStatus(200);
}
}