mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 06:24:35 -04:00
Fixes for tests - new implementation for invitations
This commit is contained in:
parent
96f61865d8
commit
4e4d134230
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Invoice Ninja (https://invoiceninja.com)
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
*
|
*
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
"beyondcode/laravel-dump-server": "^1.0",
|
"beyondcode/laravel-dump-server": "^1.0",
|
||||||
"filp/whoops": "^2.0",
|
"filp/whoops": "^2.0",
|
||||||
"fzaninotto/faker": "^1.4",
|
"fzaninotto/faker": "^1.4",
|
||||||
"laravel/dusk": "^4.0",
|
"laravel/dusk": "^5.0",
|
||||||
"mockery/mockery": "^1.0",
|
"mockery/mockery": "^1.0",
|
||||||
"nunomaduro/collision": "^2.0",
|
"nunomaduro/collision": "^2.0",
|
||||||
"phpunit/phpunit": "^7.0"
|
"phpunit/phpunit": "^7.0"
|
||||||
|
@ -226,7 +226,7 @@ class ClientTest extends TestCase
|
|||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'client_id' => $c->id,
|
'client_id' => $c->id,
|
||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
'is_primary' => 1
|
'is_primary' => 1,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
factory(\App\Models\ClientContact::class,2)->create([
|
factory(\App\Models\ClientContact::class,2)->create([
|
||||||
@ -247,10 +247,8 @@ class ClientTest extends TestCase
|
|||||||
/* Make sure we are harvesting valid data */
|
/* Make sure we are harvesting valid data */
|
||||||
$this->assertEquals($client->timezone()->name, 'US/Eastern');
|
$this->assertEquals($client->timezone()->name, 'US/Eastern');
|
||||||
|
|
||||||
$contacts = ClientContact::whereIn('id', explode(',', $client->getMergedSettings()->invoice_email_list))->get();
|
|
||||||
|
|
||||||
/* Make sure NULL settings return the correct count (0) instead of throwing an exception*/
|
/* Make sure NULL settings return the correct count (0) instead of throwing an exception*/
|
||||||
$this->assertEquals(count($contacts), 0);
|
$this->assertEquals($client->contacts->count(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ namespace Feature;
|
|||||||
use App\DataMapper\ClientSettings;
|
use App\DataMapper\ClientSettings;
|
||||||
use App\DataMapper\DefaultSettings;
|
use App\DataMapper\DefaultSettings;
|
||||||
use App\Events\Invoice\InvoiceWasMarkedSent;
|
use App\Events\Invoice\InvoiceWasMarkedSent;
|
||||||
|
use App\Factory\InvoiceInvitationFactory;
|
||||||
use App\Jobs\Account\CreateAccount;
|
use App\Jobs\Account\CreateAccount;
|
||||||
use App\Listeners\Invoice\CreateInvoiceInvitations;
|
use App\Listeners\Invoice\CreateInvoiceInvitations;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
@ -108,23 +109,13 @@ class InvitationTest extends TestCase
|
|||||||
$this->assertNotNull($invoice->client);
|
$this->assertNotNull($invoice->client);
|
||||||
$this->assertNotNull($invoice->client->primary_contact);
|
$this->assertNotNull($invoice->client->primary_contact);
|
||||||
|
|
||||||
$arr[] = $invoice->client->primary_contact->first()->id;
|
|
||||||
|
|
||||||
$settings = $invoice->settings;
|
$i = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id);
|
||||||
$settings->invoice_email_list = implode(",",$arr);
|
$i->client_contact_id = $client->primary_contact->first()->id;
|
||||||
|
$i->invoice_id = $invoice->id;
|
||||||
|
$i->save();
|
||||||
|
|
||||||
$invoice->settings = $settings;
|
$this->assertNotNull($invoice->invitations);
|
||||||
$invoice->save();
|
|
||||||
|
|
||||||
$listener = new CreateInvoiceInvitations();
|
|
||||||
|
|
||||||
$listener->handle(new InvoiceWasMarkedSent($invoice));
|
|
||||||
|
|
||||||
$i = InvoiceInvitation::whereClientContactId($invoice->client->primary_contact->first()->id)->whereInvoiceId($invoice->id)->first();
|
|
||||||
|
|
||||||
$this->assertNotNull($i);
|
|
||||||
|
|
||||||
$this->assertEquals($i->invoice_id, $invoice->id);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,6 @@ class CompareObjectTest extends TestCase
|
|||||||
$this->assertEquals($settings->currency_id, 1);
|
$this->assertEquals($settings->currency_id, 1);
|
||||||
$this->assertEquals($settings->language_id, 1);
|
$this->assertEquals($settings->language_id, 1);
|
||||||
$this->assertEquals($settings->payment_terms, 7);
|
$this->assertEquals($settings->payment_terms, 7);
|
||||||
$this->assertTrue(property_exists($settings, 'invoice_email_list'));
|
|
||||||
$this->assertEquals($settings->custom_taxes1, 'FALSE');
|
$this->assertEquals($settings->custom_taxes1, 'FALSE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user