Swap assertEquals parameter order

This commit is contained in:
Marcus Moore 2024-10-03 13:15:02 -07:00
parent 863c0a8b60
commit b5ffe54bd0
No known key found for this signature in database
6 changed files with 307 additions and 307 deletions

View file

@ -81,23 +81,23 @@ class ImportAccessoriesTest extends ImportDataTestCase
->where('item_id', $newAccessory->id) ->where('item_id', $newAccessory->id)
->sole(); ->sole();
$this->assertEquals($activityLog->action_type, 'create'); $this->assertEquals('create', $activityLog->action_type);
$this->assertEquals($activityLog->action_source, 'importer'); $this->assertEquals('importer', $activityLog->action_source);
$this->assertEquals($activityLog->company_id, $newAccessory->company->id); $this->assertEquals($newAccessory->company->id, $activityLog->company_id);
$this->assertEquals($newAccessory->name, $row['itemName']); $this->assertEquals($row['itemName'], $newAccessory->name);
$this->assertEquals($newAccessory->qty, $row['quantity']); $this->assertEquals($row['quantity'], $newAccessory->qty);
$this->assertEquals($newAccessory->purchase_date->toDateString(), $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $newAccessory->purchase_date->toDateString());
$this->assertEquals($newAccessory->purchase_cost, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $newAccessory->purchase_cost);
$this->assertEquals($newAccessory->order_number, $row['orderNumber']); $this->assertEquals($row['orderNumber'], $newAccessory->order_number);
$this->assertEquals($newAccessory->notes, $row['notes']); $this->assertEquals($row['notes'], $newAccessory->notes);
$this->assertEquals($newAccessory->category->name, $row['category']); $this->assertEquals($row['category'], $newAccessory->category->name);
$this->assertEquals($newAccessory->category->category_type, 'accessory'); $this->assertEquals('accessory', $newAccessory->category->category_type);
$this->assertEquals($newAccessory->manufacturer->name, $row['manufacturerName']); $this->assertEquals($row['manufacturerName'], $newAccessory->manufacturer->name);
$this->assertEquals($newAccessory->supplier->name, $row['supplierName']); $this->assertEquals($row['supplierName'], $newAccessory->supplier->name);
$this->assertEquals($newAccessory->location->name, $row['location']); $this->assertEquals($row['location'], $newAccessory->location->name);
$this->assertEquals($newAccessory->company->name, $row['companyName']); $this->assertEquals($row['companyName'], $newAccessory->company->name);
$this->assertEquals($newAccessory->model_number, $row['modelNumber']); $this->assertEquals($row['modelNumber'], $newAccessory->model_number);
$this->assertFalse($newAccessory->requestable); $this->assertFalse($newAccessory->requestable);
$this->assertNull($newAccessory->min_amt); $this->assertNull($newAccessory->min_amt);
$this->assertNull($newAccessory->user_id); $this->assertNull($newAccessory->user_id);
@ -131,7 +131,7 @@ class ImportAccessoriesTest extends ImportDataTestCase
->where('name', $importFileBuilder->firstRow()['itemName']) ->where('name', $importFileBuilder->firstRow()['itemName'])
->sole(['purchase_date']); ->sole(['purchase_date']);
$this->assertEquals($accessory->purchase_date->toDateString(), '2022-10-10'); $this->assertEquals('2022-10-10', $accessory->purchase_date->toDateString());
} }
#[Test] #[Test]
@ -165,7 +165,7 @@ class ImportAccessoriesTest extends ImportDataTestCase
->get(['name']); ->get(['name']);
$this->assertCount(1, $probablyNewAccessories); $this->assertCount(1, $probablyNewAccessories);
$this->assertEquals($probablyNewAccessories->first()->name, $accessory->name); $this->assertEquals($accessory->name, $probablyNewAccessories->first()->name);
} }
#[Test] #[Test]
@ -292,23 +292,23 @@ class ImportAccessoriesTest extends ImportDataTestCase
'location_id', 'model_number', 'updated_at' 'location_id', 'model_number', 'updated_at'
]; ];
$this->assertEquals($updatedAccessory->name, $row['itemName']); $this->assertEquals($row['itemName'], $updatedAccessory->name);
$this->assertEquals($row['companyName'], $updatedAccessory->company->name); $this->assertEquals($row['companyName'], $updatedAccessory->company->name);
$this->assertEquals($updatedAccessory->qty, $row['quantity']); $this->assertEquals($row['quantity'], $updatedAccessory->qty);
$this->assertEquals($updatedAccessory->purchase_date->toDateString(), $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $updatedAccessory->purchase_date->toDateString());
$this->assertEquals($updatedAccessory->purchase_cost, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $updatedAccessory->purchase_cost);
$this->assertEquals($updatedAccessory->order_number, $row['orderNumber']); $this->assertEquals($row['orderNumber'], $updatedAccessory->order_number);
$this->assertEquals($updatedAccessory->notes, $row['notes']); $this->assertEquals($row['notes'], $updatedAccessory->notes);
$this->assertEquals($updatedAccessory->category->name, $row['category']); $this->assertEquals($row['category'], $updatedAccessory->category->name);
$this->assertEquals($updatedAccessory->category->category_type, 'accessory'); $this->assertEquals('accessory', $updatedAccessory->category->category_type);
$this->assertEquals($updatedAccessory->manufacturer->name, $row['manufacturerName']); $this->assertEquals($row['manufacturerName'], $updatedAccessory->manufacturer->name);
$this->assertEquals($updatedAccessory->supplier->name, $row['supplierName']); $this->assertEquals($row['supplierName'], $updatedAccessory->supplier->name);
$this->assertEquals($updatedAccessory->location->name, $row['location']); $this->assertEquals($row['location'], $updatedAccessory->location->name);
$this->assertEquals($updatedAccessory->model_number, $row['modelNumber']); $this->assertEquals($row['modelNumber'], $updatedAccessory->model_number);
$this->assertEquals( $this->assertEquals(
Arr::except($updatedAccessory->attributesToArray(), $updatedAttributes),
Arr::except($accessory->attributesToArray(), $updatedAttributes), Arr::except($accessory->attributesToArray(), $updatedAttributes),
Arr::except($updatedAccessory->attributesToArray(), $updatedAttributes),
); );
} }
@ -362,7 +362,7 @@ class ImportAccessoriesTest extends ImportDataTestCase
$updatedAccessory = clone $accessory; $updatedAccessory = clone $accessory;
$updatedAccessory->refresh(); $updatedAccessory->refresh();
$this->assertEquals($updatedAccessory->toArray(), $accessory->toArray()); $this->assertEquals($accessory->toArray(), $updatedAccessory->toArray());
} }
#[Test] #[Test]
@ -412,15 +412,15 @@ class ImportAccessoriesTest extends ImportDataTestCase
->where('name', $row['modelNumber']) ->where('name', $row['modelNumber'])
->sole(); ->sole();
$this->assertEquals($newAccessory->name, $row['modelNumber']); $this->assertEquals($row['modelNumber'], $newAccessory->name);
$this->assertEquals($newAccessory->model_number, $row['itemName']); $this->assertEquals($row['itemName'], $newAccessory->model_number);
$this->assertEquals($newAccessory->qty, $row['quantity']); $this->assertEquals($row['quantity'], $newAccessory->qty);
$this->assertEquals($newAccessory->purchase_date->toDateString(), $row['notes']); $this->assertEquals($row['notes'], $newAccessory->purchase_date->toDateString());
$this->assertEquals($newAccessory->purchase_cost, $row['location']); $this->assertEquals($row['location'], $newAccessory->purchase_cost);
$this->assertEquals($newAccessory->order_number, $row['companyName']); $this->assertEquals($row['companyName'], $newAccessory->order_number);
$this->assertEquals($newAccessory->notes, $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $newAccessory->notes);
$this->assertEquals($newAccessory->category->name, $row['manufacturerName']); $this->assertEquals($row['manufacturerName'], $newAccessory->category->name);
$this->assertEquals($newAccessory->manufacturer->name, $row['category']); $this->assertEquals($row['category'], $newAccessory->manufacturer->name);
$this->assertEquals($newAccessory->location->name, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $newAccessory->location->name);
} }
} }

View file

@ -89,60 +89,60 @@ class ImportAssetsTest extends ImportDataTestCase
$this->assertCount(2, $activityLogs); $this->assertCount(2, $activityLogs);
$this->assertEquals($activityLogs[0]->action_type, 'checkout'); $this->assertEquals('checkout', $activityLogs[0]->action_type);
$this->assertEquals($activityLogs[0]->item_type, Asset::class); $this->assertEquals(Asset::class, $activityLogs[0]->item_type);
$this->assertEquals($activityLogs[0]->target_id, $assignee->id); $this->assertEquals($assignee->id, $activityLogs[0]->target_id);
$this->assertEquals($activityLogs[0]->target_type, User::class); $this->assertEquals(User::class, $activityLogs[0]->target_type);
$this->assertEquals($activityLogs[0]->note, 'Checkout from CSV Importer'); $this->assertEquals('Checkout from CSV Importer', $activityLogs[0]->note);
$this->assertEquals($activityLogs[1]->action_type, 'create'); $this->assertEquals('create', $activityLogs[1]->action_type);
$this->assertNull($activityLogs[1]->target_id); $this->assertNull($activityLogs[1]->target_id);
$this->assertEquals($activityLogs[1]->item_type, Asset::class); $this->assertEquals(Asset::class, $activityLogs[1]->item_type);
$this->assertNull($activityLogs[1]->note); $this->assertNull($activityLogs[1]->note);
$this->assertNull($activityLogs[1]->target_type); $this->assertNull($activityLogs[1]->target_type);
$this->assertEquals("{$assignee->first_name} {$assignee->last_name}", $row['assigneeFullName']); $this->assertEquals($row['assigneeFullName'], "{$assignee->first_name} {$assignee->last_name}");
$this->assertEquals($assignee->email, $row['assigneeEmail']); $this->assertEquals($row['assigneeEmail'], $assignee->email);
$this->assertEquals($assignee->username, $row['assigneeUsername']); $this->assertEquals($row['assigneeUsername'], $assignee->username);
$this->assertEquals($newAsset->model->category->name, $row['category']); $this->assertEquals($row['category'], $newAsset->model->category->name);
$this->assertEquals($newAsset->model->manufacturer->name, $row['manufacturerName']); $this->assertEquals($row['manufacturerName'], $newAsset->model->manufacturer->name);
$this->assertEquals($newAsset->name, $row['itemName']); $this->assertEquals($row['itemName'], $newAsset->name);
$this->assertEquals($newAsset->asset_tag, $row['tag']); $this->assertEquals($row['tag'], $newAsset->asset_tag);
$this->assertEquals($newAsset->model->name, $row['model']); $this->assertEquals($row['model'], $newAsset->model->name);
$this->assertEquals($newAsset->model->model_number, $row['modelNumber']); $this->assertEquals($row['modelNumber'], $newAsset->model->model_number);
$this->assertEquals($newAsset->purchase_date->toDateString(), $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $newAsset->purchase_date->toDateString());
$this->assertNull($newAsset->asset_eol_date); $this->assertNull($newAsset->asset_eol_date);
$this->assertEquals(0, $newAsset->eol_explicit); $this->assertEquals(0, $newAsset->eol_explicit);
$this->assertEquals($newAsset->location_id, $newAsset->rtd_location_id); $this->assertEquals($newAsset->location_id, $newAsset->rtd_location_id);
$this->assertEquals($newAsset->purchase_cost, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $newAsset->purchase_cost);
$this->assertNull($newAsset->order_number); $this->assertNull($newAsset->order_number);
$this->assertEquals($newAsset->image, ''); $this->assertEquals('', $newAsset->image);
$this->assertNull($newAsset->user_id); $this->assertNull($newAsset->user_id);
$this->assertEquals($newAsset->physical, 1); $this->assertEquals(1, $newAsset->physical);
$this->assertEquals($newAsset->assetStatus->name, $row['status']); $this->assertEquals($row['status'], $newAsset->assetStatus->name);
$this->assertEquals($newAsset->archived, 0); $this->assertEquals(0, $newAsset->archived);
$this->assertEquals($newAsset->warranty_months, $row['warrantyInMonths']); $this->assertEquals($row['warrantyInMonths'], $newAsset->warranty_months);
$this->assertNull($newAsset->deprecate); $this->assertNull($newAsset->deprecate);
$this->assertEquals($newAsset->supplier->name, $row['supplierName']); $this->assertEquals($row['supplierName'], $newAsset->supplier->name);
$this->assertEquals($newAsset->requestable, 0); $this->assertEquals(0, $newAsset->requestable);
$this->assertEquals($newAsset->defaultLoc->name, $row['location']); $this->assertEquals($row['location'], $newAsset->defaultLoc->name);
$this->assertEquals($newAsset->accepted, null); $this->assertEquals(null, $newAsset->accepted);
$this->assertEquals(Carbon::parse($newAsset->last_checkout)->toDateString(), now()->toDateString()); $this->assertEquals(now()->toDateString(), Carbon::parse($newAsset->last_checkout)->toDateString());
$this->assertEquals($newAsset->last_checkin, 0); $this->assertEquals(0, $newAsset->last_checkin);
$this->assertEquals($newAsset->expected_checkin, 0); $this->assertEquals(0, $newAsset->expected_checkin);
$this->assertEquals($newAsset->company->name, $row['companyName']); $this->assertEquals($row['companyName'], $newAsset->company->name);
$this->assertEquals($newAsset->assigned_type, User::class); $this->assertEquals(User::class, $newAsset->assigned_type);
$this->assertNull($newAsset->last_audit_date); $this->assertNull($newAsset->last_audit_date);
$this->assertNull($newAsset->next_audit_date); $this->assertNull($newAsset->next_audit_date);
$this->assertEquals($newAsset->location->name, $row['location']); $this->assertEquals($row['location'], $newAsset->location->name);
$this->assertEquals($newAsset->checkin_counter, 0); $this->assertEquals(0, $newAsset->checkin_counter);
$this->assertEquals($newAsset->checkout_counter, 1); $this->assertEquals(1, $newAsset->checkout_counter);
$this->assertEquals($newAsset->requests_counter, 0); $this->assertEquals(0, $newAsset->requests_counter);
$this->assertEquals($newAsset->byod, 0); $this->assertEquals(0, $newAsset->byod);
//Notes is never read. //Notes is never read.
//$this->assertEquals($asset->notes, $row['notes']); // $this->assertEquals($row['notes'], $newAsset->notes);
Notification::assertSentTo($assignee, CheckoutAssetNotification::class); Notification::assertSentTo($assignee, CheckoutAssetNotification::class);
} }
@ -309,7 +309,7 @@ class ImportAssetsTest extends ImportDataTestCase
->where('serial', $importFileBuilder->firstRow()['serialNumber']) ->where('serial', $importFileBuilder->firstRow()['serialNumber'])
->sole(); ->sole();
$this->assertEquals($newAsset->assetStatus->name, 'Ready to Deploy'); $this->assertEquals('Ready to Deploy', $newAsset->assetStatus->name);
$this->assertNull($newAsset->purchase_date); $this->assertNull($newAsset->purchase_date);
$this->assertNull($newAsset->purchase_cost); $this->assertNull($newAsset->purchase_cost);
} }
@ -331,8 +331,8 @@ class ImportAssetsTest extends ImportDataTestCase
->where('serial', $importFileBuilder->firstRow()['serialNumber']) ->where('serial', $importFileBuilder->firstRow()['serialNumber'])
->sole(); ->sole();
$this->assertEquals($newAsset->warranty_months, 3); $this->assertEquals(3, $newAsset->warranty_months);
$this->assertEquals($newAsset->purchase_date->toDateString(), '2022-10-10'); $this->assertEquals('2022-10-10', $newAsset->purchase_date->toDateString());
} }
#[Test] #[Test]
@ -406,33 +406,33 @@ class ImportAssetsTest extends ImportDataTestCase
'last_checkout', 'requestable', 'updated_at', 'checkout_counter', 'assigned_type' 'last_checkout', 'requestable', 'updated_at', 'checkout_counter', 'assigned_type'
]; ];
$this->assertEquals("{$assignee->first_name} {$assignee->last_name}", $row['assigneeFullName']); $this->assertEquals($row['assigneeFullName'], "{$assignee->first_name} {$assignee->last_name}");
$this->assertEquals($assignee->email, $row['assigneeEmail']); $this->assertEquals($row['assigneeEmail'], $assignee->email);
$this->assertEquals($assignee->username, $row['assigneeUsername']); $this->assertEquals($row['assigneeUsername'], $assignee->username);
$this->assertEquals($updatedAsset->model->category->name, $row['category']); $this->assertEquals($row['category'], $updatedAsset->model->category->name);
$this->assertEquals($updatedAsset->model->manufacturer->name, $row['manufacturerName']); $this->assertEquals($row['manufacturerName'], $updatedAsset->model->manufacturer->name);
$this->assertEquals($updatedAsset->name, $row['itemName']); $this->assertEquals($row['itemName'], $updatedAsset->name);
$this->assertEquals($updatedAsset->asset_tag, $row['tag']); $this->assertEquals($row['tag'], $updatedAsset->asset_tag);
$this->assertEquals($updatedAsset->model->name, $row['model']); $this->assertEquals($row['model'], $updatedAsset->model->name);
$this->assertEquals($updatedAsset->model->model_number, $row['modelNumber']); $this->assertEquals($row['modelNumber'], $updatedAsset->model->model_number);
$this->assertEquals($updatedAsset->purchase_date->toDateString(), $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $updatedAsset->purchase_date->toDateString());
$this->assertEquals($updatedAsset->purchase_cost, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $updatedAsset->purchase_cost);
$this->assertEquals($updatedAsset->assetStatus->name, $row['status']); $this->assertEquals($row['status'], $updatedAsset->assetStatus->name);
$this->assertEquals($updatedAsset->warranty_months, $row['warrantyInMonths']); $this->assertEquals($row['warrantyInMonths'], $updatedAsset->warranty_months);
$this->assertEquals($updatedAsset->supplier->name, $row['supplierName']); $this->assertEquals($row['supplierName'], $updatedAsset->supplier->name);
$this->assertEquals($updatedAsset->defaultLoc->name, $row['location']); $this->assertEquals($row['location'], $updatedAsset->defaultLoc->name);
$this->assertEquals($updatedAsset->company->name, $row['companyName']); $this->assertEquals($row['companyName'], $updatedAsset->company->name);
$this->assertEquals($updatedAsset->location->name, $row['location']); $this->assertEquals($row['location'], $updatedAsset->location->name);
$this->assertEquals($updatedAsset->checkout_counter, 1); $this->assertEquals(1, $updatedAsset->checkout_counter);
$this->assertEquals($updatedAsset->assigned_type, user::class); $this->assertEquals(user::class, $updatedAsset->assigned_type);
//RequestAble is always updated regardless of initial value. //RequestAble is always updated regardless of initial value.
//$this->assertEquals($updatedAsset->requestable, $asset->requestable); // $this->assertEquals($asset->requestable, $updatedAsset->requestable);
$this->assertEquals( $this->assertEquals(
Arr::except($updatedAsset->attributesToArray(), $updatedAttributes),
Arr::except($asset->attributesToArray(), $updatedAttributes), Arr::except($asset->attributesToArray(), $updatedAttributes),
Arr::except($updatedAsset->attributesToArray(), $updatedAttributes),
); );
} }
@ -497,45 +497,45 @@ class ImportAssetsTest extends ImportDataTestCase
$assignee = User::query()->find($asset->assigned_to, ['id', 'first_name', 'last_name', 'email', 'username']); $assignee = User::query()->find($asset->assigned_to, ['id', 'first_name', 'last_name', 'email', 'username']);
$this->assertEquals("{$assignee->first_name} {$assignee->last_name}", $row['warrantyInMonths']); $this->assertEquals($row['warrantyInMonths'], "{$assignee->first_name} {$assignee->last_name}");
$this->assertEquals($assignee->email, $row['tag']); $this->assertEquals($row['tag'], $assignee->email);
$this->assertEquals($assignee->username, $row['location']); $this->assertEquals($row['location'], $assignee->username);
$this->assertEquals($asset->model->category->name, $row['modelNumber']); $this->assertEquals($row['modelNumber'], $asset->model->category->name);
$this->assertEquals($asset->model->manufacturer->name, $row['assigneeEmail']); $this->assertEquals($row['assigneeEmail'], $asset->model->manufacturer->name);
$this->assertEquals($asset->name, $row['model']); $this->assertEquals($row['model'], $asset->name);
$this->assertEquals($asset->asset_tag, $row['serialNumber']); $this->assertEquals($row['serialNumber'], $asset->asset_tag);
$this->assertEquals($asset->model->name, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $asset->model->name);
$this->assertEquals($asset->model->model_number, $row['itemName']); $this->assertEquals($row['itemName'], $asset->model->model_number);
$this->assertEquals($asset->purchase_date->toDateString(), $row['supplierName']); $this->assertEquals($row['supplierName'], $asset->purchase_date->toDateString());
$this->assertEquals($asset->purchase_cost, $row['companyName']); $this->assertEquals($row['companyName'], $asset->purchase_cost);
$this->assertEquals($asset->assetStatus->name, $row['manufacturerName']); $this->assertEquals($row['manufacturerName'], $asset->assetStatus->name);
$this->assertEquals($asset->warranty_months, $row['status']); $this->assertEquals($row['status'], $asset->warranty_months);
$this->assertEquals($asset->supplier->name, $row['assigneeFullName']); $this->assertEquals($row['assigneeFullName'], $asset->supplier->name);
$this->assertEquals($asset->defaultLoc->name, $row['category']); $this->assertEquals($row['category'], $asset->defaultLoc->name);
$this->assertEquals($asset->company->name, $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $asset->company->name);
$this->assertEquals($asset->location->name, $row['category']); $this->assertEquals($row['category'], $asset->location->name);
$this->assertEquals($asset->notes, $row['notes']); $this->assertEquals($row['notes'], $asset->notes);
$this->assertNull($asset->asset_eol_date); $this->assertNull($asset->asset_eol_date);
$this->assertEquals(0, $asset->eol_explicit); $this->assertEquals(0, $asset->eol_explicit);
$this->assertNull($asset->order_number); $this->assertNull($asset->order_number);
$this->assertEquals($asset->image, ''); $this->assertEquals('', $asset->image);
$this->assertNull($asset->user_id); $this->assertNull($asset->user_id);
$this->assertEquals($asset->physical, 1); $this->assertEquals(1, $asset->physical);
$this->assertEquals($asset->archived, 0); $this->assertEquals(0, $asset->archived);
$this->assertNull($asset->deprecate); $this->assertNull($asset->deprecate);
$this->assertEquals($asset->requestable, 0); $this->assertEquals(0, $asset->requestable);
$this->assertEquals($asset->accepted, null); $this->assertEquals(null, $asset->accepted);
$this->assertEquals(Carbon::parse($asset->last_checkout)->toDateString(), now()->toDateString()); $this->assertEquals(now()->toDateString(), Carbon::parse($asset->last_checkout)->toDateString());
$this->assertEquals($asset->last_checkin, 0); $this->assertEquals(0, $asset->last_checkin);
$this->assertEquals($asset->expected_checkin, 0); $this->assertEquals(0, $asset->expected_checkin);
$this->assertEquals($asset->assigned_type, User::class); $this->assertEquals(User::class, $asset->assigned_type);
$this->assertNull($asset->last_audit_date); $this->assertNull($asset->last_audit_date);
$this->assertNull($asset->next_audit_date); $this->assertNull($asset->next_audit_date);
$this->assertEquals($asset->checkin_counter, 0); $this->assertEquals(0, $asset->checkin_counter);
$this->assertEquals($asset->checkout_counter, 1); $this->assertEquals(1, $asset->checkout_counter);
$this->assertEquals($asset->requests_counter, 0); $this->assertEquals(0, $asset->requests_counter);
$this->assertEquals($asset->byod, 0); $this->assertEquals(0, $asset->byod);
} }
#[Test] #[Test]
@ -565,7 +565,7 @@ class ImportAssetsTest extends ImportDataTestCase
$newAsset = Asset::query()->where('serial', $importFileBuilder->firstRow()['serialNumber'])->sole(); $newAsset = Asset::query()->where('serial', $importFileBuilder->firstRow()['serialNumber'])->sole();
$this->assertEquals($newAsset->getAttribute($customField->db_column), $macAddress); $this->assertEquals($macAddress, $newAsset->getAttribute($customField->db_column));
} }
#[Test] #[Test]

View file

@ -79,21 +79,21 @@ class ImportComponentsTest extends ImportDataTestCase
->where('item_id', $newComponent->id) ->where('item_id', $newComponent->id)
->sole(); ->sole();
$this->assertEquals($activityLog->action_type, 'create'); $this->assertEquals('create', $activityLog->action_type);
$this->assertEquals($activityLog->action_source, 'importer'); $this->assertEquals('importer', $activityLog->action_source);
$this->assertEquals($activityLog->company_id, $newComponent->company->id); $this->assertEquals($newComponent->company->id, $activityLog->company_id);
$this->assertEquals($newComponent->name, $row['itemName']); $this->assertEquals($row['itemName'], $newComponent->name);
$this->assertEquals($newComponent->company->name, $row['companyName']); $this->assertEquals($row['companyName'], $newComponent->company->name);
$this->assertEquals($newComponent->category->name, $row['category']); $this->assertEquals($row['category'], $newComponent->category->name);
$this->assertEquals($newComponent->location->name, $row['location']); $this->assertEquals($row['location'], $newComponent->location->name);
$this->assertNull($newComponent->supplier_id); $this->assertNull($newComponent->supplier_id);
$this->assertEquals($newComponent->qty, $row['quantity']); $this->assertEquals($row['quantity'], $newComponent->qty);
$this->assertEquals($newComponent->order_number, $row['orderNumber']); $this->assertEquals($row['orderNumber'], $newComponent->order_number);
$this->assertEquals($newComponent->purchase_date->toDateString(), $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $newComponent->purchase_date->toDateString());
$this->assertEquals($newComponent->purchase_cost, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $newComponent->purchase_cost);
$this->assertNull($newComponent->min_amt); $this->assertNull($newComponent->min_amt);
$this->assertEquals($newComponent->serial, $row['serialNumber']); $this->assertEquals($row['serialNumber'], $newComponent->serial);
$this->assertNull($newComponent->image); $this->assertNull($newComponent->image);
$this->assertNull($newComponent->notes); $this->assertNull($newComponent->notes);
} }
@ -239,18 +239,18 @@ class ImportComponentsTest extends ImportDataTestCase
->where('serial', $row['serialNumber']) ->where('serial', $row['serialNumber'])
->sole(); ->sole();
$this->assertEquals($updatedComponent->name, $row['itemName']); $this->assertEquals($row['itemName'], $updatedComponent->name);
$this->assertEquals($updatedComponent->category->name, $row['category']); $this->assertEquals($row['category'], $updatedComponent->category->name);
$this->assertEquals($updatedComponent->location->name, $row['location']); $this->assertEquals($row['location'], $updatedComponent->location->name);
$this->assertEquals($updatedComponent->supplier_id, $component->supplier_id); $this->assertEquals($component->supplier_id, $updatedComponent->supplier_id);
$this->assertEquals($updatedComponent->qty, $row['quantity']); $this->assertEquals($row['quantity'], $updatedComponent->qty);
$this->assertEquals($updatedComponent->order_number, $row['orderNumber']); $this->assertEquals($row['orderNumber'], $updatedComponent->order_number);
$this->assertEquals($updatedComponent->purchase_date->toDateString(), $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $updatedComponent->purchase_date->toDateString());
$this->assertEquals($updatedComponent->purchase_cost, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $updatedComponent->purchase_cost);
$this->assertEquals($updatedComponent->min_amt, $component->min_amt); $this->assertEquals($component->min_amt, $updatedComponent->min_amt);
$this->assertEquals($updatedComponent->serial, $row['serialNumber']); $this->assertEquals($row['serialNumber'], $updatedComponent->serial);
$this->assertEquals($updatedComponent->image, $component->image); $this->assertEquals($component->image, $updatedComponent->image);
$this->assertEquals($updatedComponent->notes, $component->notes); $this->assertEquals($component->notes, $updatedComponent->notes);
} }
#[Test] #[Test]
@ -294,14 +294,14 @@ class ImportComponentsTest extends ImportDataTestCase
->where('serial', $importFileBuilder->firstRow()['category']) ->where('serial', $importFileBuilder->firstRow()['category'])
->sole(); ->sole();
$this->assertEquals($newComponent->name, $row['quantity']); $this->assertEquals($row['quantity'], $newComponent->name);
$this->assertEquals($newComponent->category->name, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $newComponent->category->name);
$this->assertEquals($newComponent->location->name, $row['serialNumber']); $this->assertEquals($row['serialNumber'], $newComponent->location->name);
$this->assertNull($newComponent->supplier_id); $this->assertNull($newComponent->supplier_id);
$this->assertEquals($newComponent->qty, $row['companyName']); $this->assertEquals($row['companyName'], $newComponent->qty);
$this->assertEquals($newComponent->order_number, $row['orderNumber']); $this->assertEquals($row['orderNumber'], $newComponent->order_number);
$this->assertEquals($newComponent->purchase_date->toDateString(), $row['itemName']); $this->assertEquals($row['itemName'], $newComponent->purchase_date->toDateString());
$this->assertEquals($newComponent->purchase_cost, $row['location']); $this->assertEquals($row['location'], $newComponent->purchase_cost);
$this->assertNull($newComponent->min_amt); $this->assertNull($newComponent->min_amt);
$this->assertNull($newComponent->image); $this->assertNull($newComponent->image);
$this->assertNull($newComponent->notes); $this->assertNull($newComponent->notes);

View file

@ -79,22 +79,22 @@ class ImportConsumablesTest extends ImportDataTestCase
->where('item_id', $newConsumable->id) ->where('item_id', $newConsumable->id)
->sole(); ->sole();
$this->assertEquals($activityLog->action_type, 'create'); $this->assertEquals('create', $activityLog->action_type);
$this->assertEquals($activityLog->action_source, 'importer'); $this->assertEquals('importer', $activityLog->action_source);
$this->assertEquals($activityLog->company_id, $newConsumable->company->id); $this->assertEquals($newConsumable->company->id, $activityLog->company_id);
$this->assertEquals($newConsumable->name, $row['itemName']); $this->assertEquals($row['itemName'], $newConsumable->name);
$this->assertEquals($newConsumable->category->name, $row['category']); $this->assertEquals($row['category'], $newConsumable->category->name);
$this->assertEquals($newConsumable->location->name, $row['location']); $this->assertEquals($row['location'], $newConsumable->location->name);
$this->assertEquals($newConsumable->company->name, $row['companyName']); $this->assertEquals($row['companyName'], $newConsumable->company->name);
$this->assertNull($newConsumable->supplier_id); $this->assertNull($newConsumable->supplier_id);
$this->assertFalse($newConsumable->requestable); $this->assertFalse($newConsumable->requestable);
$this->assertNull($newConsumable->image); $this->assertNull($newConsumable->image);
$this->assertEquals($newConsumable->order_number, $row['orderNumber']); $this->assertEquals($row['orderNumber'], $newConsumable->order_number);
$this->assertEquals($newConsumable->purchase_date->toDateString(), $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $newConsumable->purchase_date->toDateString());
$this->assertEquals($newConsumable->purchase_cost, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $newConsumable->purchase_cost);
$this->assertNull($newConsumable->min_amt); $this->assertNull($newConsumable->min_amt);
$this->assertEquals($newConsumable->model_number, ''); $this->assertEquals('', $newConsumable->model_number);
$this->assertNull($newConsumable->item_number); $this->assertNull($newConsumable->item_number);
$this->assertNull($newConsumable->manufacturer_id); $this->assertNull($newConsumable->manufacturer_id);
$this->assertNull($newConsumable->notes); $this->assertNull($newConsumable->notes);
@ -229,13 +229,13 @@ class ImportConsumablesTest extends ImportDataTestCase
->where('name', $importFileBuilder->firstRow()['itemName']) ->where('name', $importFileBuilder->firstRow()['itemName'])
->sole(); ->sole();
$this->assertEquals($updatedConsumable->name, $row['itemName']); $this->assertEquals($row['itemName'], $updatedConsumable->name);
$this->assertEquals($updatedConsumable->category->name, $row['category']); $this->assertEquals($row['category'], $updatedConsumable->category->name);
$this->assertEquals($updatedConsumable->location->name, $row['location']); $this->assertEquals($row['location'], $updatedConsumable->location->name);
$this->assertEquals($updatedConsumable->company->name, $row['companyName']); $this->assertEquals($row['companyName'], $updatedConsumable->company->name);
$this->assertEquals($updatedConsumable->order_number, $row['orderNumber']); $this->assertEquals($row['orderNumber'], $updatedConsumable->order_number);
$this->assertEquals($updatedConsumable->purchase_date->toDateString(), $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $updatedConsumable->purchase_date->toDateString());
$this->assertEquals($updatedConsumable->purchase_cost, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $updatedConsumable->purchase_cost);
$this->assertEquals($consumable->supplier_id, $updatedConsumable->supplier_id); $this->assertEquals($consumable->supplier_id, $updatedConsumable->supplier_id);
$this->assertEquals($consumable->requestable, $updatedConsumable->requestable); $this->assertEquals($consumable->requestable, $updatedConsumable->requestable);
@ -289,19 +289,19 @@ class ImportConsumablesTest extends ImportDataTestCase
->where('name', $importFileBuilder->firstRow()['quantity']) ->where('name', $importFileBuilder->firstRow()['quantity'])
->sole(); ->sole();
$this->assertEquals($newConsumable->category->name, $row['supplier']); $this->assertEquals($row['supplier'], $newConsumable->category->name);
$this->assertEquals($newConsumable->location->name, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $newConsumable->location->name);
$this->assertEquals($newConsumable->company->name, $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $newConsumable->company->name);
$this->assertEquals($newConsumable->qty, $row['companyName']); $this->assertEquals($row['companyName'], $newConsumable->qty);
$this->assertEquals($newConsumable->name, $row['quantity']); $this->assertEquals($row['quantity'], $newConsumable->name);
$this->assertNull($newConsumable->supplier_id); $this->assertNull($newConsumable->supplier_id);
$this->assertFalse($newConsumable->requestable); $this->assertFalse($newConsumable->requestable);
$this->assertNull($newConsumable->image); $this->assertNull($newConsumable->image);
$this->assertEquals($newConsumable->order_number, $row['orderNumber']); $this->assertEquals($row['orderNumber'], $newConsumable->order_number);
$this->assertEquals($newConsumable->purchase_date->toDateString(), $row['itemName']); $this->assertEquals($row['itemName'], $newConsumable->purchase_date->toDateString());
$this->assertEquals($newConsumable->purchase_cost, $row['location']); $this->assertEquals($row['location'], $newConsumable->purchase_cost);
$this->assertNull($newConsumable->min_amt); $this->assertNull($newConsumable->min_amt);
$this->assertEquals($newConsumable->model_number, ''); $this->assertEquals('', $newConsumable->model_number);
$this->assertNull($newConsumable->item_number); $this->assertNull($newConsumable->item_number);
$this->assertNull($newConsumable->manufacturer_id); $this->assertNull($newConsumable->manufacturer_id);
$this->assertNull($newConsumable->notes); $this->assertNull($newConsumable->notes);

View file

@ -79,22 +79,22 @@ class ImportLicenseTest extends ImportDataTestCase
$this->assertCount(2, $activityLogs); $this->assertCount(2, $activityLogs);
$this->assertEquals($newLicense->name, $row['licenseName']); $this->assertEquals($row['licenseName'], $newLicense->name);
$this->assertEquals($newLicense->serial, $row['serialNumber']); $this->assertEquals($row['serialNumber'], $newLicense->serial);
$this->assertEquals($newLicense->purchase_date->toDateString(), $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $newLicense->purchase_date->toDateString());
$this->assertEquals($newLicense->purchase_cost, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $newLicense->purchase_cost);
$this->assertEquals($newLicense->order_number, $row['orderNumber']); $this->assertEquals($row['orderNumber'], $newLicense->order_number);
$this->assertEquals($newLicense->seats, $row['seats']); $this->assertEquals($row['seats'], $newLicense->seats);
$this->assertEquals($newLicense->notes, $row['notes']); $this->assertEquals($row['notes'], $newLicense->notes);
$this->assertEquals($newLicense->license_name, $row['licensedToName']); $this->assertEquals($row['licensedToName'], $newLicense->license_name);
$this->assertEquals($newLicense->license_email, $row['licensedToEmail']); $this->assertEquals($row['licensedToEmail'], $newLicense->license_email);
$this->assertEquals($newLicense->supplier->name, $row['supplierName']); $this->assertEquals($row['supplierName'], $newLicense->supplier->name);
$this->assertEquals($newLicense->company->name, $row['companyName']); $this->assertEquals($row['companyName'], $newLicense->company->name);
$this->assertEquals($newLicense->category->name, $row['category']); $this->assertEquals($row['category'], $newLicense->category->name);
$this->assertEquals($newLicense->expiration_date->toDateString(), $row['expirationDate']); $this->assertEquals($row['expirationDate'], $newLicense->expiration_date->toDateString());
$this->assertEquals($newLicense->maintained, $row['isMaintained'] === 'TRUE'); $this->assertEquals($row['isMaintained'] === 'TRUE', $newLicense->maintained);
$this->assertEquals($newLicense->reassignable, $row['isReassignAble'] === 'TRUE'); $this->assertEquals($row['isReassignAble'] === 'TRUE', $newLicense->reassignable);
$this->assertEquals($newLicense->purchase_order, ''); $this->assertEquals('', $newLicense->purchase_order);
$this->assertNull($newLicense->depreciation_id); $this->assertNull($newLicense->depreciation_id);
$this->assertNull($newLicense->termination_date); $this->assertNull($newLicense->termination_date);
$this->assertNull($newLicense->deprecate); $this->assertNull($newLicense->deprecate);
@ -155,7 +155,7 @@ class ImportLicenseTest extends ImportDataTestCase
->where('serial', $importFileBuilder->firstRow()['serialNumber']) ->where('serial', $importFileBuilder->firstRow()['serialNumber'])
->sole(); ->sole();
$this->assertEquals($newLicense->expiration_date->toDateString(), '2022-10-10'); $this->assertEquals('2022-10-10', $newLicense->expiration_date->toDateString());
} }
#[Test] #[Test]
@ -259,26 +259,26 @@ class ImportLicenseTest extends ImportDataTestCase
->where('serial', $row['serialNumber']) ->where('serial', $row['serialNumber'])
->sole(); ->sole();
$this->assertEquals($updatedLicense->name, $row['licenseName']); $this->assertEquals($row['licenseName'], $updatedLicense->name);
$this->assertEquals($updatedLicense->serial, $row['serialNumber']); $this->assertEquals($row['serialNumber'], $updatedLicense->serial);
$this->assertEquals($updatedLicense->purchase_date->toDateString(), $row['purchaseDate']); $this->assertEquals($row['purchaseDate'], $updatedLicense->purchase_date->toDateString());
$this->assertEquals($updatedLicense->purchase_cost, $row['purchaseCost']); $this->assertEquals($row['purchaseCost'], $updatedLicense->purchase_cost);
$this->assertEquals($updatedLicense->order_number, $row['orderNumber']); $this->assertEquals($row['orderNumber'], $updatedLicense->order_number);
$this->assertEquals($updatedLicense->seats, $row['seats']); $this->assertEquals($row['seats'], $updatedLicense->seats);
$this->assertEquals($updatedLicense->notes, $row['notes']); $this->assertEquals($row['notes'], $updatedLicense->notes);
$this->assertEquals($updatedLicense->license_name, $row['licensedToName']); $this->assertEquals($row['licensedToName'], $updatedLicense->license_name);
$this->assertEquals($updatedLicense->license_email, $row['licensedToEmail']); $this->assertEquals($row['licensedToEmail'], $updatedLicense->license_email);
$this->assertEquals($updatedLicense->supplier->name, $row['supplierName']); $this->assertEquals($row['supplierName'], $updatedLicense->supplier->name);
$this->assertEquals($updatedLicense->company->name, $row['companyName']); $this->assertEquals($row['companyName'], $updatedLicense->company->name);
$this->assertEquals($updatedLicense->category->name, $row['category']); $this->assertEquals($row['category'], $updatedLicense->category->name);
$this->assertEquals($updatedLicense->expiration_date->toDateString(), $row['expirationDate']); $this->assertEquals($row['expirationDate'], $updatedLicense->expiration_date->toDateString());
$this->assertEquals($updatedLicense->maintained, $row['isMaintained'] === 'TRUE'); $this->assertEquals($row['isMaintained'] === 'TRUE', $updatedLicense->maintained);
$this->assertEquals($updatedLicense->reassignable, $row['isReassignAble'] === 'TRUE'); $this->assertEquals($row['isReassignAble'] === 'TRUE', $updatedLicense->reassignable);
$this->assertEquals($updatedLicense->purchase_order, $license->purchase_order); $this->assertEquals($license->purchase_order, $updatedLicense->purchase_order);
$this->assertEquals($updatedLicense->depreciation_id, $license->depreciation_id); $this->assertEquals($license->depreciation_id, $updatedLicense->depreciation_id);
$this->assertEquals($updatedLicense->termination_date, $license->termination_date); $this->assertEquals($license->termination_date, $updatedLicense->termination_date);
$this->assertEquals($updatedLicense->deprecate, $license->deprecate); $this->assertEquals($license->deprecate, $updatedLicense->deprecate);
$this->assertEquals($updatedLicense->min_amt, $license->min_amt); $this->assertEquals($license->min_amt, $updatedLicense->min_amt);
} }
#[Test] #[Test]
@ -336,22 +336,22 @@ class ImportLicenseTest extends ImportDataTestCase
->where('serial', $row['companyName']) ->where('serial', $row['companyName'])
->sole(); ->sole();
$this->assertEquals($newLicense->name, $row['licenseName']); $this->assertEquals($row['licenseName'], $newLicense->name);
$this->assertEquals($newLicense->serial, $row['companyName']); $this->assertEquals($row['companyName'], $newLicense->serial);
$this->assertEquals($newLicense->purchase_date->toDateString(), $row['isMaintained']); $this->assertEquals($row['isMaintained'], $newLicense->purchase_date->toDateString());
$this->assertEquals($newLicense->purchase_cost, $row['isReassignAble']); $this->assertEquals($row['isReassignAble'], $newLicense->purchase_cost);
$this->assertEquals($newLicense->order_number, $row['licensedToName']); $this->assertEquals($row['licensedToName'], $newLicense->order_number);
$this->assertEquals($newLicense->seats, $row['expirationDate']); $this->assertEquals($row['expirationDate'], $newLicense->seats);
$this->assertEquals($newLicense->notes, $row['licensedToEmail']); $this->assertEquals($row['licensedToEmail'], $newLicense->notes);
$this->assertEquals($newLicense->license_name, $row['seats']); $this->assertEquals($row['seats'], $newLicense->license_name);
$this->assertEquals($newLicense->license_email, $row['serialNumber']); $this->assertEquals($row['serialNumber'], $newLicense->license_email);
$this->assertEquals($newLicense->supplier->name, $row['category']); $this->assertEquals($row['category'], $newLicense->supplier->name);
$this->assertEquals($newLicense->company->name, $row['notes']); $this->assertEquals($row['notes'], $newLicense->company->name);
$this->assertEquals($newLicense->category->name, $row['manufacturerName']); $this->assertEquals($row['manufacturerName'], $newLicense->category->name);
$this->assertEquals($newLicense->expiration_date->toDateString(), $row['orderNumber']); $this->assertEquals($row['orderNumber'], $newLicense->expiration_date->toDateString());
$this->assertEquals($newLicense->maintained, $row['purchaseCost'] === 'TRUE'); $this->assertEquals($row['purchaseCost'] === 'TRUE', $newLicense->maintained);
$this->assertEquals($newLicense->reassignable, $row['purchaseDate'] === 'TRUE'); $this->assertEquals($row['purchaseDate'] === 'TRUE', $newLicense->reassignable);
$this->assertEquals($newLicense->purchase_order, ''); $this->assertEquals('', $newLicense->purchase_order);
$this->assertNull($newLicense->depreciation_id); $this->assertNull($newLicense->depreciation_id);
$this->assertNull($newLicense->termination_date); $this->assertNull($newLicense->termination_date);
$this->assertNull($newLicense->deprecate); $this->assertNull($newLicense->deprecate);

View file

@ -78,21 +78,21 @@ class ImportUsersTest extends ImportDataTestCase
Notification::assertNothingSent(); Notification::assertNothingSent();
$this->assertEquals($newUser->email, $row['email']); $this->assertEquals($row['email'], $newUser->email);
$this->assertEquals($newUser->first_name, $row['firstName']); $this->assertEquals($row['firstName'], $newUser->first_name);
$this->assertEquals($newUser->last_name, $row['lastName']); $this->assertEquals($row['lastName'], $newUser->last_name);
$this->assertEquals($newUser->employee_num, $row['employeeNumber']); $this->assertEquals($row['employeeNumber'], $newUser->employee_num);
$this->assertEquals($newUser->company->name, $row['companyName']); $this->assertEquals($row['companyName'], $newUser->company->name);
$this->assertEquals($newUser->location->name, $row['location']); $this->assertEquals($row['location'], $newUser->location->name);
$this->assertEquals($newUser->phone, $row['phoneNumber']); $this->assertEquals($row['phoneNumber'], $newUser->phone);
$this->assertEquals($newUser->jobtitle, $row['position']); $this->assertEquals($row['position'], $newUser->jobtitle);
$this->assertTrue(Hash::isHashed($newUser->password)); $this->assertTrue(Hash::isHashed($newUser->password));
$this->assertEquals($newUser->website, ''); $this->assertEquals('', $newUser->website);
$this->assertEquals($newUser->country, ''); $this->assertEquals('', $newUser->country);
$this->assertEquals($newUser->address, ''); $this->assertEquals('', $newUser->address);
$this->assertEquals($newUser->city, ''); $this->assertEquals('', $newUser->city);
$this->assertEquals($newUser->state, ''); $this->assertEquals('', $newUser->state);
$this->assertEquals($newUser->zip, ''); $this->assertEquals('', $newUser->zip);
$this->assertNull($newUser->permissions); $this->assertNull($newUser->permissions);
$this->assertNull($newUser->avatar); $this->assertNull($newUser->avatar);
$this->assertNull($newUser->notes); $this->assertNull($newUser->notes);
@ -100,15 +100,15 @@ class ImportUsersTest extends ImportDataTestCase
$this->assertNull($newUser->department_id); $this->assertNull($newUser->department_id);
$this->assertNull($newUser->two_factor_secret); $this->assertNull($newUser->two_factor_secret);
$this->assertNull($newUser->idap_import); $this->assertNull($newUser->idap_import);
$this->assertEquals($newUser->locale, 'en-US'); $this->assertEquals('en-US', $newUser->locale);
$this->assertEquals($newUser->show_in_list, 1); $this->assertEquals(1, $newUser->show_in_list);
$this->assertEquals($newUser->two_factor_enrolled, 0); $this->assertEquals(0, $newUser->two_factor_enrolled);
$this->assertEquals($newUser->two_factor_optin, 0); $this->assertEquals(0, $newUser->two_factor_optin);
$this->assertEquals($newUser->remote, 0); $this->assertEquals(0, $newUser->remote);
$this->assertEquals($newUser->autoassign_licenses, 0); $this->assertEquals(0, $newUser->autoassign_licenses);
$this->assertEquals($newUser->vip, 0); $this->assertEquals(0, $newUser->vip);
$this->assertEquals($newUser->enable_sounds, 0); $this->assertEquals(0, $newUser->enable_sounds);
$this->assertEquals($newUser->enable_confetti, 0); $this->assertEquals(0, $newUser->enable_confetti);
$this->assertNull($newUser->created_by); $this->assertNull($newUser->created_by);
$this->assertNull($newUser->start_date); $this->assertNull($newUser->start_date);
$this->assertNull($newUser->end_date); $this->assertNull($newUser->end_date);
@ -118,7 +118,7 @@ class ImportUsersTest extends ImportDataTestCase
$this->assertNull($newUser->last_login); $this->assertNull($newUser->last_login);
$this->assertNull($newUser->persist_code); $this->assertNull($newUser->persist_code);
$this->assertNull($newUser->reset_password_code); $this->assertNull($newUser->reset_password_code);
$this->assertEquals($newUser->activated, 0); $this->assertEquals(0, $newUser->activated);
} }
#[Test] #[Test]
@ -169,7 +169,7 @@ class ImportUsersTest extends ImportDataTestCase
$generatedUsername = User::generateFormattedNameFromFullName("{$row['firstName']} {$row['lastName']}")['username']; $generatedUsername = User::generateFormattedNameFromFullName("{$row['firstName']} {$row['lastName']}")['username'];
$this->assertEquals($newUser->username, $generatedUsername); $this->assertEquals($generatedUsername, $newUser->username);
} }
#[Test] #[Test]
@ -186,8 +186,8 @@ class ImportUsersTest extends ImportDataTestCase
$userLocation = Location::query()->where('name', $importFileBuilder->firstRow()['location'])->sole(['id']); $userLocation = Location::query()->where('name', $importFileBuilder->firstRow()['location'])->sole(['id']);
$this->assertEquals( $this->assertEquals(
$assetsAssignedToUser->refresh()->location_id, $userLocation->id,
$userLocation->id $assetsAssignedToUser->refresh()->location_id
); );
} }
@ -238,19 +238,19 @@ class ImportUsersTest extends ImportDataTestCase
'location_id', 'company_id', 'updated_at', 'phone', 'jobtitle' 'location_id', 'company_id', 'updated_at', 'phone', 'jobtitle'
]; ];
$this->assertEquals($updatedUser->email, $row['email']); $this->assertEquals($row['email'], $updatedUser->email);
$this->assertEquals($updatedUser->first_name, $row['firstName']); $this->assertEquals($row['firstName'], $updatedUser->first_name);
$this->assertEquals($updatedUser->last_name, $row['lastName']); $this->assertEquals($row['lastName'], $updatedUser->last_name);
$this->assertEquals($updatedUser->employee_num, $row['employeeNumber']); $this->assertEquals($row['employeeNumber'], $updatedUser->employee_num);
$this->assertEquals($updatedUser->company->name, $row['companyName']); $this->assertEquals($row['companyName'], $updatedUser->company->name);
$this->assertEquals($updatedUser->location->name, $row['location']); $this->assertEquals($row['location'], $updatedUser->location->name);
$this->assertEquals($updatedUser->phone, $row['phoneNumber']); $this->assertEquals($row['phoneNumber'], $updatedUser->phone);
$this->assertEquals($updatedUser->jobtitle, $row['position']); $this->assertEquals($row['position'], $updatedUser->jobtitle);
$this->assertTrue(Hash::isHashed($updatedUser->password)); $this->assertTrue(Hash::isHashed($updatedUser->password));
$this->assertEquals( $this->assertEquals(
Arr::except($updatedUser->attributesToArray(), $updatedAttributes),
Arr::except($user->attributesToArray(), $updatedAttributes), Arr::except($user->attributesToArray(), $updatedAttributes),
Arr::except($updatedUser->attributesToArray(), $updatedAttributes),
); );
} }
@ -295,21 +295,21 @@ class ImportUsersTest extends ImportDataTestCase
->where('username', $row['companyName']) ->where('username', $row['companyName'])
->sole(); ->sole();
$this->assertEquals($newUser->email, $row['position']); $this->assertEquals($row['position'], $newUser->email);
$this->assertEquals($newUser->first_name, $row['location']); $this->assertEquals($row['location'], $newUser->first_name);
$this->assertEquals($newUser->last_name, $row['lastName']); $this->assertEquals($row['lastName'], $newUser->last_name);
$this->assertEquals($newUser->jobtitle, $row['email']); $this->assertEquals($row['email'], $newUser->jobtitle);
$this->assertEquals($newUser->employee_num, $row['phoneNumber']); $this->assertEquals($row['phoneNumber'], $newUser->employee_num);
$this->assertEquals($newUser->company->name, $row['username']); $this->assertEquals($row['username'], $newUser->company->name);
$this->assertEquals($newUser->location->name, $row['firstName']); $this->assertEquals($row['firstName'], $newUser->location->name);
$this->assertEquals($newUser->phone, $row['employeeNumber']); $this->assertEquals($row['employeeNumber'], $newUser->phone);
$this->assertTrue(Hash::isHashed($newUser->password)); $this->assertTrue(Hash::isHashed($newUser->password));
$this->assertEquals($newUser->website, ''); $this->assertEquals('', $newUser->website);
$this->assertEquals($newUser->country, ''); $this->assertEquals('', $newUser->country);
$this->assertEquals($newUser->address, ''); $this->assertEquals('', $newUser->address);
$this->assertEquals($newUser->city, ''); $this->assertEquals('', $newUser->city);
$this->assertEquals($newUser->state, ''); $this->assertEquals('', $newUser->state);
$this->assertEquals($newUser->zip, ''); $this->assertEquals('', $newUser->zip);
$this->assertNull($newUser->permissions); $this->assertNull($newUser->permissions);
$this->assertNull($newUser->avatar); $this->assertNull($newUser->avatar);
$this->assertNull($newUser->notes); $this->assertNull($newUser->notes);
@ -317,15 +317,15 @@ class ImportUsersTest extends ImportDataTestCase
$this->assertNull($newUser->department_id); $this->assertNull($newUser->department_id);
$this->assertNull($newUser->two_factor_secret); $this->assertNull($newUser->two_factor_secret);
$this->assertNull($newUser->idap_import); $this->assertNull($newUser->idap_import);
$this->assertEquals($newUser->locale, 'en-US'); $this->assertEquals('en-US', $newUser->locale);
$this->assertEquals($newUser->show_in_list, 1); $this->assertEquals(1, $newUser->show_in_list);
$this->assertEquals($newUser->two_factor_enrolled, 0); $this->assertEquals(0, $newUser->two_factor_enrolled);
$this->assertEquals($newUser->two_factor_optin, 0); $this->assertEquals(0, $newUser->two_factor_optin);
$this->assertEquals($newUser->remote, 0); $this->assertEquals(0, $newUser->remote);
$this->assertEquals($newUser->autoassign_licenses, 0); $this->assertEquals(0, $newUser->autoassign_licenses);
$this->assertEquals($newUser->vip, 0); $this->assertEquals(0, $newUser->vip);
$this->assertEquals($newUser->enable_sounds, 0); $this->assertEquals(0, $newUser->enable_sounds);
$this->assertEquals($newUser->enable_confetti, 0); $this->assertEquals(0, $newUser->enable_confetti);
$this->assertNull($newUser->created_by); $this->assertNull($newUser->created_by);
$this->assertNull($newUser->start_date); $this->assertNull($newUser->start_date);
$this->assertNull($newUser->end_date); $this->assertNull($newUser->end_date);
@ -335,6 +335,6 @@ class ImportUsersTest extends ImportDataTestCase
$this->assertNull($newUser->last_login); $this->assertNull($newUser->last_login);
$this->assertNull($newUser->persist_code); $this->assertNull($newUser->persist_code);
$this->assertNull($newUser->reset_password_code); $this->assertNull($newUser->reset_password_code);
$this->assertEquals($newUser->activated, 0); $this->assertEquals(0, $newUser->activated);
} }
} }