Using existing customer
Already [creating](https://github.com/akaunting/akaunting/blob/master/database/seeds/TestCompany.php#L78) customer during testing
This commit is contained in:
parent
76e9eb39be
commit
93bc59409e
@ -5,7 +5,6 @@ namespace Tests\Feature;
|
||||
use App\Models\Auth\User;
|
||||
use App\Models\Common\Contact;
|
||||
use App\Models\Document\Document;
|
||||
use App\Jobs\Common\CreateContact;
|
||||
use App\Jobs\Document\CreateDocument;
|
||||
use App\Jobs\Setting\CreateCurrency;
|
||||
use Illuminate\Support\Facades\File;
|
||||
@ -52,7 +51,7 @@ class PaymentTestCase extends FeatureTestCase
|
||||
|
||||
$this->updateSetting();
|
||||
|
||||
$this->createCustomer();
|
||||
$this->loginAsCustomer();
|
||||
|
||||
$this->createInvoice();
|
||||
|
||||
@ -140,20 +139,11 @@ class PaymentTestCase extends FeatureTestCase
|
||||
$this->invoice = $this->dispatch(new CreateDocument($this->getInvoiceRequest()));
|
||||
}
|
||||
|
||||
public function createCustomer()
|
||||
public function loginAsCustomer()
|
||||
{
|
||||
$password = $this->faker->password;
|
||||
$this->customer = Contact::customer()->first();
|
||||
|
||||
$request = Contact::factory()->customer()->enabled()->raw() + [
|
||||
'create_user' => 'true',
|
||||
'locale' => 'en-GB',
|
||||
'password' => $password,
|
||||
'password_confirmation' => $password,
|
||||
];
|
||||
|
||||
$this->customer = $this->dispatch(new CreateContact($request));
|
||||
|
||||
$this->customer_user = User::where('email', $request['email'])->first();
|
||||
$this->customer_user = User::where('email', $this->customer->email)->first();
|
||||
}
|
||||
|
||||
public function getInvoiceRequest()
|
||||
|
Loading…
x
Reference in New Issue
Block a user