1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/tests/Feature/PreviewTest.php
David Bomba 84a64773a6
Adjustments for OAuth (#3707)
* Fixes for null values in custom values

* Refactor mailing

* Working on send emails from GMail API

* Fixes for tests

* Test for GMail

* Adjustments for storing oauth token
2020-05-16 20:26:16 +10:00

84 lines
1.8 KiB
PHP

<?php
namespace Tests\Feature;
use App\Designs\Designer;
use App\Jobs\Account\CreateAccount;
use App\Models\Account;
use App\Models\Client;
use App\Models\Design;
use App\Models\User;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\UserSessionAttributes;
use Faker\Factory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Tests\MockAccountData;
use Tests\TestCase;
/**
* @test
* @covers App\Http\Controllers\PreviewController
*/
class PreviewTest extends TestCase
{
use MakesHash;
use DatabaseTransactions;
use MockAccountData;
public function setUp() :void
{
parent::setUp();
$this->makeTestData();
Session::start();
$this->faker = \Faker\Factory::create();
Model::reguard();
}
public function testPreviewDesign()
{
$design = Design::find(3);
$data = [
'entity' => 'invoice',
'entity_id' => $this->invoice->hashed_id,
'design' => $design,
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token
])->post('/api/v1/preview', $data)->assertStatus(200);
}
public function testBlankEntityPreviewDesign()
{
$design = Design::find(3);
$data = [
'design' => $design,
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token
])->post('/api/v1/preview', $data);
$response->assertStatus(200);
}
}