mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
FIxes for tests
This commit is contained in:
parent
6b7db63e66
commit
c2211bf2f0
@ -57,25 +57,29 @@ class Handler extends ExceptionHandler
|
|||||||
*/
|
*/
|
||||||
public function report(Exception $exception)
|
public function report(Exception $exception)
|
||||||
{
|
{
|
||||||
if(!Schema::hasTable('accounts'))
|
if(!Schema::hasTable('accounts')){
|
||||||
|
info("account table not found");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (app()->bound('sentry') && $this->shouldReport($exception)) {
|
if (app()->bound('sentry') && $this->shouldReport($exception)) {
|
||||||
app('sentry')->configureScope(function (Scope $scope): void {
|
|
||||||
if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) {
|
// app('sentry')->configureScope(function (Scope $scope): void {
|
||||||
$scope->setUser([
|
|
||||||
'id' => auth()->guard('contact')->user()->company->account->key,
|
// if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) {
|
||||||
'email' => "anonymous@example.com",
|
// $scope->setUser([
|
||||||
'name' => "Anonymous User",
|
// 'id' => auth()->guard('contact')->user()->company->account->key,
|
||||||
]);
|
// 'email' => "anonymous@example.com",
|
||||||
} elseif (auth()->guard('user')->user() && auth()->user()->company() && auth()->user()->company()->account->report_errors) {
|
// 'name' => "Anonymous User",
|
||||||
$scope->setUser([
|
// ]);
|
||||||
'id' => auth()->user()->account->key,
|
// } elseif (auth()->guard('user') && auth()->guard('user')->user() && auth()->user()->company() && auth()->user()->company()->account->report_errors) {
|
||||||
'email' => "anonymous@example.com",
|
// $scope->setUser([
|
||||||
'name' => "Anonymous User",
|
// 'id' => auth()->user()->account->key,
|
||||||
]);
|
// 'email' => "anonymous@example.com",
|
||||||
}
|
// 'name' => "Anonymous User",
|
||||||
});
|
// ]);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
app('sentry')->captureException($exception);
|
app('sentry')->captureException($exception);
|
||||||
}
|
}
|
||||||
|
@ -484,7 +484,7 @@ class DesignController extends BaseController
|
|||||||
|
|
||||||
$designs->each(function ($design, $key) use ($action) {
|
$designs->each(function ($design, $key) use ($action) {
|
||||||
if (auth()->user()->can('edit', $design)) {
|
if (auth()->user()->can('edit', $design)) {
|
||||||
$this->design_repo->{$action}($design);@todo
|
$this->design_repo->{$action}($design);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ class StorePaymentRequest extends Request
|
|||||||
|
|
||||||
$input['is_manual'] = true;
|
$input['is_manual'] = true;
|
||||||
|
|
||||||
|
info(print_r($input,1));
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class PaymentTransformer extends EntityTransformer
|
|||||||
|
|
||||||
protected $serializer;
|
protected $serializer;
|
||||||
|
|
||||||
protected $defaultIncludes = [];
|
protected $defaultIncludes = ['invoices'];
|
||||||
|
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'client',
|
'client',
|
||||||
|
@ -191,7 +191,7 @@ class PaymentTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->post('/api/v1/payments?include=invoices', $data);
|
])->post('/api/v1/payments?include=invoices,paymentables', $data);
|
||||||
} catch (ValidationException $e) {
|
} catch (ValidationException $e) {
|
||||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||||
$this->assertNotNull($message);
|
$this->assertNotNull($message);
|
||||||
@ -204,6 +204,7 @@ class PaymentTest extends TestCase
|
|||||||
$payment_id = $arr['data']['id'];
|
$payment_id = $arr['data']['id'];
|
||||||
|
|
||||||
$payment = Payment::find($this->decodePrimaryKey($payment_id))->first();
|
$payment = Payment::find($this->decodePrimaryKey($payment_id))->first();
|
||||||
|
$payment->load('invoices');
|
||||||
|
|
||||||
$this->assertNotNull($payment);
|
$this->assertNotNull($payment);
|
||||||
$this->assertNotNull($payment->invoices());
|
$this->assertNotNull($payment->invoices());
|
||||||
@ -663,7 +664,7 @@ class PaymentTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($response) {
|
if ($response) {
|
||||||
$response->assertStatus(302);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user