mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
catch project exceptions
This commit is contained in:
parent
a9233ba62f
commit
7173ba2931
@ -54,7 +54,7 @@ class QueryLogging
|
||||
nlog($request->method().' - '.$request->url().": $count queries - ".$time);
|
||||
|
||||
// if($count > 50)
|
||||
// Log::nlog($queries);
|
||||
//nlog($queries);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ class Project extends BaseModel
|
||||
'custom_value4',
|
||||
'assigned_user_id',
|
||||
'color',
|
||||
'number',
|
||||
];
|
||||
|
||||
public function getEntityType()
|
||||
|
@ -16,6 +16,7 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Tests\MockAccountData;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
/**
|
||||
* @test
|
||||
@ -56,6 +57,7 @@ class ProjectApiTest extends TestCase
|
||||
$data = [
|
||||
'name' => $this->faker->firstName,
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'number' => 'duplicate',
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
@ -64,6 +66,26 @@ class ProjectApiTest extends TestCase
|
||||
])->post('/api/v1/projects', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->put('/api/v1/projects/'.$arr['data']['id'], $data)->assertStatus(200);
|
||||
|
||||
try{
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/projects', $data);
|
||||
}
|
||||
catch(ValidationException $e){
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testProjectPut()
|
||||
|
Loading…
x
Reference in New Issue
Block a user