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
eea6bf3659
commit
590e231308
@ -23,7 +23,7 @@ class DesignWasRestored
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public function __construct(public Design $design, public Company $company, public array $event_vars)
|
||||
public function __construct(public Design $design, public bool $fromDeleted, public Company $company, public array $event_vars)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -19,26 +19,7 @@ class ProductWasArchived
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Product
|
||||
*/
|
||||
public $product;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Product $product
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(Product $product, Company $company, array $event_vars)
|
||||
public function __construct(public Product $product, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->product = $product;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -19,30 +19,7 @@ class ProductWasCreated
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Product
|
||||
*/
|
||||
public $product;
|
||||
|
||||
public $input;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Product $product
|
||||
* @param $input
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(Product $product, $input, Company $company, array $event_vars)
|
||||
public function __construct(public Product $product, public mixed $input, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->product = $product;
|
||||
$this->input = $input;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -19,26 +19,7 @@ class ProductWasDeleted
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Product
|
||||
*/
|
||||
public $product;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Product $product
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(Product $product, Company $company, array $event_vars)
|
||||
public function __construct(public Product $product, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->product = $product;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Events\Product;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
@ -18,26 +19,7 @@ class ProductWasUpdated
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Product
|
||||
*/
|
||||
public $product;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Product $product
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(Product $product, Company $company, array $event_vars)
|
||||
public function __construct(public Product $product, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->product = $product;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace App\Events\PurchaseOrder;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
@ -23,26 +22,7 @@ class PurchaseOrderWasEmailed
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var PurchaseOrder
|
||||
*/
|
||||
public $invitation;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param PurchaseOrder $purchase_order
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(PurchaseOrderInvitation $invitation, Company $company, array $event_vars)
|
||||
public function __construct(public PurchaseOrderInvitation $invitation, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->invitation = $invitation;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -22,29 +22,7 @@ class PurchaseOrderWasRestored
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var PurchaseOrder
|
||||
*/
|
||||
public $purchase_order;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
public $fromDeleted;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param PurchaseOrder $purchase_order
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(PurchaseOrder $purchase_order, $fromDeleted, Company $company, array $event_vars)
|
||||
public function __construct(public PurchaseOrder $purchase_order, public bool $fromDeleted, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->purchase_order = $purchase_order;
|
||||
$this->fromDeleted = $fromDeleted;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -22,26 +22,7 @@ class PurchaseOrderWasUpdated
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var PurchaseOrder
|
||||
*/
|
||||
public $purchase_order;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param PurchaseOrder $purchase_order
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(PurchaseOrder $purchase_order, Company $company, array $event_vars)
|
||||
public function __construct(public PurchaseOrder $purchase_order, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->purchase_order = $purchase_order;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -23,26 +23,7 @@ class PurchaseOrderWasViewed
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var PurchaseOrder
|
||||
*/
|
||||
public $invitation;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param PurchaseOrder $purchase_order
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(PurchaseOrderInvitation $invitation, Company $company, array $event_vars)
|
||||
public function __construct(public PurchaseOrderInvitation $invitation, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->invitation = $invitation;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -23,27 +23,7 @@ class QuoteWasEmailed
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public $invitation;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
public $template;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Quote $quote
|
||||
* @param string $notes
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(QuoteInvitation $invitation, Company $company, array $event_vars, string $template)
|
||||
public function __construct(public QuoteInvitation $invitation, public Company $company, public array $event_vars, public string $template)
|
||||
{
|
||||
$this->invitation = $invitation;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
$this->template = $template;
|
||||
}
|
||||
}
|
||||
|
@ -22,26 +22,7 @@ class RecurringInvoiceWasArchived
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Invoice
|
||||
*/
|
||||
public $recurring_invoice;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Invoice $recurring_invoice
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(RecurringInvoice $recurring_invoice, Company $company, array $event_vars)
|
||||
public function __construct(public RecurringInvoice $recurring_invoice, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->recurring_invoice = $recurring_invoice;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -21,27 +21,8 @@ use Illuminate\Queue\SerializesModels;
|
||||
class RecurringInvoiceWasDeleted
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var RecurringInvoice
|
||||
*/
|
||||
public $recurring_invoice;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Invoice $invoice
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(RecurringInvoice $recurring_invoice, Company $company, array $event_vars)
|
||||
|
||||
public function __construct(public RecurringInvoice $recurring_invoice, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->recurring_invoice = $recurring_invoice;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -22,30 +22,7 @@ class RecurringInvoiceWasRestored
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var RecurringInvoice
|
||||
*/
|
||||
public $recurring_invoice;
|
||||
|
||||
public $fromDeleted;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Invoice $invoice
|
||||
* @param $fromDeleted
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(RecurringInvoice $recurring_invoice, $fromDeleted, Company $company, array $event_vars)
|
||||
public function __construct(public RecurringInvoice $recurring_invoice, public bool $fromDeleted, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->recurring_invoice = $recurring_invoice;
|
||||
$this->fromDeleted = $fromDeleted;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -24,26 +24,8 @@ class RecurringQuoteWasUpdated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Invoice
|
||||
*/
|
||||
public $recurring_quote;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param RecurringQuote $recurring_quote
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(RecurringQuote $recurring_quote, Company $company, array $event_vars)
|
||||
public function __construct(public RecurringQuote $recurring_quote, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->recurring_quote = $recurring_quote;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
||||
|
@ -26,27 +26,8 @@ class UserLoggedIn
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $user;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param User $user
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(User $user, Company $company, array $event_vars)
|
||||
public function __construct(public User $user, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,30 +26,8 @@ class UserWasArchived
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $user;
|
||||
|
||||
public $creating_user;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param User $user
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(User $user, User $creating_user, Company $company, array $event_vars)
|
||||
public function __construct(public User $user, public User $creating_user, public Company $company, public array $event_vars)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->creating_user = $creating_user;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,13 +11,18 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Design;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Tests\MockAccountData;
|
||||
use Tests\TestCase;
|
||||
use App\Models\Design;
|
||||
use Tests\MockAccountData;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Events\Design\DesignWasCreated;
|
||||
use App\Events\Design\DesignWasDeleted;
|
||||
use App\Events\Design\DesignWasUpdated;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use App\Events\Design\DesignWasArchived;
|
||||
use App\Events\Design\DesignWasRestored;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* @test
|
||||
@ -47,14 +52,6 @@ class DesignApiTest extends TestCase
|
||||
public function testDesignPost()
|
||||
{
|
||||
|
||||
$this->expectsEvents([
|
||||
TaskWasCreated::class,
|
||||
TaskWasUpdated::class,
|
||||
// TaskWasArchived::class,
|
||||
// TaskWasRestored::class,
|
||||
// TaskWasDeleted::class,
|
||||
]);
|
||||
|
||||
$design = [
|
||||
'body' => 'body',
|
||||
'includes' => 'includes',
|
||||
@ -137,13 +134,6 @@ class DesignApiTest extends TestCase
|
||||
public function testDesignArchive()
|
||||
{
|
||||
|
||||
$this->expectsEvents([
|
||||
TaskWasArchived::class,
|
||||
TaskWasRestored::class,
|
||||
TaskWasDeleted::class,
|
||||
]);
|
||||
|
||||
|
||||
$design = [
|
||||
'body' => 'body',
|
||||
'includes' => 'includes',
|
||||
|
Loading…
x
Reference in New Issue
Block a user