mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 19:24:40 -04:00
Merge branch 'v5-develop' of https://github.com/turbo124/invoiceninja into v5-develop
This commit is contained in:
commit
e35d7ad311
@ -1 +1 @@
|
||||
5.8.34
|
||||
5.8.35
|
@ -127,7 +127,7 @@ class ClientExport extends BaseExport
|
||||
$query = Client::query()->with('contacts')
|
||||
->withTrashed()
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -103,7 +103,7 @@ class CreditExport extends BaseExport
|
||||
->withTrashed()
|
||||
->with('client')
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -83,7 +83,7 @@ class ExpenseExport extends BaseExport
|
||||
->with('client')
|
||||
->withTrashed()
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -58,7 +58,7 @@ class InvoiceExport extends BaseExport
|
||||
->withTrashed()
|
||||
->with('client')
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -71,7 +71,7 @@ class InvoiceItemExport extends BaseExport
|
||||
->withTrashed()
|
||||
->with('client')
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -59,7 +59,7 @@ class PurchaseOrderExport extends BaseExport
|
||||
->withTrashed()
|
||||
->with('vendor')
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -63,7 +63,7 @@ class PurchaseOrderItemExport extends BaseExport
|
||||
$query = PurchaseOrder::query()
|
||||
->withTrashed()
|
||||
->with('vendor')->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -65,7 +65,7 @@ class QuoteExport extends BaseExport
|
||||
->withTrashed()
|
||||
->with('client')
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -66,7 +66,7 @@ class QuoteItemExport extends BaseExport
|
||||
$query = Quote::query()
|
||||
->withTrashed()
|
||||
->with('client')->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -57,7 +57,7 @@ class RecurringInvoiceExport extends BaseExport
|
||||
->withTrashed()
|
||||
->with('client')
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -68,7 +68,7 @@ class TaskExport extends BaseExport
|
||||
$query = Task::query()
|
||||
->withTrashed()
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -62,7 +62,7 @@ class VendorExport extends BaseExport
|
||||
$query = Vendor::query()->with('contacts')
|
||||
->withTrashed()
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', $this->input['include_deleted']);
|
||||
->where('is_deleted', $this->input['include_deleted'] ?? false);
|
||||
|
||||
$query = $this->addDateRange($query);
|
||||
|
||||
|
@ -97,11 +97,11 @@ class Nordigen
|
||||
return $it->transform($out);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
if (strpos($e->getMessage(), "Invalid Account ID") !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
nlog("Nordigen getAccount() failed => {$account_id} => " . $e->getMessage());
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ class StoreProjectRequest extends Request
|
||||
|
||||
$rules['name'] = 'required';
|
||||
$rules['client_id'] = 'required|exists:clients,id,company_id,'.$user->company()->id;
|
||||
$rules['budgeted_hours'] = 'sometimes|numeric';
|
||||
|
||||
if (isset($this->number)) {
|
||||
$rules['number'] = Rule::unique('projects')->where('company_id', $user->company()->id);
|
||||
@ -74,6 +75,9 @@ class StoreProjectRequest extends Request
|
||||
$input['color'] = '';
|
||||
}
|
||||
|
||||
if(array_key_exists('budgeted_hours', $input) && empty($input['budgeted_hours']))
|
||||
$input['budgeted_hours'] = 0;
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,8 @@ class UpdateProjectRequest extends Request
|
||||
$rules['number'] = Rule::unique('projects')->where('company_id', $user->company()->id)->ignore($this->project->id);
|
||||
}
|
||||
|
||||
$rules['budgeted_hours'] = 'sometimes|numeric';
|
||||
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
} elseif ($this->file('documents')) {
|
||||
@ -74,6 +76,10 @@ class UpdateProjectRequest extends Request
|
||||
$input['color'] = '';
|
||||
}
|
||||
|
||||
if(array_key_exists('budgeted_hours', $input) && empty($input['budgeted_hours'])) {
|
||||
$input['budgeted_hours'] = 0;
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class StoreSchedulerRequest extends Request
|
||||
'parameters.end_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom', 'after_or_equal:parameters.start_date'],
|
||||
'parameters.entity' => ['bail', 'sometimes', 'string', 'in:invoice,credit,quote,purchase_order'],
|
||||
'parameters.entity_id' => ['bail', 'sometimes', 'string'],
|
||||
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report','in:vendor,purchase_order_item,purchase_order,ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,activity,client,contact,client_contact,credit,document,expense,invoice,invoice_item,quote,quote_item,recurring_invoice,payment,product,task'],
|
||||
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report','in:vendor,purchase_order_item,purchase_order,ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,activity,activities,client,clients,client_contact,client_contacts,credit,credits,document,documents,expense,expenses,invoice,invoices,invoice_item,invoice_items,quote,quotes,quote_item,quote_items,recurring_invoice,recurring_invoices,payment,payments,product,products,task,tasks'],
|
||||
'parameters.date_key' => ['bail','sometimes', 'string'],
|
||||
'parameters.status' => ['bail','sometimes', 'nullable', 'string'],
|
||||
];
|
||||
|
@ -66,9 +66,9 @@ class UpdateSchedulerRequest extends Request
|
||||
'parameters.end_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom', 'after_or_equal:parameters.start_date'],
|
||||
'parameters.entity' => ['bail', 'sometimes', 'string', 'in:invoice,credit,quote,purchase_order'],
|
||||
'parameters.entity_id' => ['bail', 'sometimes', 'string'],
|
||||
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report','in:vendor,purchase_order_item,purchase_order,ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,activity,client,contact,client_contact,credit,document,expense,invoice,invoice_item,quote,quote_item,recurring_invoice,payment,product,task'],
|
||||
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report','in:vendor,purchase_order_item,purchase_order,ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,activity,activities,client,clients,client_contact,client_contacts,credit,credits,document,documents,expense,expenses,invoice,invoices,invoice_item,invoice_items,quote,quotes,quote_item,quote_items,recurring_invoice,recurring_invoices,payment,payments,product,products,task,tasks'],
|
||||
'parameters.date_key' => ['bail','sometimes', 'string'],
|
||||
'parameters.status' => ['bail','sometimes', 'string'],
|
||||
'parameters.status' => ['bail','sometimes', 'nullable', 'string'],
|
||||
];
|
||||
|
||||
return $rules;
|
||||
|
@ -114,23 +114,26 @@ class ProcessBankTransactionsNordigen implements ShouldQueue
|
||||
|
||||
private function updateAccount()
|
||||
{
|
||||
if (!$this->nordigen->isAccountActive($this->bank_integration->nordigen_account_id)) {
|
||||
$is_account_active = $this->nordigen->isAccountActive($this->bank_integration->nordigen_account_id);
|
||||
$account = $this->nordigen->getAccount($this->bank_integration->nordigen_account_id);
|
||||
|
||||
if (!$is_account_active || !$account) {
|
||||
$this->bank_integration->disabled_upstream = true;
|
||||
$this->bank_integration->save();
|
||||
$this->stop_loop = false;
|
||||
|
||||
nlog("Nordigen: account inactive: " . $this->bank_integration->nordigen_account_id);
|
||||
// @turbo124 @todo send email for expired account
|
||||
|
||||
$this->nordigen->disabledAccountEmail($this->bank_integration);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->nordigen_account = $this->nordigen->getAccount($this->bank_integration->nordigen_account_id);
|
||||
$this->nordigen_account = $account;
|
||||
|
||||
$this->bank_integration->disabled_upstream = false;
|
||||
$this->bank_integration->bank_account_status = $this->nordigen_account['account_status'];
|
||||
$this->bank_integration->balance = $this->nordigen_account['current_balance'];
|
||||
$this->bank_integration->bank_account_status = $account['account_status'];
|
||||
$this->bank_integration->balance = $account['current_balance'];
|
||||
|
||||
$this->bank_integration->save();
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ class TaskScheduler implements ShouldQueue
|
||||
nlog("Doing job {$scheduler->name}");
|
||||
|
||||
try {
|
||||
//@var \App\Models\Schedule $scheduler
|
||||
$scheduler->service()->runTask();
|
||||
} catch(\Exception $e) {
|
||||
nlog($e->getMessage());
|
||||
|
@ -11,34 +11,35 @@
|
||||
|
||||
namespace App\Services\Scheduler;
|
||||
|
||||
use App\Export\CSV\ClientExport;
|
||||
use App\Export\CSV\ContactExport;
|
||||
use App\Export\CSV\CreditExport;
|
||||
use App\Export\CSV\DocumentExport;
|
||||
use App\Export\CSV\ExpenseExport;
|
||||
use App\Export\CSV\InvoiceExport;
|
||||
use App\Export\CSV\InvoiceItemExport;
|
||||
use App\Export\CSV\PaymentExport;
|
||||
use App\Export\CSV\ProductExport;
|
||||
use App\Export\CSV\ProductSalesExport;
|
||||
use App\Export\CSV\QuoteExport;
|
||||
use App\Export\CSV\QuoteItemExport;
|
||||
use App\Export\CSV\RecurringInvoiceExport;
|
||||
use App\Export\CSV\TaskExport;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Mail\DownloadReport;
|
||||
use App\Models\Client;
|
||||
use App\Models\Scheduler;
|
||||
use App\Mail\DownloadReport;
|
||||
use App\Export\CSV\TaskExport;
|
||||
use App\Export\CSV\QuoteExport;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Export\CSV\ClientExport;
|
||||
use App\Export\CSV\CreditExport;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Export\CSV\ContactExport;
|
||||
use App\Export\CSV\ExpenseExport;
|
||||
use App\Export\CSV\InvoiceExport;
|
||||
use App\Export\CSV\PaymentExport;
|
||||
use App\Export\CSV\ProductExport;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Export\CSV\ActivityExport;
|
||||
use App\Export\CSV\DocumentExport;
|
||||
use App\Export\CSV\QuoteItemExport;
|
||||
use App\Services\Report\ProfitLoss;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Export\CSV\InvoiceItemExport;
|
||||
use App\Export\CSV\ProductSalesExport;
|
||||
use App\Services\Report\ARDetailReport;
|
||||
use App\Services\Report\ARSummaryReport;
|
||||
use App\Services\Report\ClientBalanceReport;
|
||||
use App\Services\Report\ClientSalesReport;
|
||||
use App\Services\Report\ProfitLoss;
|
||||
use App\Services\Report\TaxSummaryReport;
|
||||
use App\Services\Report\UserSalesReport;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Services\Report\TaxSummaryReport;
|
||||
use App\Export\CSV\RecurringInvoiceExport;
|
||||
use App\Services\Report\ClientSalesReport;
|
||||
use App\Services\Report\ClientBalanceReport;
|
||||
|
||||
class EmailReport
|
||||
{
|
||||
@ -77,19 +78,33 @@ class EmailReport
|
||||
'client_sales' => $export = (new ClientSalesReport($this->scheduler->company, $data)),
|
||||
'user_sales' => $export = (new UserSalesReport($this->scheduler->company, $data)),
|
||||
'profitloss' => $export = (new ProfitLoss($this->scheduler->company, $data)),
|
||||
'activity' => $export = (new ActivityExport($this->scheduler->company, $data)),
|
||||
'activities' => $export = (new ActivityExport($this->scheduler->company, $data)),
|
||||
'client' => $export = (new ClientExport($this->scheduler->company, $data)),
|
||||
'clients' => $export = (new ClientExport($this->scheduler->company, $data)),
|
||||
'client_contact' => $export = (new ContactExport($this->scheduler->company, $data)),
|
||||
'client_contacts' => $export = (new ContactExport($this->scheduler->company, $data)),
|
||||
'credit' => $export = (new CreditExport($this->scheduler->company, $data)),
|
||||
'credits' => $export = (new CreditExport($this->scheduler->company, $data)),
|
||||
'document' => $export = (new DocumentExport($this->scheduler->company, $data)),
|
||||
'documents' => $export = (new DocumentExport($this->scheduler->company, $data)),
|
||||
'expense' => $export = (new ExpenseExport($this->scheduler->company, $data)),
|
||||
'expenses' => $export = (new ExpenseExport($this->scheduler->company, $data)),
|
||||
'invoice' => $export = (new InvoiceExport($this->scheduler->company, $data)),
|
||||
'invoices' => $export = (new InvoiceExport($this->scheduler->company, $data)),
|
||||
'invoice_item' => $export = (new InvoiceItemExport($this->scheduler->company, $data)),
|
||||
'invoice_items' => $export = (new InvoiceItemExport($this->scheduler->company, $data)),
|
||||
'quote' => $export = (new QuoteExport($this->scheduler->company, $data)),
|
||||
'quotes' => $export = (new QuoteExport($this->scheduler->company, $data)),
|
||||
'quote_item' => $export = (new QuoteItemExport($this->scheduler->company, $data)),
|
||||
'quote_items' => $export = (new QuoteItemExport($this->scheduler->company, $data)),
|
||||
'recurring_invoice' => $export = (new RecurringInvoiceExport($this->scheduler->company, $data)),
|
||||
'recurring_invoices' => $export = (new RecurringInvoiceExport($this->scheduler->company, $data)),
|
||||
'payment' => $export = (new PaymentExport($this->scheduler->company, $data)),
|
||||
'payments' => $export = (new PaymentExport($this->scheduler->company, $data)),
|
||||
'product' => $export = (new ProductExport($this->scheduler->company, $data)),
|
||||
'task' => $export = (new TaskExport($this->scheduler->company, $data)),
|
||||
'products' => $export = (new ProductExport($this->scheduler->company, $data)),
|
||||
'tasks' => $export = (new TaskExport($this->scheduler->company, $data)),
|
||||
default => $export = false,
|
||||
};
|
||||
|
||||
|
@ -49,6 +49,12 @@ class ProjectTransformer extends EntityTransformer
|
||||
|
||||
public function includeClient(Project $project): \League\Fractal\Resource\Item
|
||||
{
|
||||
|
||||
if (!$project->client) {
|
||||
nlog("Project {$project->hashed_id} does not have a client attached - this project is in a bad state");
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new ClientTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($project->client, $transformer, Client::class);
|
||||
|
@ -17,8 +17,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => env('APP_VERSION', '5.8.34'),
|
||||
'app_tag' => env('APP_TAG', '5.8.34'),
|
||||
'app_version' => env('APP_VERSION', '5.8.35'),
|
||||
'app_tag' => env('APP_TAG', '5.8.35'),
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', false),
|
||||
|
@ -460,7 +460,7 @@ $lang = array(
|
||||
'edit_token' => 'Edit Token',
|
||||
'delete_token' => 'Delete Token',
|
||||
'token' => 'Token',
|
||||
'add_gateway' => 'Add Gateway',
|
||||
'add_gateway' => 'Add Payment Gateway',
|
||||
'delete_gateway' => 'Delete Gateway',
|
||||
'edit_gateway' => 'Edit Gateway',
|
||||
'updated_gateway' => 'Successfully updated gateway',
|
||||
@ -5251,6 +5251,9 @@ $lang = array(
|
||||
'payment_type_help' => 'The default payment type to be used for payments',
|
||||
'quote_valid_until_help' => 'The number of days that the quote is valid for',
|
||||
'expense_payment_type_help' => 'The default expense payment type to be used',
|
||||
'paylater' => 'Pay in 4',
|
||||
'payment_provider' => 'Payment Provider',
|
||||
|
||||
);
|
||||
|
||||
return $lang;
|
||||
|
109
public/build/assets/app-01291e40.js
vendored
109
public/build/assets/app-01291e40.js
vendored
File diff suppressed because one or more lines are too long
1
public/build/assets/app-17bd8d2c.css
vendored
Normal file
1
public/build/assets/app-17bd8d2c.css
vendored
Normal file
File diff suppressed because one or more lines are too long
109
public/build/assets/app-b98bbdda.js
vendored
Normal file
109
public/build/assets/app-b98bbdda.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/build/assets/app-ec429add.css
vendored
1
public/build/assets/app-ec429add.css
vendored
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@
|
||||
]
|
||||
},
|
||||
"resources/js/app.js": {
|
||||
"file": "assets/app-01291e40.js",
|
||||
"file": "assets/app-b98bbdda.js",
|
||||
"imports": [
|
||||
"_index-08e160a7.js",
|
||||
"__commonjsHelpers-725317a4.js"
|
||||
@ -240,7 +240,7 @@
|
||||
"src": "resources/js/setup/setup.js"
|
||||
},
|
||||
"resources/sass/app.scss": {
|
||||
"file": "assets/app-ec429add.css",
|
||||
"file": "assets/app-17bd8d2c.css",
|
||||
"isEntry": true,
|
||||
"src": "resources/sass/app.scss"
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ class ProjectApiTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
{
|
||||
parent::setUp();
|
||||
@ -42,6 +44,110 @@ class ProjectApiTest extends TestCase
|
||||
Model::reguard();
|
||||
}
|
||||
|
||||
public function testProjectValidationForBudgetedHoursPut()
|
||||
{
|
||||
|
||||
$data = $this->project->toArray();
|
||||
$data['budgeted_hours'] = "aa";
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson("/api/v1/projects/{$this->project->hashed_id}", $data);
|
||||
|
||||
$response->assertStatus(422);
|
||||
|
||||
}
|
||||
|
||||
public function testProjectValidationForBudgetedHoursPutNull()
|
||||
{
|
||||
|
||||
$data = $this->project->toArray();
|
||||
$data['budgeted_hours'] = null;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson("/api/v1/projects/{$this->project->hashed_id}", $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testProjectValidationForBudgetedHoursPutEmpty()
|
||||
{
|
||||
|
||||
$data = $this->project->toArray();
|
||||
$data['budgeted_hours'] = "";
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson("/api/v1/projects/{$this->project->hashed_id}", $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testProjectValidationForBudgetedHours()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'name' => $this->faker->firstName(),
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'number' => 'duplicate',
|
||||
'budgeted_hours' => null
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/projects', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
}
|
||||
|
||||
public function testProjectValidationForBudgetedHours2()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'name' => $this->faker->firstName(),
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'number' => 'duplicate',
|
||||
'budgeted_hours' => "a"
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/projects', $data);
|
||||
|
||||
$response->assertStatus(422);
|
||||
|
||||
}
|
||||
|
||||
public function testProjectValidationForBudgetedHours3()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'name' => $this->faker->firstName(),
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'number' => 'duplicate',
|
||||
'budgeted_hours' => ""
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/projects', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
}
|
||||
|
||||
public function testProjectGetFilter()
|
||||
{
|
||||
$response = $this->withHeaders([
|
||||
|
@ -72,6 +72,11 @@ trait MockAccountData
|
||||
use MakesHash;
|
||||
use GeneratesCounter;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $project;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user