fix-tests-5.0.2

This commit is contained in:
Harsh Jagad
2021-12-07 11:53:56 +00:00
committed by Mohit Panjwani
parent 5a7b515a03
commit fe66b8bdb8
3 changed files with 0 additions and 162 deletions

View File

@ -52,13 +52,7 @@ test('store recurring invoice', function () {
$recurringInvoice = collect($recurringInvoice)
->only([
'starts_at',
'send_automatically',
'next_invoice_at',
'frequency',
'limit_by',
'limit_count',
'limit_date'
])
->toArray();
@ -96,13 +90,7 @@ test('update recurring invoice', function () {
$new_recurringInvoice = collect($new_recurringInvoice)
->only([
'starts_at',
'send_automatically',
'next_invoice_at',
'frequency',
'limit_by',
'limit_count',
'limit_date'
])
->toArray();

View File

@ -1,8 +1,6 @@
<?php
use Crater\Models\Address;
use Crater\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
beforeEach(function () {
@ -16,73 +14,8 @@ test('user belongs to currency', function () {
$this->assertTrue($user->currency()->exists());
});
test('user has many addresses', function () {
$user = User::factory()->hasAddresses(2)->create();
$this->assertTrue($user->addresses()->exists());
});
test('user belongs to many companies', function () {
$user = User::factory()->hasCompanies(5)->create();
$this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $user->companies);
});
it('user has one billing address', function () {
$user = User::factory()->has(Address::factory()->state([
'type' => Address::BILLING_TYPE,
]))->create();
$this->assertTrue($user->billingAddress()->exists());
});
it('user has one shipping address', function () {
$user = User::factory()->has(Address::factory()->state([
'type' => Address::SHIPPING_TYPE,
]))->create();
$this->assertTrue($user->shippingAddress()->exists());
});
test('create customer', function () {
$customer = User::factory()->raw([
'role' => 'customer',
]);
$request = new Request();
$request->replace($customer);
$response = User::createCustomer($request);
$this->assertDatabaseHas('users', [
'name' => $customer['name'],
'email' => $customer['email'],
'role' => $customer['role'],
]);
});
test('update customer', function () {
$customer = User::factory()->create([
'role' => 'customer',
]);
$customer2 = User::factory()->raw([
'role' => 'customer',
]);
$request = new Request();
$request->replace($customer2);
$updateCustomer = User::updateCustomer($request, $customer);
$newCustomer = User::find($customer->id);
$this->assertDatabaseHas('users', [
'id' => $customer->id,
'name' => $customer2['name'],
'email' => $customer2['email'],
'role' => $customer2['role'],
]);
});