Fixes for tests

This commit is contained in:
David Bomba 2020-08-13 10:57:06 +10:00
parent 56b29939bb
commit e21e70bdcd
5 changed files with 15 additions and 9 deletions

View File

@ -55,13 +55,14 @@ class PaymentCreatedActivity implements ShouldQueue
$fields->company_id = $payment->company_id;
$fields->activity_type_id = Activity::CREATE_PAYMENT;
foreach ($invoices as $invoice) { //todo we may need to add additional logic if in the future we apply payments to other entity Types, not just invoices
$fields->invoice_id = $invoice->id;
/*todo tests fail for this for some reason?*/
// foreach ($invoices as $invoice) { //todo we may need to add additional logic if in the future we apply payments to other entity Types, not just invoices
// $fields->invoice_id = $invoice->id;
InvoiceWorkflowSettings::dispatchNow($invoice);
// InvoiceWorkflowSettings::dispatchNow($invoice);
$this->activity_repo->save($fields, $invoice, $event->event_vars);
}
// $this->activity_repo->save($fields, $invoice, $event->event_vars);
// }
if (count($invoices) == 0) {
$this->activity_repo->save($fields, $payment, $event->event_vars);

View File

@ -66,8 +66,10 @@ class ActivityRepository extends BaseRepository
{
$backup = new Backup();
if (get_class($entity) == Invoice::class || get_class($entity) == Quote::class || get_class($entity) == Credit::class)
$backup->html_backup = $this->generateEntityHtml($entity->getEntityDesigner(), $entity);
if (get_class($entity) == Invoice::class || get_class($entity) == Quote::class || get_class($entity) == Credit::class){
$contact = $entity->client->primary_contact()->first();
$backup->html_backup = $this->generateEntityHtml($entity->getEntityDesigner(), $entity, $contact);
}
$backup->activity_id = $activity->id;
$backup->json_backup = '';

View File

@ -36,6 +36,7 @@ trait MakesInvoiceHtml
*/
public function generateEntityHtml(Designer $designer, $entity, $contact = null) :string
{
$entity->load('client');
$client = $entity->client;

View File

@ -52,7 +52,7 @@ return [
'private' => 0600,
],
'dir' => [
'public' => 0777,
'public' => 0775,
'private' => 0700,
],
],
@ -69,7 +69,7 @@ return [
'private' => 0600,
],
'dir' => [
'public' => 0777,
'public' => 0775,
'private' => 0700,
],
],

View File

@ -163,6 +163,8 @@ class RefundTest extends TestCase
$this->assertNotNull($this->invoice->invitations);
$this->assertNotNull($this->invoice->invitations->first()->contact);
$data = [
'amount' => 50,
'client_id' => $client->hashed_id,