mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for tests
This commit is contained in:
parent
002e4a7aab
commit
105b5c967b
@ -52,6 +52,11 @@ class StoreProductRequest extends Request
|
||||
$rules['stock_notification_threshold'] = 'sometimes|numeric';
|
||||
$rules['stock_notification'] = 'sometimes|bool';
|
||||
|
||||
$rules['tax_rate1'] = 'bail|sometimes|numeric';
|
||||
$rules['tax_rate2'] = 'bail|sometimes|numeric';
|
||||
$rules['tax_rate3'] = 'bail|sometimes|numeric';
|
||||
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
@ -67,6 +72,10 @@ class StoreProductRequest extends Request
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
$input['tax_name1'] = $input['tax_name1'] ?? '';
|
||||
$input['tax_name2'] = $input['tax_name2'] ?? '';
|
||||
$input['tax_name3'] = $input['tax_name3'] ?? '';
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,27 @@ class ProductTest extends TestCase
|
||||
|
||||
}
|
||||
|
||||
public function testRequiredFields()
|
||||
{
|
||||
|
||||
$product = [
|
||||
'cost' => 10,
|
||||
'vendor_id' => $this->vendor->hashed_id
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/products', $product)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$p = Product::find($this->decodePrimaryKey($arr['data']['id']));
|
||||
|
||||
$this->assertNull($p->vendor_id);
|
||||
}
|
||||
|
||||
public function testProductCostMigration()
|
||||
{
|
||||
$items = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user