1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Trying to fix chrome for laravel dusk - travis

This commit is contained in:
David Bomba 2019-04-24 11:49:41 +10:00
parent c2cd8e9d14
commit 56d4a98707
6 changed files with 96 additions and 6 deletions

View File

@ -4,6 +4,10 @@ sudo: true
dist: xenial dist: xenial
services:
- mysql
- xvfb
# Prevent tests from taking more than 50 minutes # Prevent tests from taking more than 50 minutes
group: deprecated-2017Q4 group: deprecated-2017Q4
@ -48,10 +52,6 @@ install:
# - sed -i '/2checkout/d' composer.json # - sed -i '/2checkout/d' composer.json
- travis_retry composer install --no-interaction - travis_retry composer install --no-interaction
services:
- mysql
- xvfb
before_script: before_script:
# copy configuration files # copy configuration files
- php artisan key:generate --no-interaction - php artisan key:generate --no-interaction
@ -72,6 +72,7 @@ before_script:
# Start webserver on ninja.test:8000 # Start webserver on ninja.test:8000
- export DISPLAY=:99.0 - export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start - sh -e /etc/init.d/xvfb start
- sleep 3
- ./vendor/laravel/dusk/bin/chromedriver-linux & - ./vendor/laravel/dusk/bin/chromedriver-linux &
- php artisan serve & - php artisan serve &

View File

@ -53,7 +53,7 @@ class ClientSettings extends BaseSettings
*/ */
public $industry_id; public $industry_id;
public $size_id; public $size_id;
public $invoice_email_list; //default comma separated list of contacts to email public $invoice_email_list; //default comma separated list of contact ids to email
/** /**
* Cast object values and return entire class * Cast object values and return entire class

View File

@ -0,0 +1,29 @@
<?php
namespace App\Events\Invoice;
use App\Models\Invoice;
use Illuminate\Queue\SerializesModels;
/**
* Class InvoiceWasMarkedSent.
*/
class InvoiceWasMarkedSent
{
use SerializesModels;
/**
* @var Invoice
*/
public $invoice;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice)
{
$this->invoice = $invoice;
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Listeners\Invoice;
use App\Models\ClientContact;
use App\Models\InvoiceInvitation;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class CreateInvoiceInvitations
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param object $event
* @return void
*/
public function handle($event)
{
$invoice = $event->invoice;
$contacts = ClientContact::whereIn('id', explode(',', $invoice->settings->invoice_email_list))->get();
$contacts->each(function ($contact) use($invoice) {
InvoiceInvitation::create([
]);
});
}
}

View File

@ -3,6 +3,7 @@
namespace App\Providers; namespace App\Providers;
use App\Events\Client\ClientWasCreated; use App\Events\Client\ClientWasCreated;
use App\Events\Invoice\InvoiceWasMarkedSent;
use App\Events\User\UserCreated; use App\Events\User\UserCreated;
use App\Listeners\Client\CreatedClientActivity; use App\Listeners\Client\CreatedClientActivity;
use App\Listeners\SendVerificationNotification; use App\Listeners\SendVerificationNotification;
@ -39,6 +40,13 @@ class EventServiceProvider extends ServiceProvider
'App\Events\ClientWasRestored' => [ 'App\Events\ClientWasRestored' => [
'App\Listeners\ActivityListener@restoredClient', 'App\Listeners\ActivityListener@restoredClient',
], ],
//Invoices
[
InvoiceWasMarkedSent::class => [
CreateInvoiceInvitations::class
]
],
]; ];
/** /**

View File

@ -4,6 +4,7 @@ namespace Tests\Feature;
use App\Models\Account; use App\Models\Account;
use App\Models\Client; use App\Models\Client;
use App\Models\ClientContact;
use App\Models\Company; use App\Models\Company;
use App\Models\User; use App\Models\User;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
@ -205,9 +206,16 @@ class ClientTest extends TestCase
$client = Client::all()->first(); $client = Client::all()->first();
/* Make sure we have a valid settings object*/
$this->assertEquals($client->getSettings()->timezone_id, 15); $this->assertEquals($client->getSettings()->timezone_id, 15);
/* 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->getSettings()->invoice_email_list))->get();
/* Make sure NULL settings return the correct count (0) instead of throwing an exception*/
$this->assertEquals(count($contacts), 0);
} }
} }