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)
|
||||
{
|
||||
if(!Schema::hasTable('accounts'))
|
||||
if(!Schema::hasTable('accounts')){
|
||||
info("account table not found");
|
||||
return;
|
||||
}
|
||||
|
||||
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) {
|
||||
$scope->setUser([
|
||||
'id' => auth()->guard('contact')->user()->company->account->key,
|
||||
'email' => "anonymous@example.com",
|
||||
'name' => "Anonymous User",
|
||||
]);
|
||||
} elseif (auth()->guard('user')->user() && auth()->user()->company() && auth()->user()->company()->account->report_errors) {
|
||||
$scope->setUser([
|
||||
'id' => auth()->user()->account->key,
|
||||
'email' => "anonymous@example.com",
|
||||
'name' => "Anonymous User",
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
// app('sentry')->configureScope(function (Scope $scope): void {
|
||||
|
||||
// if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) {
|
||||
// $scope->setUser([
|
||||
// 'id' => auth()->guard('contact')->user()->company->account->key,
|
||||
// 'email' => "anonymous@example.com",
|
||||
// 'name' => "Anonymous User",
|
||||
// ]);
|
||||
// } elseif (auth()->guard('user') && auth()->guard('user')->user() && auth()->user()->company() && auth()->user()->company()->account->report_errors) {
|
||||
// $scope->setUser([
|
||||
// 'id' => auth()->user()->account->key,
|
||||
// 'email' => "anonymous@example.com",
|
||||
// 'name' => "Anonymous User",
|
||||
// ]);
|
||||
// }
|
||||
// });
|
||||
|
||||
app('sentry')->captureException($exception);
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ class DesignController extends BaseController
|
||||
|
||||
$designs->each(function ($design, $key) use ($action) {
|
||||
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;
|
||||
|
||||
info(print_r($input,1));
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ class PaymentTransformer extends EntityTransformer
|
||||
|
||||
protected $serializer;
|
||||
|
||||
protected $defaultIncludes = [];
|
||||
protected $defaultIncludes = ['invoices'];
|
||||
|
||||
protected $availableIncludes = [
|
||||
'client',
|
||||
|
@ -191,7 +191,7 @@ class PaymentTest extends TestCase
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/payments?include=invoices', $data);
|
||||
])->post('/api/v1/payments?include=invoices,paymentables', $data);
|
||||
} catch (ValidationException $e) {
|
||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||
$this->assertNotNull($message);
|
||||
@ -204,6 +204,7 @@ class PaymentTest extends TestCase
|
||||
$payment_id = $arr['data']['id'];
|
||||
|
||||
$payment = Payment::find($this->decodePrimaryKey($payment_id))->first();
|
||||
$payment->load('invoices');
|
||||
|
||||
$this->assertNotNull($payment);
|
||||
$this->assertNotNull($payment->invoices());
|
||||
@ -663,7 +664,7 @@ class PaymentTest extends TestCase
|
||||
}
|
||||
|
||||
if ($response) {
|
||||
$response->assertStatus(302);
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user