mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 09:34:33 -04:00
Fixes for tests
This commit is contained in:
parent
f927e08d41
commit
08d196e6c0
@ -85,6 +85,10 @@ class StoreClientRequest extends Request
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
//is no settings->currency_id is set then lets dive in and find either a group or company currency all the below may be redundant!!
|
//is no settings->currency_id is set then lets dive in and find either a group or company currency all the below may be redundant!!
|
||||||
if (!property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) {
|
if (!property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) {
|
||||||
$input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']);
|
$input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']);
|
||||||
|
@ -92,6 +92,10 @@ class UpdateClientRequest extends Request
|
|||||||
$input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']);
|
$input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($input['contacts'])) {
|
if (isset($input['contacts'])) {
|
||||||
foreach ($input['contacts'] as $key => $contact) {
|
foreach ($input['contacts'] as $key => $contact) {
|
||||||
if (array_key_exists('id', $contact) && is_numeric($contact['id'])) {
|
if (array_key_exists('id', $contact) && is_numeric($contact['id'])) {
|
||||||
|
@ -58,6 +58,10 @@ class StoreCreditRequest extends FormRequest
|
|||||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($input['client_contacts'])) {
|
if (isset($input['client_contacts'])) {
|
||||||
foreach ($input['client_contacts'] as $key => $contact) {
|
foreach ($input['client_contacts'] as $key => $contact) {
|
||||||
if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) {
|
if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) {
|
||||||
|
@ -58,6 +58,10 @@ class UpdateCreditRequest extends FormRequest
|
|||||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($input['invitations'])) {
|
if (isset($input['invitations'])) {
|
||||||
foreach ($input['invitations'] as $key => $value) {
|
foreach ($input['invitations'] as $key => $value) {
|
||||||
if (is_numeric($input['invitations'][$key]['id'])) {
|
if (is_numeric($input['invitations'][$key]['id'])) {
|
||||||
|
@ -46,6 +46,10 @@ class StorePaymentRequest extends Request
|
|||||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($input['invoices']) && is_array($input['invoices']) !== false) {
|
if (isset($input['invoices']) && is_array($input['invoices']) !== false) {
|
||||||
foreach ($input['invoices'] as $key => $value) {
|
foreach ($input['invoices'] as $key => $value) {
|
||||||
$input['invoices'][$key]['invoice_id'] = $this->decodePrimaryKey($value['invoice_id']);
|
$input['invoices'][$key]['invoice_id'] = $this->decodePrimaryKey($value['invoice_id']);
|
||||||
|
@ -60,6 +60,10 @@ class UpdatePaymentRequest extends Request
|
|||||||
{
|
{
|
||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($input['client_id'])) {
|
if (isset($input['client_id'])) {
|
||||||
unset($input['client_id']);
|
unset($input['client_id']);
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,10 @@ class StoreProductRequest extends Request
|
|||||||
$input['quantity'] = 1;
|
$input['quantity'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,10 @@ class UpdateProductRequest extends Request
|
|||||||
$input['quantity'] = 1;
|
$input['quantity'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,10 @@ class StoreQuoteRequest extends Request
|
|||||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($input['client_contacts'])) {
|
if (isset($input['client_contacts'])) {
|
||||||
foreach ($input['client_contacts'] as $key => $contact) {
|
foreach ($input['client_contacts'] as $key => $contact) {
|
||||||
if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) {
|
if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) {
|
||||||
|
@ -69,6 +69,10 @@ class UpdateQuoteRequest extends Request
|
|||||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,11 @@ class StoreRecurringInvoiceRequest extends Request
|
|||||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||||
//$input['line_items'] = json_encode($input['line_items']);
|
//$input['line_items'] = json_encode($input['line_items']);
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
|
@ -45,6 +45,10 @@ class UpdateRecurringInvoiceRequest extends Request
|
|||||||
{
|
{
|
||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||||
//$input['line_items'] = json_encode($input['line_items']);
|
//$input['line_items'] = json_encode($input['line_items']);
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
|
@ -48,6 +48,10 @@ class StoreRecurringQuoteRequest extends Request
|
|||||||
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
$input['client_id'] = $this->decodePrimaryKey($input['client_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||||
//$input['line_items'] = json_encode($input['line_items']);
|
//$input['line_items'] = json_encode($input['line_items']);
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
|
@ -45,7 +45,13 @@ class UpdateRecurringQuoteRequest extends Request
|
|||||||
{
|
{
|
||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
|
|
||||||
|
if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) {
|
||||||
|
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||||
|
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ class Payment extends BaseModel
|
|||||||
const TYPE_TOKEN = 'token';
|
const TYPE_TOKEN = 'token';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
'assigned_user_id',
|
||||||
'client_id',
|
'client_id',
|
||||||
'type_id',
|
'type_id',
|
||||||
'amount',
|
'amount',
|
||||||
|
@ -32,11 +32,13 @@ class RecurringInvoicesCronTest extends TestCase
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
RecurringInvoice::truncate();
|
||||||
|
|
||||||
$this->makeTestData();
|
$this->makeTestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCountCorrectNumberOfRecurringInvoicesDue()
|
public function testCountCorrectNumberOfRecurringInvoicesDue()
|
||||||
{
|
{
|
||||||
//spin up 5 valid and 1 invalid recurring invoices
|
//spin up 5 valid and 1 invalid recurring invoices
|
||||||
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', Carbon::now()->addMinutes(30))->get();
|
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', Carbon::now()->addMinutes(30))->get();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user