diff --git a/.env.tests b/.env.tests
index d1d7a666f..665a0fffb 100644
--- a/.env.tests
+++ b/.env.tests
@@ -1,7 +1,8 @@
-APP_ENV=local
+APP_ENV=testing
APP_DEBUG=true
APP_URL=http://snipe-it.localapp
-DB_CONNECTION=mysql
+DB_CONNECTION=sqlite_testing
+DB_DEFAULT=sqlite_testing
DB_HOST=localhost
DB_DATABASE=snipeittests
DB_USERNAME=snipeit
diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php
index 1bab31243..40bff833e 100644
--- a/app/Http/Controllers/Api/UsersController.php
+++ b/app/Http/Controllers/Api/UsersController.php
@@ -50,7 +50,11 @@ class UsersController extends Controller
}
if ($request->has('company_id')) {
- $users = $users->where('company_id','=',$request->input('company_id'));
+ $users = $users->where('company_id', '=', $request->input('company_id'));
+ }
+
+ if ($request->has('location_id')) {
+ $users = $users->where('location_id', '=', $request->input('location_id'));
}
if ($request->has('department_id')) {
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index 6260d7a2a..ad291d5cd 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -139,6 +139,7 @@ class Asset extends Depreciable
* @param null $name
* @return bool
*/
+ //FIXME: The admin parameter is never used. Can probably be removed.
public function checkOut($target, $admin, $checkout_at = null, $expected_checkin = null, $note = null, $name = null)
{
if (!$target) {
@@ -163,7 +164,7 @@ class Asset extends Depreciable
}
if ($this->save()) {
- $log = $this->logCheckout($note);
+ $this->logCheckout($note, $target);
// if ((($this->requireAcceptance()=='1') || ($this->getEula())) && ($user->email!='')) {
// $this->checkOutNotifyMail($log->id, $user, $checkout_at, $expected_checkin, $note);
// }
@@ -272,15 +273,13 @@ class Asset extends Depreciable
**/
public function assetLoc()
{
- if ($this->assignedTo) {
- return $this->assignedTo->userloc();
- }
-
if (!empty($this->assignedType())) {
if ($this->assignedType() == self::ASSET) {
return $this->assignedTo->assetloc(); // Recurse until we have a final location
} elseif ($this->assignedType() == self::LOCATION) {
return $this->assignedTo();
+ } elseif ($this->assignedType() == self::USER) {
+ return $this->assignedTo->userLoc();
}
}
return $this->defaultLoc();
diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php
index ecd200c87..613fd7365 100644
--- a/app/Models/Loggable.php
+++ b/app/Models/Loggable.php
@@ -45,12 +45,17 @@ trait Loggable
$log->user_id = Auth::user()->id;
// @FIXME This needs to be generalized with new asset checkout.
- if (!is_null($this->asset_id) || isset($target)) {
- $log->target_type = Asset::class;
- $log->target_id = $this->asset_id;
- } elseif (!is_null($this->assigned_to)) {
- $log->target_type = User::class;
- $log->target_id = $this->assigned_to;
+ if(isset($target)) {
+ $log->target_type = get_class($target);
+ $log->target_id = $target->id;
+ } else {
+ if (!is_null($this->asset_id)) {
+ $log->target_type = Asset::class;
+ $log->target_id = $this->asset_id;
+ } elseif (!is_null($this->assigned_to)) {
+ $log->target_type = User::class;
+ $log->target_id = $this->assigned_to;
+ }
}
$item = call_user_func(array($log->target_type, 'find'), $log->target_id);
diff --git a/config/database.php b/config/database.php
index afa6c23f5..2864a5c59 100755
--- a/config/database.php
+++ b/config/database.php
@@ -54,7 +54,7 @@ return [
'sqlite_testing' => [
'driver' => 'sqlite',
- 'database' => database_path('testing.sqlite'),
+ 'database' => ':memory:',
'prefix' => '',
],
diff --git a/database/factories/ActionLogFactory.php b/database/factories/ActionLogFactory.php
new file mode 100644
index 000000000..5eb57793c
--- /dev/null
+++ b/database/factories/ActionLogFactory.php
@@ -0,0 +1,111 @@
+defineAs(App\Models\Actionlog::class, 'asset-upload', function ($faker) {
+ $asset = factory(App\Models\Asset::class)->create();
+ return [
+ 'item_type' => get_class($asset),
+ 'item_id' => $asset->id,
+ 'user_id' => function () {
+ return factory(App\Models\User::class)->create()->id;
+ },
+ 'filename' => $faker->word,
+ 'action_type' => 'uploaded'
+ ];
+});
+
+$factory->defineAs(Actionlog::class, 'asset-checkout', function (Faker\Generator $faker) {
+ $company = factory(App\Models\Company::class)->create();
+ $user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
+ $target = factory(App\Models\User::class)->create(['company_id' => $company->id]);
+ // $item = factory(App\Models\Asset::class)->create(['company_id' => $company->id]);
+
+ return [
+ 'user_id' => $user->id,
+ 'action_type' => 'checkout',
+ 'item_id' => factory(App\Models\Asset::class)->create(['company_id' => $company->id])->id,
+ 'item_type' => App\Models\Asset::class,
+ 'target_id' => $target->id,
+ 'target_type' => get_class($target),
+ 'created_at' => $faker->dateTime(),
+ 'note' => $faker->sentence,
+ 'company_id' => $company->id
+ ];
+});
+
+$factory->defineAs(Actionlog::class, 'license-checkout-asset', function (Faker\Generator $faker) {
+ $company = factory(App\Models\Company::class)->create();
+ $user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
+ $target = factory(App\Models\Asset::class)->create(['company_id' => $company->id]);
+ $item = factory(App\Models\License::class)->create(['company_id' => $company->id]);
+
+ return [
+ 'user_id' => $user->id,
+ 'action_type' => 'checkout',
+ 'item_id' => $item->id,
+ 'item_type' => get_class($item),
+ 'target_id' => $target->id,
+ 'target_type' => get_class($target),
+ 'created_at' => $faker->dateTime(),
+ 'note' => $faker->sentence,
+ 'company_id' => $company->id
+ ];
+});
+
+$factory->defineAs(Actionlog::class, 'accessory-checkout', function (Faker\Generator $faker) {
+ $company = factory(App\Models\Company::class)->create();
+ $user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
+ $target = factory(App\Models\User::class)->create(['company_id' => $company->id]);
+ $item = factory(App\Models\Accessory::class)->create(['company_id' => $company->id]);
+
+ return [
+ 'user_id' => $user->id,
+ 'action_type' => 'checkout',
+ 'item_id' => $item->id,
+ 'item_type' => get_class($item),
+ 'target_id' => $target->id,
+ 'target_type' => get_class($target),
+ 'created_at' => $faker->dateTime(),
+ 'note' => $faker->sentence,
+ 'company_id' => $company->id
+ ];
+});
+
+$factory->defineAs(Actionlog::class, 'consumable-checkout', function (Faker\Generator $faker) {
+ $company = factory(App\Models\Company::class)->create();
+ $user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
+ $target = factory(App\Models\User::class)->create(['company_id' => $company->id]);
+ $item = factory(App\Models\Consumable::class)->create(['company_id' => $company->id]);
+
+ return [
+ 'user_id' => $user->id,
+ 'action_type' => 'checkout',
+ 'item_id' => $item->id,
+ 'item_type' => get_class($item),
+ 'target_id' => $target->id,
+ 'target_type' => get_class($target),
+ 'created_at' => $faker->dateTime(),
+ 'note' => $faker->sentence,
+ 'company_id' => $company->id
+ ];
+});
+
+$factory->defineAs(Actionlog::class, 'component-checkout', function (Faker\Generator $faker) {
+ $company = factory(App\Models\Company::class)->create();
+ $user = factory(App\Models\User::class)->create(['company_id' => $company->id]);
+ $target = factory(App\Models\User::class)->create(['company_id' => $company->id]);
+ $item = factory(App\Models\Component::class)->create(['company_id' => $company->id]);
+
+ return [
+ 'user_id' => $user->id,
+ 'action_type' => 'checkout',
+ 'item_id' => $item->id,
+ 'item_type' => get_class($item),
+ 'target_id' => $target->id,
+ 'target_type' => get_class($target),
+ 'created_at' => $faker->dateTime(),
+ 'note' => $faker->sentence,
+ 'company_id' => $company->id
+ ];
+});
diff --git a/database/factories/AssetFactory.php b/database/factories/AssetFactory.php
new file mode 100644
index 000000000..294e6ca94
--- /dev/null
+++ b/database/factories/AssetFactory.php
@@ -0,0 +1,106 @@
+define(Asset::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->catchPhrase,
+ 'model_id' => function () {
+ return factory(App\Models\AssetModel::class)->create()->id;
+ },
+ 'rtd_location_id' => function () {
+ return factory(App\Models\Location::class)->create()->id;
+ },
+ 'serial' => $faker->uuid,
+ 'status_id' => function () {
+ return factory(App\Models\Statuslabel::class)->states('rtd')->create()->id;
+ },
+ 'user_id' => function () {
+ return factory(App\Models\User::class)->create()->id;
+ },
+ 'asset_tag' => $faker->unixTime('now'),
+ 'notes' => $faker->sentence,
+ 'purchase_date' => $faker->dateTime(),
+ 'purchase_cost' => $faker->randomFloat(2),
+ 'order_number' => $faker->numberBetween(1000000, 50000000),
+ 'supplier_id' => function () {
+ return factory(App\Models\Supplier::class)->create()->id;
+ },
+ 'company_id' => function () {
+ return factory(App\Models\Company::class)->create()->id;
+ },
+ 'requestable' => $faker->boolean()
+ ];
+});
+
+$factory->state(Asset::class, 'deleted', function ($faker) {
+ return [
+ 'deleted_at' => $faker->dateTime(),
+ ];
+});
+
+$factory->state(Asset::class, 'assigned-to-user', function ($faker) {
+ return [
+ 'assigned_to' => factory(App\Models\User::class)->create()->id,
+ 'assigned_type' => App\Models\User::class,
+ ];
+});
+
+$factory->state(Asset::class, 'assigned-to-location', function ($faker) {
+ return [
+ 'assigned_to' => factory(App\Models\Location::class)->create()->id,
+ 'assigned_type' => App\Models\Location::class,
+ ];
+});
+
+$factory->state(Asset::class, 'assigned-to-asset', function ($faker) {
+ return [
+ 'assigned_to' => factory(App\Models\Asset::class)->create()->id,
+ 'assigned_type' => App\Models\Asset::class,
+ ];
+});
+
+
+$factory->define(App\Models\AssetModel::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->catchPhrase,
+ 'manufacturer_id' => function () {
+ return factory(App\Models\Manufacturer::class)->create()->id;
+ },
+ 'category_id' => function () {
+ return factory(App\Models\Category::class)->states('asset-category')->create()->id;
+ },
+ 'model_number' => $faker->numberBetween(1000000, 50000000),
+ 'eol' => 1,
+ 'notes' => $faker->paragraph(),
+ 'requestable' => $faker->boolean(),
+ 'depreciation_id' => function () {
+ return factory(App\Models\Depreciation::class)->create()->id;
+ },
+ ];
+});
+
+$factory->define(App\Models\AssetMaintenance::class, function (Faker\Generator $faker) {
+ return [
+ 'asset_id' => function () {
+ return factory(App\Models\Asset::class)->create()->id;
+ },
+ 'supplier_id' => function () {
+ return factory(App\Models\Supplier::class)->create()->id;
+ },
+ 'asset_maintenance_type' => $faker->randomElement(['maintenance', 'repair', 'upgrade']),
+ 'title' => $faker->sentence,
+ 'start_date' => $faker->date(),
+ 'is_warranty' => $faker->boolean(),
+ 'notes' => $faker->paragraph(),
+ ];
+});
diff --git a/database/factories/CategoryFactory.php b/database/factories/CategoryFactory.php
new file mode 100644
index 000000000..9f358e80e
--- /dev/null
+++ b/database/factories/CategoryFactory.php
@@ -0,0 +1,46 @@
+define(App\Models\Category::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->text(20),
+ 'category_type' => $faker->randomElement(['asset', 'accessory', 'component', 'consumable']),
+ 'eula_text' => $faker->paragraph(),
+ 'require_acceptance' => $faker->boolean(),
+ 'use_default_eula' => $faker->boolean(),
+ 'checkin_email' => $faker->boolean()
+ ];
+});
+
+$factory->state(App\Models\Category::class, 'asset-category', function ($faker) {
+ return [
+ 'category_type' => 'asset',
+ ];
+});
+
+$factory->state(App\Models\Category::class, 'accessory-category', function ($faker) {
+ return [
+ 'category_type' => 'accessory',
+ ];
+});
+
+$factory->state(App\Models\Category::class, 'component-category', function ($faker) {
+ return [
+ 'category_type' => 'component',
+ ];
+});
+
+$factory->state(App\Models\Category::class, 'consumable-category', function ($faker) {
+ return [
+ 'category_type' => 'consumable',
+ ];
+});
diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php
index 10afc7816..1df8f9997 100644
--- a/database/factories/ModelFactory.php
+++ b/database/factories/ModelFactory.php
@@ -19,39 +19,150 @@ use App\Models\Manufacturer;
use App\Models\Statuslabel;
use App\Models\Supplier;
-$factory->defineAs(App\Models\Asset::class, 'asset', function (Faker\Generator $faker) {
+$factory->define(App\Models\Accessory::class, function (Faker\Generator $faker) {
return [
- 'name' => $faker->catchPhrase,
- 'model_id' => AssetModel::inRandomOrder()->first()->id,
- 'rtd_location_id' => Location::inRandomOrder()->first()->id,
- 'serial' => $faker->uuid,
- 'status_id' => Statuslabel::inRandomOrder()->first()->id,
- 'user_id' => 1,
- 'asset_tag' => $faker->unixTime('now'),
- 'notes' => $faker->sentence,
+ 'company_id' => function () {
+ return factory(App\Models\Company::class)->create()->id;
+ },
+ 'name' => $faker->text(20),
+ 'category_id' => function () {
+ return factory(App\Models\Category::class)->states('accessory-category')->create()->id;
+ },
+ 'manufacturer_id' => function () {
+ return factory(App\Models\Manufacturer::class)->create()->id;
+ },
+ 'location_id' => function () {
+ return factory(App\Models\Location::class)->create()->id;
+ },
+ 'order_number' => $faker->numberBetween(1000000, 50000000),
'purchase_date' => $faker->dateTime(),
'purchase_cost' => $faker->randomFloat(2),
- 'order_number' => $faker->numberBetween(1000000, 50000000),
- 'supplier_id' => Supplier::inRandomOrder()->first()->id,
- 'company_id' => Company::inRandomOrder()->first()->id,
- 'requestable' => $faker->boolean()
+ 'qty' => $faker->numberBetween(5, 10),
+ 'min_amt' => $faker->numberBetween($min = 1, $max = 2),
];
});
+$factory->define(App\Models\Company::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->company,
+ ];
+});
-$factory->defineAs(App\Models\AssetModel::class, 'assetmodel', function (Faker\Generator $faker) {
+$factory->define(App\Models\Component::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->text(20),
+ 'category_id' => function () {
+ return factory(App\Models\Category::class)->create()->id;
+ },
+ 'location_id' => function () {
+ return factory(App\Models\Location::class)->create()->id;
+ },
+ 'serial' => $faker->uuid,
+ 'qty' => $faker->numberBetween(3, 10),
+ 'order_number' => $faker->numberBetween(1000000, 50000000),
+ 'purchase_date' => $faker->dateTime(),
+ 'purchase_cost' => $faker->randomFloat(2),
+ 'min_amt' => $faker->numberBetween($min = 1, $max = 2),
+ 'company_id' => function () {
+ return factory(App\Models\Company::class)->create()->id;
+ },
+ ];
+});
+
+$factory->define(App\Models\Consumable::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->text(20),
+ 'company_id' => function () {
+ return factory(App\Models\Company::class)->create()->id;
+ },
+ 'category_id' => function () {
+ return factory(App\Models\Category::class)->create()->id;
+ },
+ 'location_id' => function () {
+ return factory(App\Models\Location::class)->create()->id;
+ },
+ 'manufacturer_id' => function () {
+ return factory(App\Models\Manufacturer::class)->create()->id;
+ },
+ 'user_id' => function () {
+ return factory(App\Models\User::class)->create()->id;
+ },
+ 'model_number' => $faker->numberBetween(1000000, 50000000),
+ 'item_no' => $faker->numberBetween(1000000, 50000000),
+ 'order_number' => $faker->numberBetween(1000000, 50000000),
+ 'purchase_date' => $faker->dateTime(),
+ 'purchase_cost' => $faker->randomFloat(2),
+ 'qty' => $faker->numberBetween(5, 10),
+ 'min_amt' => $faker->numberBetween($min = 1, $max = 2),
+ ];
+});
+
+$factory->define(App\Models\CustomField::class, function (Faker\Generator $faker) {
return [
'name' => $faker->catchPhrase,
- 'manufacturer_id' => Manufacturer::inRandomOrder()->first()->id,
- 'category_id' => Category::where('category_type', 'asset')->inRandomOrder()->first()->id,
- 'model_number' => $faker->numberBetween(1000000, 50000000),
- 'eol' => 1,
- 'notes' => $faker->paragraph(),
- 'requestable' => $faker->boolean(),
+ 'format' => 'IP',
+ 'element' => 'text',
];
});
-$factory->defineAs(App\Models\Location::class, 'location', function (Faker\Generator $faker) {
+$factory->define(App\Models\Department::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->catchPhrase,
+ 'user_id' => '1',
+ 'location_id' => function () {
+ return factory(App\Models\Location::class)->create()->id;
+ },
+ 'company_id' => function () {
+ return factory(App\Models\Company::class)->create()->id;
+ },
+ 'manager_id' => function () {
+ return factory(App\Models\User::class)->create()->id;
+ },
+
+ ];
+});
+
+$factory->define(App\Models\Depreciation::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->text(20),
+ 'months' => $faker->numberBetween(1, 10),
+ ];
+});
+
+$factory->define(App\Models\License::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->catchPhrase,
+ 'serial' => $faker->uuid,
+ 'seats' => $faker->numberBetween(1, 10),
+ 'license_email' => $faker->safeEmail,
+ 'license_name' => $faker->name,
+ 'order_number' => $faker->numberBetween(1500, 13250),
+ 'purchase_order' => $faker->numberBetween(1500, 13250),
+ 'purchase_date' => $faker->dateTime(),
+ 'purchase_cost' => $faker->randomFloat(2),
+ 'notes' => $faker->sentence,
+ 'supplier_id' => function () {
+ return factory(App\Models\Supplier::class)->create()->id;
+ },
+ 'company_id' =>function () {
+ return factory(App\Models\Company::class)->create()->id;
+ },
+ ];
+});
+
+$factory->define(App\Models\LicenseSeat::class, function (Faker\Generator $faker) {
+ return [
+ 'license_id' => function () {
+ return factory(App\Models\License::class)->create()->id;
+ },
+ 'created_at' => $faker->dateTime(),
+ 'updated_at' => $faker->dateTime(),
+ 'notes' => $faker->sentence,
+ 'user_id' => '1',
+ ];
+});
+
+$factory->define(App\Models\Location::class, function (Faker\Generator $faker) {
return [
'name' => $faker->catchPhrase,
'address' => $faker->streetAddress,
@@ -64,69 +175,13 @@ $factory->defineAs(App\Models\Location::class, 'location', function (Faker\Gener
];
});
-$factory->defineAs(App\Models\Category::class, 'category', function (Faker\Generator $faker) {
- return [
- 'name' => $faker->text(20),
- 'category_type' => $faker->randomElement(['asset', 'accessory', 'component', 'consumable']),
- 'eula_text' => $faker->paragraph(),
- 'require_acceptance' => $faker->boolean(),
- 'use_default_eula' => $faker->boolean(),
- 'checkin_email' => $faker->boolean()
- ];
-});
-
-$factory->defineAs(App\Models\Company::class, 'company', function (Faker\Generator $faker) {
+$factory->define(App\Models\Manufacturer::class, function (Faker\Generator $faker) {
return [
'name' => $faker->company,
];
});
-$factory->defineAs(App\Models\Manufacturer::class, 'manufacturer', function (Faker\Generator $faker) {
- return [
- 'name' => $faker->company,
- ];
-});
-
-$factory->defineAs(App\Models\Component::class, 'component', function (Faker\Generator $faker) {
- return [
- 'name' => $faker->text(20),
- 'category_id' => Category::where('category_type', 'component')->inRandomOrder()->first()->id,
- 'location_id' => Location::inRandomOrder()->first()->id,
- 'serial' => $faker->uuid,
- 'qty' => $faker->numberBetween(3, 10),
- 'order_number' => $faker->numberBetween(1000000, 50000000),
- 'purchase_date' => $faker->dateTime(),
- 'purchase_cost' => $faker->randomFloat(2),
- 'min_amt' => $faker->numberBetween($min = 1, $max = 2),
- 'company_id' => Company::inRandomOrder()->first()->id
- ];
-});
-
-$factory->defineAs(App\Models\Depreciation::class, 'depreciation', function (Faker\Generator $faker) {
- return [
- 'name' => $faker->text(20),
- 'months' => $faker->numberBetween(1, 10),
- ];
-});
-
-$factory->defineAs(App\Models\Accessory::class, 'accessory', function (Faker\Generator $faker) {
- return [
- 'company_id' => Company::inRandomOrder()->first()->id,
- 'name' => $faker->text(20),
- 'category_id' => Category::where('category_type', 'accessory')->inRandomOrder()->first()->id,
- 'manufacturer_id' => Manufacturer::inRandomOrder()->first()->id,
- 'location_id' => Location::inRandomOrder()->first()->id,
- 'order_number' => $faker->numberBetween(1000000, 50000000),
- 'purchase_date' => $faker->dateTime(),
- 'purchase_cost' => $faker->randomFloat(2),
- 'qty' => $faker->numberBetween(5, 10),
- 'min_amt' => $faker->numberBetween($min = 1, $max = 2),
- ];
-
-});
-
-
-$factory->defineAs(App\Models\Supplier::class, 'supplier', function (Faker\Generator $faker) {
+$factory->define(App\Models\Supplier::class, function (Faker\Generator $faker) {
return [
'name' => $faker->company,
'address' => $faker->streetAddress,
@@ -144,230 +199,16 @@ $factory->defineAs(App\Models\Supplier::class, 'supplier', function (Faker\Gener
];
});
-
-$factory->defineAs(App\Models\Consumable::class, 'consumable', function (Faker\Generator $faker) {
+$factory->define(App\Models\Setting::class, function ($faker) {
return [
- 'name' => $faker->text(20),
- 'company_id' => Company::inRandomOrder()->first()->id,
- 'category_id' => Category::where('category_type', 'consumable')->inRandomOrder()->first()->id,
- 'model_number' => $faker->numberBetween(1000000, 50000000),
- 'item_no' => $faker->numberBetween(1000000, 50000000),
- 'order_number' => $faker->numberBetween(1000000, 50000000),
- 'purchase_date' => $faker->dateTime(),
- 'purchase_cost' => $faker->randomFloat(2),
- 'qty' => $faker->numberBetween(5, 10),
- 'min_amt' => $faker->numberBetween($min = 1, $max = 2),
- ];
-});
-
-
-$factory->defineAs(App\Models\Statuslabel::class, 'rtd', function (Faker\Generator $faker) {
- return [
- 'name' => 'Ready to Deploy',
- 'created_at' => $faker->dateTime(),
- 'updated_at' => $faker->dateTime(),
- 'user_id' => 1,
- 'deleted_at' => null,
- 'deployable' => 1,
- 'pending' => 0,
- 'archived' => 0,
- 'notes' => ''
- ];
-});
-
-$factory->defineAs(App\Models\Statuslabel::class, 'pending', function (Faker\Generator $faker) {
- return [
- 'name' => 'Pending',
- 'created_at' => $faker->dateTime(),
- 'updated_at' => $faker->dateTime(),
- 'user_id' => 1,
- 'deleted_at' => null,
- 'deployable' => 0,
- 'pending' => 1,
- 'archived' => 0,
- 'notes' => $faker->sentence
- ];
-});
-
-$factory->defineAs(App\Models\Statuslabel::class, 'archived', function (Faker\Generator $faker) {
- return [
- 'name' => 'Archived',
- 'created_at' => $faker->dateTime(),
- 'updated_at' => $faker->dateTime(),
- 'user_id' => 1,
- 'deleted_at' => null,
- 'deployable' => 0,
- 'pending' => 0,
- 'archived' => 1,
- 'notes' => 'These assets are permanently undeployable'
- ];
-});
-
-$factory->defineAs(App\Models\Statuslabel::class, 'out_for_diagnostics', function (Faker\Generator $faker) {
- return [
- 'name' => 'Out for Diagnostics',
- 'created_at' => $faker->dateTime(),
- 'updated_at' => $faker->dateTime(),
- 'user_id' => 1,
- 'deleted_at' => null,
- 'deployable' => 0,
- 'pending' => 0,
- 'archived' => 0,
- 'notes' => ''
- ];
-});
-
-$factory->defineAs(App\Models\Statuslabel::class, 'out_for_repair', function (Faker\Generator $faker) {
- return [
- 'name' => 'Out for Repair',
- 'created_at' => $faker->dateTime(),
- 'updated_at' => $faker->dateTime(),
- 'user_id' => 1,
- 'deleted_at' => null,
- 'deployable' => 0,
- 'pending' => 0,
- 'archived' => 0,
- 'notes' => ''
- ];
-});
-
-$factory->defineAs(App\Models\Statuslabel::class, 'broken', function (Faker\Generator $faker) {
- return [
- 'name' => 'Broken - Not Fixable',
- 'created_at' => $faker->dateTime(),
- 'updated_at' => $faker->dateTime(),
- 'user_id' => 1,
- 'deleted_at' => null,
- 'deployable' => 0,
- 'pending' => 0,
- 'archived' => 1,
- 'notes' => ''
- ];
-});
-
-$factory->defineAs(App\Models\Statuslabel::class, 'lost', function (Faker\Generator $faker) {
- return [
- 'name' => 'Lost/Stolen',
- 'created_at' => $faker->dateTime(),
- 'updated_at' => $faker->dateTime(),
- 'user_id' => 1,
- 'deleted_at' => null,
- 'deployable' => 0,
- 'pending' => 0,
- 'archived' => 1,
- 'notes' => '',
- ];
-});
-
-$factory->defineAs(App\Models\License::class, 'license', function (Faker\Generator $faker) {
- return [
- 'name' => $faker->catchPhrase,
- 'serial' => $faker->uuid,
- 'seats' => $faker->numberBetween(1, 10),
- 'license_email' => $faker->safeEmail,
- 'license_name' => $faker->name,
- 'order_number' => $faker->numberBetween(1500, 13250),
- 'purchase_order' => $faker->numberBetween(1500, 13250),
- 'purchase_date' => $faker->dateTime(),
- 'purchase_cost' => $faker->randomFloat(2),
- 'notes' => $faker->sentence,
- 'supplier_id' => Supplier::inRandomOrder()->first()->id,
- 'company_id' => Company::inRandomOrder()->first()->id
- ];
-});
-
-$factory->defineAs(App\Models\LicenseSeat::class, 'license-seat', function (Faker\Generator $faker) {
- return [
- 'license_id' => $faker->numberBetween(1, 10),
- 'created_at' => $faker->dateTime(),
- 'updated_at' => $faker->dateTime(),
- 'notes' => $faker->sentence,
- 'user_id' => '1',
- ];
-});
-
-$factory->defineAs(App\Models\Actionlog::class, 'asset-checkout', function (Faker\Generator $faker) {
- $company = Company::has('users')->has('assets')->inRandomOrder()->first();
- return [
- 'user_id' => $company->users()->inRandomOrder()->first()->id,
- 'action_type' => 'checkout',
- 'item_id' => $company->assets()->inRandomOrder()->first()->id,
- 'target_id' => $company->users()->inRandomOrder()->first()->id,
- 'target_type' => 'App\\Models\\User',
- 'created_at' => $faker->dateTime(),
- 'item_type' => 'App\\Models\\Asset',
- 'note' => $faker->sentence,
- 'company_id' => $company->id
- ];
-});
-
-$factory->defineAs(App\Models\Actionlog::class, 'license-checkout-asset', function (Faker\Generator $faker) {
- $company = Company::has('users')->has('licenses')->inRandomOrder()->first();
-
- return [
- 'user_id' => $company->users()->inRandomOrder()->first()->id,
- 'action_type' => 'checkout',
- 'item_id' => $company->licenses()->whereNotNull('company_id')->inRandomOrder()->first()->id,
- 'target_id' => $company->assets()->inRandomOrder()->first()->id,
- 'target_type' => 'App\\Models\\Asset',
- 'created_at' => $faker->dateTime(),
- 'item_type' => 'App\\Models\\License',
- 'note' => $faker->sentence,
- 'company_id' => $company->id
- ];
-});
-
-$factory->defineAs(App\Models\Actionlog::class, 'accessory-checkout', function (Faker\Generator $faker) {
- $company = Company::has('users')->has('accessories')->inRandomOrder()->first();
- return [
- 'user_id' => $company->users()->inRandomOrder()->first()->id,
- 'action_type' => 'checkout',
- 'item_id' => $company->accessories()->whereNotNull('company_id')->inRandomOrder()->first()->id,
- 'target_id' => $company->users()->inRandomOrder()->first()->id,
- 'target_type' => 'App\\Models\\User',
- 'created_at' => $faker->dateTime(),
- 'item_type' => 'App\\Models\\Accessory',
- 'note' => $faker->sentence,
- 'company_id' => $company->id
- ];
-});
-
-$factory->defineAs(App\Models\Actionlog::class, 'consumable-checkout', function (Faker\Generator $faker) {
- $company = Company::has('users')->has('consumables')->inRandomOrder()->first();
-
- return [
- 'user_id' => $company->users()->inRandomOrder()->first()->id,
- 'action_type' => 'checkout',
- 'item_id' => $company->consumables()->whereNotNull('company_id')->inRandomOrder()->first()->id,
- 'target_id' => $company->users()->inRandomOrder()->first()->id,
- 'target_type' => 'App\\Models\\User',
- 'created_at' => $faker->dateTime(),
- 'item_type' => 'App\\Models\\Consumable',
- 'note' => $faker->sentence,
- 'company_id' => $company->id
- ];
-});
-
-$factory->defineAs(App\Models\Actionlog::class, 'component-checkout', function (Faker\Generator $faker) {
- $company = Company::has('users')->has('components')->inRandomOrder()->first();
-
- return [
- 'user_id' => $company->users()->inRandomOrder()->first()->id,
- 'action_type' => 'checkout',
- 'item_id' => $company->components()->whereNotNull('company_id')->inRandomOrder()->first()->id,
- 'target_id' => $company->users()->inRandomOrder()->first()->id,
- 'target_type' => 'App\\Models\\User',
- 'created_at' => $faker->dateTime(),
- 'item_type' => 'App\\Models\\Component',
- 'note' => $faker->sentence,
- 'company_id' => $company->id
- ];
-});
-
-$factory->defineAs(App\Models\CustomField::class, 'customfield-ip', function (Faker\Generator $faker) {
- return [
- 'name' => $faker->catchPhrase,
- 'format' => 'IP',
- 'element' => 'text',
+ 'user_id' => 1,
+ 'per_page' => 20,
+ 'site_name' => $faker->sentence,
+ 'auto_increment_assets' => false,
+ 'alert_email' => $faker->safeEmail(),
+ 'alerts_enabled' => false,
+ 'brand' => 1,
+ 'default_currency' => $faker->currencyCode,
+ 'locale' => $faker->locale,
];
});
diff --git a/database/factories/StatusLabelFactory.php b/database/factories/StatusLabelFactory.php
new file mode 100644
index 000000000..60b0bbc50
--- /dev/null
+++ b/database/factories/StatusLabelFactory.php
@@ -0,0 +1,60 @@
+define(Statuslabel::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->sentence,
+ 'created_at' => $faker->dateTime(),
+ 'updated_at' => $faker->dateTime(),
+ 'user_id' => 1,
+ 'deleted_at' => null,
+ 'deployable' => 0,
+ 'pending' => 0,
+ 'archived' => 0,
+ 'notes' => ''
+ ];
+});
+$factory->state(Statuslabel::class, 'rtd', function (Faker\Generator $faker) {
+ return [
+ 'notes' => $faker->sentence,
+ 'deployable' => 1
+ ];
+});
+$factory->state(Statuslabel::class, 'pending', function (Faker\Generator $faker) {
+ return [
+ 'notes' => $faker->sentence,
+ 'pending' => 1,
+ ];
+});
+
+$factory->state(Statuslabel::class, 'archived', function (Faker\Generator $faker) {
+ return [
+ 'notes' => 'These assets are permanently undeployable',
+ 'archived' => 1,
+ ];
+});
+
+$factory->state(Statuslabel::class, 'out_for_diagnostics', function (Faker\Generator $faker) {
+ return [
+ 'name' => 'Out for Diagnostics',
+ ];
+});
+
+$factory->state(Statuslabel::class, 'out_for_repair', function (Faker\Generator $faker) {
+ return [
+ 'name' => 'Out for Repair',
+ ];
+});
+
+$factory->state(Statuslabel::class, 'broken', function (Faker\Generator $faker) {
+ return [
+ 'name' => 'Broken - Not Fixable',
+ ];
+});
+
+$factory->state(Statuslabel::class, 'lost', function (Faker\Generator $faker) {
+ return [
+ 'name' => 'Lost/Stolen',
+ ];
+});
diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php
index 983b64e5b..76e3c277e 100644
--- a/database/factories/UserFactory.php
+++ b/database/factories/UserFactory.php
@@ -2,26 +2,31 @@
use App\Models\Company;
-$factory->defineAs(App\Models\User::class, 'valid-user', function (Faker\Generator $faker) {
+$factory->define(App\Models\User::class, function (Faker\Generator $faker) {
return [
- 'first_name' => $faker->firstName,
- 'last_name' => $faker->lastName,
- 'username' => $faker->username,
- 'password' => $faker->password,
- 'permissions' => '{"user":"0"}',
- 'email' => $faker->safeEmail,
- 'company_id' => Company::inRandomOrder()->first()->id,
- 'locale' => $faker->locale,
- 'employee_num' => $faker->numberBetween(3500, 35050),
- 'jobtitle' => $faker->word,
- 'phone' => $faker->phoneNumber,
- 'notes' => $faker->sentence
+ 'first_name' => $faker->firstName,
+ 'last_name' => $faker->lastName,
+ 'username' => $faker->username,
+ 'password' => $faker->password,
+ 'permissions' => '{"user":"0"}',
+ 'email' => $faker->safeEmail,
+ 'company_id' => function () {
+ return factory(App\Models\Company::class)->create()->id;
+ },
+ 'locale' => $faker->locale,
+ 'employee_num' => $faker->numberBetween(3500, 35050),
+ 'jobtitle' => $faker->word,
+ 'phone' => $faker->phoneNumber,
+ 'notes' => $faker->sentence,
+ 'location_id' => function () {
+ return factory(App\Models\Location::class)->create()->id;
+ },
];
});
// USER GLOBAL PERMISSION STATES
$factory->state(App\Models\User::class, 'superuser', function ($faker) {
return [
- 'permissions' => '{"superuser":"1"}',
+ 'permissions' => '{"superuser":"1"}',
];
});
@@ -33,7 +38,7 @@ $factory->state(App\Models\User::class, 'admin', function ($faker) {
// USER ASSET PERMISSION STATES
$factory->state(App\Models\User::class, 'view-assets', function ($faker) {
return [
- 'permissions' => '{"assets.view":"1"}',
+ 'permissions' => '{"assets.view":"1"}',
];
});
@@ -51,7 +56,7 @@ $factory->state(App\Models\User::class, 'edit-assets', function ($faker) {
$factory->state(App\Models\User::class, 'delete-assets', function ($faker) {
return [
- 'permissions' => '{"assets.delete":"1",}',
+ 'permissions' => '{"assets.delete":"1"}',
];
});
@@ -76,7 +81,7 @@ $factory->state(App\Models\User::class, 'view-requestable-assets', function ($fa
// USER ACCESSORY PERMISSION STATES
$factory->state(App\Models\User::class, 'view-accessories', function ($faker) {
return [
- 'permissions' => '{"accessories.view":"1"}',
+ 'permissions' => '{"accessories.view":"1"}',
];
});
@@ -94,7 +99,7 @@ $factory->state(App\Models\User::class, 'edit-accessories', function ($faker) {
$factory->state(App\Models\User::class, 'delete-accessories', function ($faker) {
return [
- 'permissions' => '{"accessories.delete":"1",}',
+ 'permissions' => '{"accessories.delete":"1"}',
];
});
@@ -113,7 +118,7 @@ $factory->state(App\Models\User::class, 'checkout-accessories', function ($faker
// USER CONSUMABLE PERMISSION STATES
$factory->state(App\Models\User::class, 'view-consumables', function ($faker) {
return [
- 'permissions' => '{"consumables.view":"1"}',
+ 'permissions' => '{"consumables.view":"1"}',
];
});
@@ -131,7 +136,7 @@ $factory->state(App\Models\User::class, 'edit-consumables', function ($faker) {
$factory->state(App\Models\User::class, 'delete-consumables', function ($faker) {
return [
- 'permissions' => '{"consumables.delete":"1",}',
+ 'permissions' => '{"consumables.delete":"1"}',
];
});
@@ -150,7 +155,7 @@ $factory->state(App\Models\User::class, 'checkout-consumables', function ($faker
// USER LICENSE PERMISSION STATES
$factory->state(App\Models\User::class, 'view-licenses', function ($faker) {
return [
- 'permissions' => '{"licenses.view":"1"}',
+ 'permissions' => '{"licenses.view":"1"}',
];
});
@@ -168,7 +173,7 @@ $factory->state(App\Models\User::class, 'edit-licenses', function ($faker) {
$factory->state(App\Models\User::class, 'delete-licenses', function ($faker) {
return [
- 'permissions' => '{"licenses.delete":"1",}',
+ 'permissions' => '{"licenses.delete":"1"}',
];
});
@@ -187,7 +192,7 @@ $factory->state(App\Models\User::class, 'view-keys-licenses', function ($faker)
// USER COMPONENTS PERMISSION STATES
$factory->state(App\Models\User::class, 'view-components', function ($faker) {
return [
- 'permissions' => '{"components.view":"1"}',
+ 'permissions' => '{"components.view":"1"}',
];
});
@@ -205,7 +210,7 @@ $factory->state(App\Models\User::class, 'edit-components', function ($faker) {
$factory->state(App\Models\User::class, 'delete-components', function ($faker) {
return [
- 'permissions' => '{"components.delete":"1",}',
+ 'permissions' => '{"components.delete":"1"}',
];
});
@@ -224,7 +229,7 @@ $factory->state(App\Models\User::class, 'checkout-components', function ($faker)
// USER USER PERMISSION STATES
$factory->state(App\Models\User::class, 'view-users', function ($faker) {
return [
- 'permissions' => '{"users.view":"1"}',
+ 'permissions' => '{"users.view":"1"}',
];
});
@@ -242,6 +247,6 @@ $factory->state(App\Models\User::class, 'edit-users', function ($faker) {
$factory->state(App\Models\User::class, 'delete-users', function ($faker) {
return [
- 'permissions' => '{"users.delete":"1",}',
+ 'permissions' => '{"users.delete":"1"}',
];
});
diff --git a/database/seeds/AccessorySeeder.php b/database/seeds/AccessorySeeder.php
index 81dafb98a..f29a65fed 100644
--- a/database/seeds/AccessorySeeder.php
+++ b/database/seeds/AccessorySeeder.php
@@ -7,6 +7,6 @@ class AccessorySeeder extends Seeder
public function run()
{
Accessory::truncate();
- factory(Accessory::class, 'accessory',15)->create();
+ factory(Accessory::class,15)->create();
}
}
diff --git a/database/seeds/ActionlogSeeder.php b/database/seeds/ActionlogSeeder.php
index f7f9dd4e0..bb81a4aa4 100644
--- a/database/seeds/ActionlogSeeder.php
+++ b/database/seeds/ActionlogSeeder.php
@@ -8,9 +8,9 @@ class ActionlogSeeder extends Seeder
{
Actionlog::truncate();
factory(Actionlog::class, 'asset-checkout',25)->create();
- factory(Actionlog::class, 'accessory-checkout',15)->create();
- factory(Actionlog::class, 'consumable-checkout', 15)->create();
- factory(Actionlog::class, 'component-checkout', 15)->create();
- factory(Actionlog::class, 'license-checkout-asset', 15)->create();
+ // factory(Actionlog::class, 'accessory-checkout',15)->create();
+ // factory(Actionlog::class, 'consumable-checkout', 15)->create();
+ // factory(Actionlog::class, 'component-checkout', 15)->create();
+ // factory(Actionlog::class, 'license-checkout-asset', 15)->create();
}
}
diff --git a/database/seeds/AssetModelSeeder.php b/database/seeds/AssetModelSeeder.php
index 90f40525a..6d32f6659 100755
--- a/database/seeds/AssetModelSeeder.php
+++ b/database/seeds/AssetModelSeeder.php
@@ -8,7 +8,7 @@ class AssetModelSeeder extends Seeder
public function run()
{
AssetModel::truncate();
- factory(AssetModel::class, 'assetmodel',5)->create();
+ factory(AssetModel::class,5)->create();
}
}
diff --git a/database/seeds/AssetSeeder.php b/database/seeds/AssetSeeder.php
index dbaddcff0..a19e5dc74 100644
--- a/database/seeds/AssetSeeder.php
+++ b/database/seeds/AssetSeeder.php
@@ -8,10 +8,6 @@ class AssetSeeder extends Seeder
public function run()
{
Asset::truncate();
- factory(Asset::class, 'asset', 100)->create();
-
- // factory(App\Models\Asset::class, 50)->create()->each(function($u) {
- // $u->assetmodel()->save(factory(App\AssetModel::class)->make());
- // });
+ factory(Asset::class, 100)->create();
}
}
diff --git a/database/seeds/CategorySeeder.php b/database/seeds/CategorySeeder.php
index 338acebdc..6546b056c 100755
--- a/database/seeds/CategorySeeder.php
+++ b/database/seeds/CategorySeeder.php
@@ -7,10 +7,10 @@ class CategorySeeder extends Seeder
public function run()
{
Category::truncate();
- factory(Category::class, 'category', 10)->create(['category_type' => 'asset']);
- factory(Category::class, 'category', 10)->create(['category_type' => 'accessory']);
- factory(Category::class, 'category', 10)->create(['category_type' => 'consumable']);
- factory(Category::class, 'category', 10)->create(['category_type' => 'component']);
+ factory(Category::class, 10)->states('asset-category')->create();
+ factory(Category::class, 10)->states('accessory-category')->create();
+ factory(Category::class, 10)->states('component-category')->create();
+ factory(Category::class, 10)->states('consumable-category')->create();
}
}
diff --git a/database/seeds/CompanySeeder.php b/database/seeds/CompanySeeder.php
index 5b8a23866..ba1ac00ba 100644
--- a/database/seeds/CompanySeeder.php
+++ b/database/seeds/CompanySeeder.php
@@ -14,6 +14,6 @@ class CompanySeeder extends Seeder
{
//
Company::truncate();
- factory(Company::class, 'company', 4)->create();
+ factory(Company::class, 4)->create();
}
}
diff --git a/database/seeds/ComponentSeeder.php b/database/seeds/ComponentSeeder.php
index 079e20c14..c1c903866 100644
--- a/database/seeds/ComponentSeeder.php
+++ b/database/seeds/ComponentSeeder.php
@@ -4,10 +4,10 @@ use App\Models\Component;
class ComponentSeeder extends Seeder
{
- public function run()
- {
- Component::truncate();
- DB::table('components_assets')->truncate();
- factory(Component::class, 'component',10)->create();
- }
+ public function run()
+ {
+ Component::truncate();
+ DB::table('components_assets')->truncate();
+ factory(Component::class, 10)->create();
+ }
}
diff --git a/database/seeds/ConsumableSeeder.php b/database/seeds/ConsumableSeeder.php
index 39947c3f4..4f538ed66 100644
--- a/database/seeds/ConsumableSeeder.php
+++ b/database/seeds/ConsumableSeeder.php
@@ -4,9 +4,9 @@ use App\Models\Consumable;
class ConsumableSeeder extends Seeder
{
- public function run()
- {
- Consumable::truncate();
- factory(Consumable::class, 'consumable',25)->create();
- }
+ public function run()
+ {
+ Consumable::truncate();
+ factory(Consumable::class, 25)->create();
+ }
}
diff --git a/database/seeds/DepreciationSeeder.php b/database/seeds/DepreciationSeeder.php
index ac567cd69..1ba63d54c 100644
--- a/database/seeds/DepreciationSeeder.php
+++ b/database/seeds/DepreciationSeeder.php
@@ -4,9 +4,9 @@ use App\Models\Depreciation;
class DepreciationSeeder extends Seeder
{
- public function run()
- {
- Depreciation::truncate();
- factory(Depreciation::class, 'depreciation')->create();
- }
+ public function run()
+ {
+ Depreciation::truncate();
+ factory(Depreciation::class, 5)->create();
+ }
}
diff --git a/database/seeds/LicenseSeeder.php b/database/seeds/LicenseSeeder.php
index a3c5c702a..eebe7a1f6 100644
--- a/database/seeds/LicenseSeeder.php
+++ b/database/seeds/LicenseSeeder.php
@@ -3,19 +3,14 @@ use Illuminate\Database\Seeder;
use App\Models\License;
use App\Models\LicenseSeat;
-
class LicenseSeeder extends Seeder
{
- public function run()
- {
- License::truncate();
- factory(License::class, 'license', 10)->create();
+ public function run()
+ {
+ License::truncate();
+ factory(License::class, 10)->create();
- LicenseSeat::truncate();
- factory(LicenseSeat::class, 'license-seat', 10)->create();
-
- // factory(App\Models\Asset::class, 50)->create()->each(function($u) {
- // $u->assetmodel()->save(factory(App\AssetModel::class)->make());
- // });
- }
+ LicenseSeat::truncate();
+ factory(LicenseSeat::class, 10)->create();
+ }
}
diff --git a/database/seeds/LocationSeeder.php b/database/seeds/LocationSeeder.php
index fd0d3b2ed..3f0b81181 100644
--- a/database/seeds/LocationSeeder.php
+++ b/database/seeds/LocationSeeder.php
@@ -5,10 +5,9 @@ use App\Models\Location;
class LocationSeeder extends Seeder
{
- public function run()
- {
- Location::truncate();
- factory(Location::class, 'location', 5)->create();
-
- }
+ public function run()
+ {
+ Location::truncate();
+ factory(Location::class, 5)->create();
+ }
}
diff --git a/database/seeds/ManufacturerSeeder.php b/database/seeds/ManufacturerSeeder.php
index 73388ca01..9528545b4 100644
--- a/database/seeds/ManufacturerSeeder.php
+++ b/database/seeds/ManufacturerSeeder.php
@@ -7,7 +7,6 @@ class ManufacturerSeeder extends Seeder
public function run()
{
Manufacturer::truncate();
- factory(Manufacturer::class, 'manufacturer', 10)->create();
+ factory(Manufacturer::class, 10)->create();
}
-
}
diff --git a/database/seeds/StatuslabelSeeder.php b/database/seeds/StatuslabelSeeder.php
index ac9731504..1c58d76a0 100755
--- a/database/seeds/StatuslabelSeeder.php
+++ b/database/seeds/StatuslabelSeeder.php
@@ -7,14 +7,13 @@ class StatuslabelSeeder extends Seeder
{
public function run()
{
- Statuslabel::truncate();
- factory(Statuslabel::class, 'rtd')->create();
- factory(Statuslabel::class, 'pending')->create();
- factory(Statuslabel::class, 'archived')->create();
- factory(Statuslabel::class, 'out_for_diagnostics')->create();
- factory(Statuslabel::class, 'out_for_repair')->create();
- factory(Statuslabel::class, 'broken')->create();
- factory(Statuslabel::class, 'lost')->create();
+ Statuslabel::truncate();
+ factory(Statuslabel::class)->states('rtd')->create(['name' => "Ready to Deploy"]);
+ factory(Statuslabel::class)->states('pending')->create(['name' => "Pending"]);
+ factory(Statuslabel::class)->states('archived')->create(['name' => "Archived"]);
+ factory(Statuslabel::class)->states('out_for_diagnostics')->create();
+ factory(Statuslabel::class)->states('out_for_repair')->create();
+ factory(Statuslabel::class)->states('broken')->create();
+ factory(Statuslabel::class)->states('lost')->create();
}
-
}
diff --git a/database/seeds/SupplierSeeder.php b/database/seeds/SupplierSeeder.php
index ea56bd09f..95fd894c0 100644
--- a/database/seeds/SupplierSeeder.php
+++ b/database/seeds/SupplierSeeder.php
@@ -6,8 +6,7 @@ class SupplierSeeder extends Seeder
{
public function run()
{
- Supplier::truncate();
- factory(Supplier::class, 'supplier',5)->create();
+ Supplier::truncate();
+ factory(Supplier::class, 5)->create();
}
-
}
diff --git a/database/seeds/UserSeeder.php b/database/seeds/UserSeeder.php
index 0141aab2c..bff8abb6b 100644
--- a/database/seeds/UserSeeder.php
+++ b/database/seeds/UserSeeder.php
@@ -13,6 +13,6 @@ class UserSeeder extends Seeder
public function run()
{
// Don't truncate the user column, that might suck.
- factory(User::class, 'valid-user', 10)->create();
+ factory(User::class, 10)->create();
}
}
diff --git a/phpunit.xml b/phpunit.xml
index 19d00c20d..c48a1e9ae 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -23,5 +23,7 @@
+
+
diff --git a/resources/views/locations/view.blade.php b/resources/views/locations/view.blade.php
index e4f92fe44..ba30c5325 100644
--- a/resources/views/locations/view.blade.php
+++ b/resources/views/locations/view.blade.php
@@ -26,7 +26,7 @@
name="location_users"
id="table-users"
class="table table-striped snipe-table"
- data-url="{{route('api.locations.viewusers', $location->id)}}"
+ data-url="{{route('api.users.index', ['location_id' => $location->id]) }}"
data-cookie="true"
data-click-to-select="true"
data-cookie-id-table="location_usersDetailTable">
@@ -54,7 +54,7 @@
'v1','namespace' => 'Api'], function () {
Route::group(['prefix' => 'locations'], function () {
- Route::get('{location}/users',
- [
- 'as'=>'api.locations.viewusers',
- 'uses'=>'LocationsController@getDataViewUsers'
- ]
- );
-
- Route::get('{location}/assets',
- [
- 'as'=>'api.locations.viewassets',
- 'uses'=>'LocationsController@getDataViewAssets'
- ]
- );
-
// Do we actually still need this, now that we have an API?
Route::get('{location}/check',
[
diff --git a/tests/_data/dump.sql b/tests/_data/dump.sql
index 4ecc94ba9..77e4f0def 100644
--- a/tests/_data/dump.sql
+++ b/tests/_data/dump.sql
@@ -1,8 +1,8 @@
--- MySQL dump 10.13 Distrib 5.7.17, for Linux (x86_64)
+-- MySQL dump 10.13 Distrib 5.7.18, for Linux (x86_64)
--
-- Host: localhost Database: snipeittests
-- ------------------------------------------------------
--- Server version 5.7.17-0ubuntu0.16.10.1
+-- Server version 5.7.18-0ubuntu0.16.10.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -539,7 +539,7 @@ CREATE TABLE `custom_fields` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
- `field_values` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `field_values` text COLLATE utf8_unicode_ci,
`field_encrypted` tinyint(1) NOT NULL DEFAULT '0',
`db_column` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`help_text` text COLLATE utf8_unicode_ci,
@@ -583,6 +583,37 @@ INSERT INTO `custom_fieldsets` VALUES (1,'Asset with MAC Address',NULL,NULL,NULL
/*!40000 ALTER TABLE `custom_fieldsets` ENABLE KEYS */;
UNLOCK TABLES;
+--
+-- Table structure for table `departments`
+--
+
+DROP TABLE IF EXISTS `departments`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `departments` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
+ `user_id` int(11) NOT NULL,
+ `company_id` int(11) DEFAULT NULL,
+ `location_id` int(11) DEFAULT NULL,
+ `manager_id` int(11) DEFAULT NULL,
+ `notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `created_at` timestamp NULL DEFAULT NULL,
+ `updated_at` timestamp NULL DEFAULT NULL,
+ `deleted_at` timestamp NULL DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `departments`
+--
+
+LOCK TABLES `departments` WRITE;
+/*!40000 ALTER TABLE `departments` DISABLE KEYS */;
+/*!40000 ALTER TABLE `departments` ENABLE KEYS */;
+UNLOCK TABLES;
+
--
-- Table structure for table `depreciations`
--
@@ -765,6 +796,7 @@ CREATE TABLE `locations` (
`parent_id` int(11) DEFAULT NULL,
`currency` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`ldap_ou` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
+ `manager_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -775,7 +807,7 @@ CREATE TABLE `locations` (
LOCK TABLES `locations` WRITE;
/*!40000 ALTER TABLE `locations` DISABLE KEYS */;
-INSERT INTO `locations` VALUES (1,'Multi-lateral 24hour hub','North Llewellyn','IN','BJ','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'13212 Schmidt Extensions Suite 682','Apt. 456','67559',NULL,NULL,'TWD',NULL),(2,'Streamlined value-added firmware','East Johnathonville','IL','BS','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'9429 Koch Village','Suite 789','51112-9226',NULL,NULL,'TTD',NULL),(3,'Persistent asynchronous frame','New Delphaside','AK','LR','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'7600 Howell Valleys Apt. 730','Suite 939','26693',NULL,NULL,'JPY',NULL),(4,'Inverse optimal array','Port Laura','DE','SC','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'9542 Cronin Crescent Apt. 550','Suite 792','56208-6621',NULL,NULL,'SYP',NULL),(5,'Networked zeroadministration standardization','Paucekfort','FL','MZ','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'187 Gerhold Harbor Suite 314','Suite 620','68500',NULL,NULL,'CLF',NULL);
+INSERT INTO `locations` VALUES (1,'Multi-lateral 24hour hub','North Llewellyn','IN','BJ','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'13212 Schmidt Extensions Suite 682','Apt. 456','67559',NULL,NULL,'TWD',NULL,NULL),(2,'Streamlined value-added firmware','East Johnathonville','IL','BS','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'9429 Koch Village','Suite 789','51112-9226',NULL,NULL,'TTD',NULL,NULL),(3,'Persistent asynchronous frame','New Delphaside','AK','LR','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'7600 Howell Valleys Apt. 730','Suite 939','26693',NULL,NULL,'JPY',NULL,NULL),(4,'Inverse optimal array','Port Laura','DE','SC','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'9542 Cronin Crescent Apt. 550','Suite 792','56208-6621',NULL,NULL,'SYP',NULL,NULL),(5,'Networked zeroadministration standardization','Paucekfort','FL','MZ','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,'187 Gerhold Harbor Suite 314','Suite 620','68500',NULL,NULL,'CLF',NULL,NULL);
/*!40000 ALTER TABLE `locations` ENABLE KEYS */;
UNLOCK TABLES;
@@ -823,7 +855,7 @@ CREATE TABLE `migrations` (
`migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+) ENGINE=InnoDB AUTO_INCREMENT=224 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -832,7 +864,7 @@ CREATE TABLE `migrations` (
LOCK TABLES `migrations` WRITE;
/*!40000 ALTER TABLE `migrations` DISABLE KEYS */;
-INSERT INTO `migrations` VALUES (1,'2012_12_06_225921_migration_cartalyst_sentry_install_users',1),(2,'2012_12_06_225929_migration_cartalyst_sentry_install_groups',1),(3,'2012_12_06_225945_migration_cartalyst_sentry_install_users_groups_pivot',1),(4,'2012_12_06_225988_migration_cartalyst_sentry_install_throttle',1),(5,'2013_03_23_193214_update_users_table',1),(6,'2013_11_13_075318_create_models_table',1),(7,'2013_11_13_075335_create_categories_table',1),(8,'2013_11_13_075347_create_manufacturers_table',1),(9,'2013_11_15_015858_add_user_id_to_categories',1),(10,'2013_11_15_112701_add_user_id_to_manufacturers',1),(11,'2013_11_15_190327_create_assets_table',1),(12,'2013_11_15_190357_create_licenses_table',1),(13,'2013_11_15_201848_add_license_name_to_licenses',1),(14,'2013_11_16_040323_create_depreciations_table',1),(15,'2013_11_16_042851_add_depreciation_id_to_models',1),(16,'2013_11_16_084923_add_user_id_to_models',1),(17,'2013_11_16_103258_create_locations_table',1),(18,'2013_11_16_103336_add_location_id_to_assets',1),(19,'2013_11_16_103407_add_checkedout_to_to_assets',1),(20,'2013_11_16_103425_create_history_table',1),(21,'2013_11_17_054359_drop_licenses_table',1),(22,'2013_11_17_054526_add_physical_to_assets',1),(23,'2013_11_17_055126_create_settings_table',1),(24,'2013_11_17_062634_add_license_to_assets',1),(25,'2013_11_18_134332_add_contacts_to_users',1),(26,'2013_11_18_142847_add_info_to_locations',1),(27,'2013_11_18_152942_remove_location_id_from_asset',1),(28,'2013_11_18_164423_set_nullvalues_for_user',1),(29,'2013_11_19_013337_create_asset_logs_table',1),(30,'2013_11_19_061409_edit_added_on_asset_logs_table',1),(31,'2013_11_19_062250_edit_location_id_asset_logs_table',1),(32,'2013_11_20_055822_add_soft_delete_on_assets',1),(33,'2013_11_20_121404_add_soft_delete_on_locations',1),(34,'2013_11_20_123137_add_soft_delete_on_manufacturers',1),(35,'2013_11_20_123725_add_soft_delete_on_categories',1),(36,'2013_11_20_130248_create_status_labels',1),(37,'2013_11_20_130830_add_status_id_on_assets_table',1),(38,'2013_11_20_131544_add_status_type_on_status_labels',1),(39,'2013_11_20_134103_add_archived_to_assets',1),(40,'2013_11_21_002321_add_uploads_table',1),(41,'2013_11_21_024531_remove_deployable_boolean_from_status_labels',1),(42,'2013_11_22_075308_add_option_label_to_settings_table',1),(43,'2013_11_22_213400_edits_to_settings_table',1),(44,'2013_11_25_013244_create_licenses_table',1),(45,'2013_11_25_031458_create_license_seats_table',1),(46,'2013_11_25_032022_add_type_to_actionlog_table',1),(47,'2013_11_25_033008_delete_bad_licenses_table',1),(48,'2013_11_25_033131_create_new_licenses_table',1),(49,'2013_11_25_033534_add_licensed_to_licenses_table',1),(50,'2013_11_25_101308_add_warrantee_to_assets_table',1),(51,'2013_11_25_104343_alter_warranty_column_on_assets',1),(52,'2013_11_25_150450_drop_parent_from_categories',1),(53,'2013_11_25_151920_add_depreciate_to_assets',1),(54,'2013_11_25_152903_add_depreciate_to_licenses_table',1),(55,'2013_11_26_211820_drop_license_from_assets_table',1),(56,'2013_11_27_062510_add_note_to_asset_logs_table',1),(57,'2013_12_01_113426_add_filename_to_asset_log',1),(58,'2013_12_06_094618_add_nullable_to_licenses_table',1),(59,'2013_12_10_084038_add_eol_on_models_table',1),(60,'2013_12_12_055218_add_manager_to_users_table',1),(61,'2014_01_28_031200_add_qr_code_to_settings_table',1),(62,'2014_02_13_183016_add_qr_text_to_settings_table',1),(63,'2014_05_24_093839_alter_default_license_depreciation_id',1),(64,'2014_05_27_231658_alter_default_values_licenses',1),(65,'2014_06_19_191508_add_asset_name_to_settings',1),(66,'2014_06_20_004847_make_asset_log_checkedout_to_nullable',1),(67,'2014_06_20_005050_make_asset_log_purchasedate_to_nullable',1),(68,'2014_06_24_003011_add_suppliers',1),(69,'2014_06_24_010742_add_supplier_id_to_asset',1),(70,'2014_06_24_012839_add_zip_to_supplier',1),(71,'2014_06_24_033908_add_url_to_supplier',1),(72,'2014_07_08_054116_add_employee_id_to_users',1),(73,'2014_07_09_134316_add_requestable_to_assets',1),(74,'2014_07_17_085822_add_asset_to_software',1),(75,'2014_07_17_161625_make_asset_id_in_logs_nullable',1),(76,'2014_08_12_053504_alpha_0_4_2_release',1),(77,'2014_08_17_083523_make_location_id_nullable',1),(78,'2014_10_16_200626_add_rtd_location_to_assets',1),(79,'2014_10_24_000417_alter_supplier_state_to_32',1),(80,'2014_10_24_015641_add_display_checkout_date',1),(81,'2014_10_28_222654_add_avatar_field_to_users_table',1),(82,'2014_10_29_045924_add_image_field_to_models_table',1),(83,'2014_11_01_214955_add_eol_display_to_settings',1),(84,'2014_11_04_231416_update_group_field_for_reporting',1),(85,'2014_11_05_212408_add_fields_to_licenses',1),(86,'2014_11_07_021042_add_image_to_supplier',1),(87,'2014_11_20_203007_add_username_to_user',1),(88,'2014_11_20_223947_add_auto_to_settings',1),(89,'2014_11_20_224421_add_prefix_to_settings',1),(90,'2014_11_21_104401_change_licence_type',1),(91,'2014_12_09_082500_add_fields_maintained_term_to_licenses',1),(92,'2015_02_04_155757_increase_user_field_lengths',1),(93,'2015_02_07_013537_add_soft_deleted_to_log',1),(94,'2015_02_10_040958_fix_bad_assigned_to_ids',1),(95,'2015_02_10_053310_migrate_data_to_new_statuses',1),(96,'2015_02_11_044104_migrate_make_license_assigned_null',1),(97,'2015_02_11_104406_migrate_create_requests_table',1),(98,'2015_02_12_001312_add_mac_address_to_asset',1),(99,'2015_02_12_024100_change_license_notes_type',1),(100,'2015_02_17_231020_add_localonly_to_settings',1),(101,'2015_02_19_222322_add_logo_and_colors_to_settings',1),(102,'2015_02_24_072043_add_alerts_to_settings',1),(103,'2015_02_25_022931_add_eula_fields',1),(104,'2015_02_25_204513_add_accessories_table',1),(105,'2015_02_26_091228_add_accessories_user_table',1),(106,'2015_02_26_115128_add_deleted_at_models',1),(107,'2015_02_26_233005_add_category_type',1),(108,'2015_03_01_231912_update_accepted_at_to_acceptance_id',1),(109,'2015_03_05_011929_add_qr_type_to_settings',1),(110,'2015_03_18_055327_add_note_to_user',1),(111,'2015_04_29_234704_add_slack_to_settings',1),(112,'2015_05_04_085151_add_parent_id_to_locations_table',1),(113,'2015_05_22_124421_add_reassignable_to_licenses',1),(114,'2015_06_10_003314_fix_default_for_user_notes',1),(115,'2015_06_10_003554_create_consumables',1),(116,'2015_06_15_183253_move_email_to_username',1),(117,'2015_06_23_070346_make_email_nullable',1),(118,'2015_06_26_213716_create_asset_maintenances_table',1),(119,'2015_07_04_212443_create_custom_fields_table',1),(120,'2015_07_09_014359_add_currency_to_settings_and_locations',1),(121,'2015_07_21_122022_add_expected_checkin_date_to_asset_logs',1),(122,'2015_07_24_093845_add_checkin_email_to_category_table',1),(123,'2015_07_25_055415_remove_email_unique_constraint',1),(124,'2015_07_29_230054_add_thread_id_to_asset_logs_table',1),(125,'2015_07_31_015430_add_accepted_to_assets',1),(126,'2015_09_09_195301_add_custom_css_to_settings',1),(127,'2015_09_21_235926_create_custom_field_custom_fieldset',1),(128,'2015_09_22_000104_create_custom_fieldsets',1),(129,'2015_09_22_003321_add_fieldset_id_to_assets',1),(130,'2015_09_22_003413_migrate_mac_address',1),(131,'2015_09_28_003314_fix_default_purchase_order',1),(132,'2015_10_01_024551_add_accessory_consumable_price_info',1),(133,'2015_10_12_192706_add_brand_to_settings',1),(134,'2015_10_22_003314_fix_defaults_accessories',1),(135,'2015_10_23_182625_add_checkout_time_and_expected_checkout_date_to_assets',1),(136,'2015_11_05_061015_create_companies_table',1),(137,'2015_11_05_061115_add_company_id_to_consumables_table',1),(138,'2015_11_05_183749_image',1),(139,'2015_11_06_092038_add_company_id_to_accessories_table',1),(140,'2015_11_06_100045_add_company_id_to_users_table',1),(141,'2015_11_06_134742_add_company_id_to_licenses_table',1),(142,'2015_11_08_035832_add_company_id_to_assets_table',1),(143,'2015_11_08_222305_add_ldap_fields_to_settings',1),(144,'2015_11_15_151803_add_full_multiple_companies_support_to_settings_table',1),(145,'2015_11_26_195528_import_ldap_settings',1),(146,'2015_11_30_191504_remove_fk_company_id',1),(147,'2015_12_21_193006_add_ldap_server_cert_ignore_to_settings_table',1),(148,'2015_12_30_233509_add_timestamp_and_userId_to_custom_fields',1),(149,'2015_12_30_233658_add_timestamp_and_userId_to_custom_fieldsets',1),(150,'2016_01_28_041048_add_notes_to_models',1),(151,'2016_02_19_070119_add_remember_token_to_users_table',1),(152,'2016_02_19_073625_create_password_resets_table',1),(153,'2016_03_02_193043_add_ldap_flag_to_users',1),(154,'2016_03_02_220517_update_ldap_filter_to_longer_field',1),(155,'2016_03_08_225351_create_components_table',1),(156,'2016_03_09_024038_add_min_stock_to_tables',1),(157,'2016_03_10_133849_add_locale_to_users',1),(158,'2016_03_10_135519_add_locale_to_settings',1),(159,'2016_03_11_185621_add_label_settings_to_settings',1),(160,'2016_03_22_125911_fix_custom_fields_regexes',1),(161,'2016_04_28_141554_add_show_to_users',1),(162,'2016_05_16_164733_add_model_mfg_to_consumable',1),(163,'2016_05_19_180351_add_alt_barcode_settings',1),(164,'2016_05_19_191146_add_alter_interval',1),(165,'2016_05_19_192226_add_inventory_threshold',1),(166,'2016_05_20_024859_remove_option_keys_from_settings_table',1),(167,'2016_05_20_143758_remove_option_value_from_settings_table',1),(168,'2016_06_01_000001_create_oauth_auth_codes_table',1),(169,'2016_06_01_000002_create_oauth_access_tokens_table',1),(170,'2016_06_01_000003_create_oauth_refresh_tokens_table',1),(171,'2016_06_01_000004_create_oauth_clients_table',1),(172,'2016_06_01_000005_create_oauth_personal_access_clients_table',1),(173,'2016_06_01_140218_add_email_domain_and_format_to_settings',1),(174,'2016_06_22_160725_add_user_id_to_maintenances',1),(175,'2016_07_13_150015_add_is_ad_to_settings',1),(176,'2016_07_14_153609_add_ad_domain_to_settings',1),(177,'2016_07_22_003348_fix_custom_fields_regex_stuff',1),(178,'2016_07_22_054850_one_more_mac_addr_fix',1),(179,'2016_07_22_143045_add_port_to_ldap_settings',1),(180,'2016_07_22_153432_add_tls_to_ldap_settings',1),(181,'2016_07_27_211034_add_zerofill_to_settings',1),(182,'2016_08_02_124944_add_color_to_statuslabel',1),(183,'2016_08_04_134500_add_disallow_ldap_pw_sync_to_settings',1),(184,'2016_08_09_002225_add_manufacturer_to_licenses',1),(185,'2016_08_12_121613_add_manufacturer_to_accessories_table',1),(186,'2016_08_23_143353_add_new_fields_to_custom_fields',1),(187,'2016_08_23_145619_add_show_in_nav_to_status_labels',1),(188,'2016_08_30_084634_make_purchase_cost_nullable',1),(189,'2016_09_01_141051_add_requestable_to_asset_model',1),(190,'2016_09_02_001448_create_checkout_requests_table',1),(191,'2016_09_04_180400_create_actionlog_table',1),(192,'2016_09_04_182149_migrate_asset_log_to_action_log',1),(193,'2016_09_19_235935_fix_fieldtype_for_target_type',1),(194,'2016_09_23_140722_fix_modelno_in_consumables_to_string',1),(195,'2016_09_28_231359_add_company_to_logs',1),(196,'2016_10_14_130709_fix_order_number_to_varchar',1),(197,'2016_10_16_015024_rename_modelno_to_model_number',1),(198,'2016_10_16_015211_rename_consumable_modelno_to_model_number',1),(199,'2016_10_16_143235_rename_model_note_to_notes',1),(200,'2016_10_16_165052_rename_component_total_qty_to_qty',1),(201,'2016_10_19_145520_fix_order_number_in_components_to_string',1),(202,'2016_10_27_151715_add_serial_to_components',1),(203,'2016_10_27_213251_increase_serial_field_capacity',1),(204,'2016_10_29_002724_enable_2fa_fields',1),(205,'2016_10_29_082408_add_signature_to_acceptance',1),(206,'2016_11_01_030818_fix_forgotten_filename_in_action_logs',1),(207,'2016_11_13_020954_rename_component_serial_number_to_serial',1),(208,'2016_11_16_172119_increase_purchase_cost_size',1),(209,'2016_11_17_161317_longer_state_field_in_location',1),(210,'2016_11_17_193706_add_model_number_to_accessories',1),(211,'2016_11_24_160405_add_missing_target_type_to_logs_table',1),(212,'2016_12_07_173720_increase_size_of_state_in_suppliers',1),(213,'2016_12_19_004212_adjust_locale_length_to_10',1),(214,'2016_12_19_133936_extend_phone_lengths_in_supplier_and_elsewhere',1),(215,'2016_12_27_212631_make_asset_assigned_to_polymorphic',2),(216,'2017_01_09_040429_create_locations_ldap_query_field',3),(217,'2017_01_14_002418_create_imports_table',3),(218,'2017_01_25_063357_fix_utf8_custom_field_column_names',3),(219,'2017_03_03_154632_add_time_date_display_to_settings',3),(220,'2017_03_10_210807_add_fields_to_manufacturer',3);
+INSERT INTO `migrations` VALUES (1,'2012_12_06_225921_migration_cartalyst_sentry_install_users',1),(2,'2012_12_06_225929_migration_cartalyst_sentry_install_groups',1),(3,'2012_12_06_225945_migration_cartalyst_sentry_install_users_groups_pivot',1),(4,'2012_12_06_225988_migration_cartalyst_sentry_install_throttle',1),(5,'2013_03_23_193214_update_users_table',1),(6,'2013_11_13_075318_create_models_table',1),(7,'2013_11_13_075335_create_categories_table',1),(8,'2013_11_13_075347_create_manufacturers_table',1),(9,'2013_11_15_015858_add_user_id_to_categories',1),(10,'2013_11_15_112701_add_user_id_to_manufacturers',1),(11,'2013_11_15_190327_create_assets_table',1),(12,'2013_11_15_190357_create_licenses_table',1),(13,'2013_11_15_201848_add_license_name_to_licenses',1),(14,'2013_11_16_040323_create_depreciations_table',1),(15,'2013_11_16_042851_add_depreciation_id_to_models',1),(16,'2013_11_16_084923_add_user_id_to_models',1),(17,'2013_11_16_103258_create_locations_table',1),(18,'2013_11_16_103336_add_location_id_to_assets',1),(19,'2013_11_16_103407_add_checkedout_to_to_assets',1),(20,'2013_11_16_103425_create_history_table',1),(21,'2013_11_17_054359_drop_licenses_table',1),(22,'2013_11_17_054526_add_physical_to_assets',1),(23,'2013_11_17_055126_create_settings_table',1),(24,'2013_11_17_062634_add_license_to_assets',1),(25,'2013_11_18_134332_add_contacts_to_users',1),(26,'2013_11_18_142847_add_info_to_locations',1),(27,'2013_11_18_152942_remove_location_id_from_asset',1),(28,'2013_11_18_164423_set_nullvalues_for_user',1),(29,'2013_11_19_013337_create_asset_logs_table',1),(30,'2013_11_19_061409_edit_added_on_asset_logs_table',1),(31,'2013_11_19_062250_edit_location_id_asset_logs_table',1),(32,'2013_11_20_055822_add_soft_delete_on_assets',1),(33,'2013_11_20_121404_add_soft_delete_on_locations',1),(34,'2013_11_20_123137_add_soft_delete_on_manufacturers',1),(35,'2013_11_20_123725_add_soft_delete_on_categories',1),(36,'2013_11_20_130248_create_status_labels',1),(37,'2013_11_20_130830_add_status_id_on_assets_table',1),(38,'2013_11_20_131544_add_status_type_on_status_labels',1),(39,'2013_11_20_134103_add_archived_to_assets',1),(40,'2013_11_21_002321_add_uploads_table',1),(41,'2013_11_21_024531_remove_deployable_boolean_from_status_labels',1),(42,'2013_11_22_075308_add_option_label_to_settings_table',1),(43,'2013_11_22_213400_edits_to_settings_table',1),(44,'2013_11_25_013244_create_licenses_table',1),(45,'2013_11_25_031458_create_license_seats_table',1),(46,'2013_11_25_032022_add_type_to_actionlog_table',1),(47,'2013_11_25_033008_delete_bad_licenses_table',1),(48,'2013_11_25_033131_create_new_licenses_table',1),(49,'2013_11_25_033534_add_licensed_to_licenses_table',1),(50,'2013_11_25_101308_add_warrantee_to_assets_table',1),(51,'2013_11_25_104343_alter_warranty_column_on_assets',1),(52,'2013_11_25_150450_drop_parent_from_categories',1),(53,'2013_11_25_151920_add_depreciate_to_assets',1),(54,'2013_11_25_152903_add_depreciate_to_licenses_table',1),(55,'2013_11_26_211820_drop_license_from_assets_table',1),(56,'2013_11_27_062510_add_note_to_asset_logs_table',1),(57,'2013_12_01_113426_add_filename_to_asset_log',1),(58,'2013_12_06_094618_add_nullable_to_licenses_table',1),(59,'2013_12_10_084038_add_eol_on_models_table',1),(60,'2013_12_12_055218_add_manager_to_users_table',1),(61,'2014_01_28_031200_add_qr_code_to_settings_table',1),(62,'2014_02_13_183016_add_qr_text_to_settings_table',1),(63,'2014_05_24_093839_alter_default_license_depreciation_id',1),(64,'2014_05_27_231658_alter_default_values_licenses',1),(65,'2014_06_19_191508_add_asset_name_to_settings',1),(66,'2014_06_20_004847_make_asset_log_checkedout_to_nullable',1),(67,'2014_06_20_005050_make_asset_log_purchasedate_to_nullable',1),(68,'2014_06_24_003011_add_suppliers',1),(69,'2014_06_24_010742_add_supplier_id_to_asset',1),(70,'2014_06_24_012839_add_zip_to_supplier',1),(71,'2014_06_24_033908_add_url_to_supplier',1),(72,'2014_07_08_054116_add_employee_id_to_users',1),(73,'2014_07_09_134316_add_requestable_to_assets',1),(74,'2014_07_17_085822_add_asset_to_software',1),(75,'2014_07_17_161625_make_asset_id_in_logs_nullable',1),(76,'2014_08_12_053504_alpha_0_4_2_release',1),(77,'2014_08_17_083523_make_location_id_nullable',1),(78,'2014_10_16_200626_add_rtd_location_to_assets',1),(79,'2014_10_24_000417_alter_supplier_state_to_32',1),(80,'2014_10_24_015641_add_display_checkout_date',1),(81,'2014_10_28_222654_add_avatar_field_to_users_table',1),(82,'2014_10_29_045924_add_image_field_to_models_table',1),(83,'2014_11_01_214955_add_eol_display_to_settings',1),(84,'2014_11_04_231416_update_group_field_for_reporting',1),(85,'2014_11_05_212408_add_fields_to_licenses',1),(86,'2014_11_07_021042_add_image_to_supplier',1),(87,'2014_11_20_203007_add_username_to_user',1),(88,'2014_11_20_223947_add_auto_to_settings',1),(89,'2014_11_20_224421_add_prefix_to_settings',1),(90,'2014_11_21_104401_change_licence_type',1),(91,'2014_12_09_082500_add_fields_maintained_term_to_licenses',1),(92,'2015_02_04_155757_increase_user_field_lengths',1),(93,'2015_02_07_013537_add_soft_deleted_to_log',1),(94,'2015_02_10_040958_fix_bad_assigned_to_ids',1),(95,'2015_02_10_053310_migrate_data_to_new_statuses',1),(96,'2015_02_11_044104_migrate_make_license_assigned_null',1),(97,'2015_02_11_104406_migrate_create_requests_table',1),(98,'2015_02_12_001312_add_mac_address_to_asset',1),(99,'2015_02_12_024100_change_license_notes_type',1),(100,'2015_02_17_231020_add_localonly_to_settings',1),(101,'2015_02_19_222322_add_logo_and_colors_to_settings',1),(102,'2015_02_24_072043_add_alerts_to_settings',1),(103,'2015_02_25_022931_add_eula_fields',1),(104,'2015_02_25_204513_add_accessories_table',1),(105,'2015_02_26_091228_add_accessories_user_table',1),(106,'2015_02_26_115128_add_deleted_at_models',1),(107,'2015_02_26_233005_add_category_type',1),(108,'2015_03_01_231912_update_accepted_at_to_acceptance_id',1),(109,'2015_03_05_011929_add_qr_type_to_settings',1),(110,'2015_03_18_055327_add_note_to_user',1),(111,'2015_04_29_234704_add_slack_to_settings',1),(112,'2015_05_04_085151_add_parent_id_to_locations_table',1),(113,'2015_05_22_124421_add_reassignable_to_licenses',1),(114,'2015_06_10_003314_fix_default_for_user_notes',1),(115,'2015_06_10_003554_create_consumables',1),(116,'2015_06_15_183253_move_email_to_username',1),(117,'2015_06_23_070346_make_email_nullable',1),(118,'2015_06_26_213716_create_asset_maintenances_table',1),(119,'2015_07_04_212443_create_custom_fields_table',1),(120,'2015_07_09_014359_add_currency_to_settings_and_locations',1),(121,'2015_07_21_122022_add_expected_checkin_date_to_asset_logs',1),(122,'2015_07_24_093845_add_checkin_email_to_category_table',1),(123,'2015_07_25_055415_remove_email_unique_constraint',1),(124,'2015_07_29_230054_add_thread_id_to_asset_logs_table',1),(125,'2015_07_31_015430_add_accepted_to_assets',1),(126,'2015_09_09_195301_add_custom_css_to_settings',1),(127,'2015_09_21_235926_create_custom_field_custom_fieldset',1),(128,'2015_09_22_000104_create_custom_fieldsets',1),(129,'2015_09_22_003321_add_fieldset_id_to_assets',1),(130,'2015_09_22_003413_migrate_mac_address',1),(131,'2015_09_28_003314_fix_default_purchase_order',1),(132,'2015_10_01_024551_add_accessory_consumable_price_info',1),(133,'2015_10_12_192706_add_brand_to_settings',1),(134,'2015_10_22_003314_fix_defaults_accessories',1),(135,'2015_10_23_182625_add_checkout_time_and_expected_checkout_date_to_assets',1),(136,'2015_11_05_061015_create_companies_table',1),(137,'2015_11_05_061115_add_company_id_to_consumables_table',1),(138,'2015_11_05_183749_image',1),(139,'2015_11_06_092038_add_company_id_to_accessories_table',1),(140,'2015_11_06_100045_add_company_id_to_users_table',1),(141,'2015_11_06_134742_add_company_id_to_licenses_table',1),(142,'2015_11_08_035832_add_company_id_to_assets_table',1),(143,'2015_11_08_222305_add_ldap_fields_to_settings',1),(144,'2015_11_15_151803_add_full_multiple_companies_support_to_settings_table',1),(145,'2015_11_26_195528_import_ldap_settings',1),(146,'2015_11_30_191504_remove_fk_company_id',1),(147,'2015_12_21_193006_add_ldap_server_cert_ignore_to_settings_table',1),(148,'2015_12_30_233509_add_timestamp_and_userId_to_custom_fields',1),(149,'2015_12_30_233658_add_timestamp_and_userId_to_custom_fieldsets',1),(150,'2016_01_28_041048_add_notes_to_models',1),(151,'2016_02_19_070119_add_remember_token_to_users_table',1),(152,'2016_02_19_073625_create_password_resets_table',1),(153,'2016_03_02_193043_add_ldap_flag_to_users',1),(154,'2016_03_02_220517_update_ldap_filter_to_longer_field',1),(155,'2016_03_08_225351_create_components_table',1),(156,'2016_03_09_024038_add_min_stock_to_tables',1),(157,'2016_03_10_133849_add_locale_to_users',1),(158,'2016_03_10_135519_add_locale_to_settings',1),(159,'2016_03_11_185621_add_label_settings_to_settings',1),(160,'2016_03_22_125911_fix_custom_fields_regexes',1),(161,'2016_04_28_141554_add_show_to_users',1),(162,'2016_05_16_164733_add_model_mfg_to_consumable',1),(163,'2016_05_19_180351_add_alt_barcode_settings',1),(164,'2016_05_19_191146_add_alter_interval',1),(165,'2016_05_19_192226_add_inventory_threshold',1),(166,'2016_05_20_024859_remove_option_keys_from_settings_table',1),(167,'2016_05_20_143758_remove_option_value_from_settings_table',1),(168,'2016_06_01_000001_create_oauth_auth_codes_table',1),(169,'2016_06_01_000002_create_oauth_access_tokens_table',1),(170,'2016_06_01_000003_create_oauth_refresh_tokens_table',1),(171,'2016_06_01_000004_create_oauth_clients_table',1),(172,'2016_06_01_000005_create_oauth_personal_access_clients_table',1),(173,'2016_06_01_140218_add_email_domain_and_format_to_settings',1),(174,'2016_06_22_160725_add_user_id_to_maintenances',1),(175,'2016_07_13_150015_add_is_ad_to_settings',1),(176,'2016_07_14_153609_add_ad_domain_to_settings',1),(177,'2016_07_22_003348_fix_custom_fields_regex_stuff',1),(178,'2016_07_22_054850_one_more_mac_addr_fix',1),(179,'2016_07_22_143045_add_port_to_ldap_settings',1),(180,'2016_07_22_153432_add_tls_to_ldap_settings',1),(181,'2016_07_27_211034_add_zerofill_to_settings',1),(182,'2016_08_02_124944_add_color_to_statuslabel',1),(183,'2016_08_04_134500_add_disallow_ldap_pw_sync_to_settings',1),(184,'2016_08_09_002225_add_manufacturer_to_licenses',1),(185,'2016_08_12_121613_add_manufacturer_to_accessories_table',1),(186,'2016_08_23_143353_add_new_fields_to_custom_fields',1),(187,'2016_08_23_145619_add_show_in_nav_to_status_labels',1),(188,'2016_08_30_084634_make_purchase_cost_nullable',1),(189,'2016_09_01_141051_add_requestable_to_asset_model',1),(190,'2016_09_02_001448_create_checkout_requests_table',1),(191,'2016_09_04_180400_create_actionlog_table',1),(192,'2016_09_04_182149_migrate_asset_log_to_action_log',1),(193,'2016_09_19_235935_fix_fieldtype_for_target_type',1),(194,'2016_09_23_140722_fix_modelno_in_consumables_to_string',1),(195,'2016_09_28_231359_add_company_to_logs',1),(196,'2016_10_14_130709_fix_order_number_to_varchar',1),(197,'2016_10_16_015024_rename_modelno_to_model_number',1),(198,'2016_10_16_015211_rename_consumable_modelno_to_model_number',1),(199,'2016_10_16_143235_rename_model_note_to_notes',1),(200,'2016_10_16_165052_rename_component_total_qty_to_qty',1),(201,'2016_10_19_145520_fix_order_number_in_components_to_string',1),(202,'2016_10_27_151715_add_serial_to_components',1),(203,'2016_10_27_213251_increase_serial_field_capacity',1),(204,'2016_10_29_002724_enable_2fa_fields',1),(205,'2016_10_29_082408_add_signature_to_acceptance',1),(206,'2016_11_01_030818_fix_forgotten_filename_in_action_logs',1),(207,'2016_11_13_020954_rename_component_serial_number_to_serial',1),(208,'2016_11_16_172119_increase_purchase_cost_size',1),(209,'2016_11_17_161317_longer_state_field_in_location',1),(210,'2016_11_17_193706_add_model_number_to_accessories',1),(211,'2016_11_24_160405_add_missing_target_type_to_logs_table',1),(212,'2016_12_07_173720_increase_size_of_state_in_suppliers',1),(213,'2016_12_19_004212_adjust_locale_length_to_10',1),(214,'2016_12_19_133936_extend_phone_lengths_in_supplier_and_elsewhere',1),(215,'2016_12_27_212631_make_asset_assigned_to_polymorphic',2),(216,'2017_01_09_040429_create_locations_ldap_query_field',3),(217,'2017_01_14_002418_create_imports_table',3),(218,'2017_01_25_063357_fix_utf8_custom_field_column_names',3),(219,'2017_03_03_154632_add_time_date_display_to_settings',3),(220,'2017_03_10_210807_add_fields_to_manufacturer',3),(221,'2017_05_08_195520_increase_size_of_field_values_in_custom_fields',4),(222,'2017_05_22_233509_add_manager_to_locations_table',4),(223,'2017_05_22_204422_create_departments',5);
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
UNLOCK TABLES;
@@ -1343,10 +1375,11 @@ CREATE TABLE `users` (
`two_factor_secret` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`two_factor_enrolled` tinyint(1) NOT NULL DEFAULT '0',
`two_factor_optin` tinyint(1) NOT NULL DEFAULT '0',
+ `department_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `users_activation_code_index` (`activation_code`),
KEY `users_reset_password_code_index` (`reset_password_code`)
-) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -1355,7 +1388,7 @@ CREATE TABLE `users` (
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
-INSERT INTO `users` VALUES (1,'d@example.com','$2y$10$XkH04QqWoC.IhtnPze3YruWUpu1/9Q80zDJG2FR4mk3CyjrnhkmsW','{\"superuser\":1}',1,NULL,NULL,NULL,NULL,NULL,'test','test','2016-12-19 21:48:55','2016-12-19 21:48:55',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'snipeit',NULL,NULL,'zuY1fNwUa36UV6ufSCgB9HhW06JgwQ7CxPkuZVIajEiPSOAj1DN1wtabmOHy',0,'en',1,NULL,0,0),(2,'bnelson0@cdbaby.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Bonnie',' Nelson','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'bnelson0',NULL,NULL,NULL,0,'en',1,NULL,0,0),(3,'jferguson1@state.tx.us','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Judith',' Ferguson','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'jferguson1',NULL,NULL,NULL,0,'en',1,NULL,0,0),(4,'mgibson2@wiley.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Mildred',' Gibson','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'mgibson2',NULL,NULL,NULL,0,'en',1,NULL,0,0),(5,'blee3@quantcast.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Brandon',' Lee','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'blee3',NULL,NULL,NULL,0,'en',1,NULL,0,0),(6,'bpowell4@tuttocitta.it','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Betty',' Powell','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'bpowell4',NULL,NULL,NULL,0,'en',1,NULL,0,0),(7,'awheeler5@cocolog-nifty.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Anthony',' Wheeler','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'awheeler5',NULL,NULL,NULL,0,'en',1,NULL,0,0),(8,'dreynolds6@ustream.tv','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Dennis',' Reynolds','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'dreynolds6',NULL,NULL,NULL,0,'en',1,NULL,0,0),(9,'aarnold7@cbc.ca','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Andrea',' Arnold','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'aarnold7',NULL,NULL,NULL,0,'en',1,NULL,0,0),(10,'abutler8@wikia.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Anna',' Butler','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'abutler8',NULL,NULL,NULL,0,'en',1,NULL,0,0),(11,'mbennett9@diigo.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Mark',' Bennett','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'mbennett9',NULL,NULL,NULL,0,'en',1,NULL,0,0),(12,'ewheelera@google.de','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Emily',' Wheeler','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ewheelera',NULL,NULL,NULL,0,'en',1,NULL,0,0),(13,'wfoxb@virginia.edu','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Wanda',' Fox','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'wfoxb',NULL,NULL,NULL,0,'en',1,NULL,0,0),(14,'jgrantd@cpanel.net','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Janet',' Grant','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'jgrantd',NULL,NULL,NULL,0,'en',1,NULL,0,0),(15,'alarsone@tripod.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Antonio',' Larson','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'alarsone',NULL,NULL,NULL,0,'en',1,NULL,0,0),(16,'lpowellf@com.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Lois',' Powell','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'lpowellf',NULL,NULL,NULL,0,'en',1,NULL,0,0),(17,'malleng@com.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Mildred',' Allen','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'malleng',NULL,NULL,NULL,0,'en',1,NULL,0,0),(18,'caustinh@bigcartel.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Clarence',' Austin','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'caustinh',NULL,NULL,NULL,0,'en',1,NULL,0,0),(19,'wchavezi@blogs.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Walter',' Chavez','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'wchavezi',NULL,NULL,NULL,0,'en',1,NULL,0,0),(20,'melliottj@constantcontact.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Marie',' Elliott','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'melliottj',NULL,NULL,NULL,0,'en',1,NULL,0,0),(21,'bfordm@woothemes.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Benjamin',' Ford','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'bfordm',NULL,NULL,NULL,0,'en',1,NULL,0,0),(22,'twarrenn@printfriendly.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Timothy',' Warren','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'twarrenn',NULL,NULL,NULL,0,'en',1,NULL,0,0),(23,'oleta24@example.org','~(T$*jvkgD','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Seamus','Johnston','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'696-391-4397 x7738','voluptatibus',NULL,'30018',NULL,'cwalsh','Dolorem ut sunt enim ipsam et ex aliquid.',5,NULL,0,'es_ES',1,NULL,0,0),(24,'collins.felix@example.net','}mFLoec%d@%8F`\'','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Brooklyn','Kozey','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'298.890.9657 x932','consequatur',NULL,'4377',NULL,'palma.gusikowski','Fugiat quo alias sed illo est aut.',6,NULL,0,'st_LS',1,NULL,0,0),(25,'wallace74@example.com','BU_5GB^m<7QtA3A','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Delores','Glover','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'+1-494-731-3779','adipisci',NULL,'17781',NULL,'sbecker','Repellendus incidunt sit placeat provident id.',7,NULL,0,'ve_ZA',1,NULL,0,0),(26,'alex.ward@example.com','JP%\'2I>XCJH8P','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Olga','Dietrich','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'+1 (606) 203-6612','et',NULL,'18909',NULL,'nbarrows','Totam rerum dolores odit voluptate quasi.',8,NULL,0,'tig_ER',1,NULL,0,0),(27,'abe.greenfelder@example.org','wG*H7xY&QN:WWjh\'iSsG','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Mack','Ebert','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'558.948.8107','natus',NULL,'9036',NULL,'little.archibald','Repellat veniam eligendi occaecati.',9,NULL,0,'lv_LV',1,NULL,0,0),(28,'camila85@example.net','bqR_^Gx&@','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Miller','Bogisich','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'+1-956-557-3228','excepturi',NULL,'4977',NULL,'fern.batz','Autem quidem animi iste maxime vitae laborum vitae.',10,NULL,0,'tt_RU',1,NULL,0,0),(29,'veda.erdman@example.net','~+3v)}y~zZZmj','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Isaiah','Bogan','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'+1-602-935-4426','odit',NULL,'29496',NULL,'ssimonis','Deserunt eius voluptates velit illo dolores sunt ex.',11,NULL,0,'en_US',1,NULL,0,0),(30,'friedrich02@example.com','\'Y/^}J~{v!IN`Fg6','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Lavonne','Parisian','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'(478) 560-1259','quia',NULL,'23923',NULL,'mallie19','Architecto aut rerum modi est tempore et nobis.',12,NULL,0,'ms_MY',1,NULL,0,0),(31,'gerda44@example.net','US*`0L4','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Jeanne','Feest','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'682-498-7097 x96752','aperiam',NULL,'19524',NULL,'jessy12','Dignissimos voluptatum molestiae a velit optio quasi aliquam.',13,NULL,0,'gv_GB',1,NULL,0,0),(32,'clementine06@example.com','OD&VXKe\\','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Llewellyn','Lubowitz','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'819.370.6281 x2886','rerum',NULL,'6129',NULL,'fwalsh','Reprehenderit quos porro vitae mollitia ut ipsa rerum.',14,NULL,0,'fil_PH',1,NULL,0,0);
+INSERT INTO `users` VALUES (1,'d@example.com','$2y$10$XkH04QqWoC.IhtnPze3YruWUpu1/9Q80zDJG2FR4mk3CyjrnhkmsW','{\"superuser\":1}',1,NULL,NULL,NULL,NULL,NULL,'test','test','2016-12-19 21:48:55','2016-12-19 21:48:55',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'snipeit',NULL,NULL,'zuY1fNwUa36UV6ufSCgB9HhW06JgwQ7CxPkuZVIajEiPSOAj1DN1wtabmOHy',0,'en',1,NULL,0,0,NULL),(2,'bnelson0@cdbaby.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Bonnie',' Nelson','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'bnelson0',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(3,'jferguson1@state.tx.us','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Judith',' Ferguson','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'jferguson1',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(4,'mgibson2@wiley.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Mildred',' Gibson','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'mgibson2',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(5,'blee3@quantcast.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Brandon',' Lee','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'blee3',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(6,'bpowell4@tuttocitta.it','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Betty',' Powell','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'bpowell4',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(7,'awheeler5@cocolog-nifty.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Anthony',' Wheeler','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'awheeler5',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(8,'dreynolds6@ustream.tv','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Dennis',' Reynolds','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'dreynolds6',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(9,'aarnold7@cbc.ca','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Andrea',' Arnold','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'aarnold7',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(10,'abutler8@wikia.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Anna',' Butler','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'abutler8',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(11,'mbennett9@diigo.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Mark',' Bennett','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'mbennett9',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(12,'ewheelera@google.de','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Emily',' Wheeler','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ewheelera',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(13,'wfoxb@virginia.edu','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Wanda',' Fox','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'wfoxb',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(14,'jgrantd@cpanel.net','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Janet',' Grant','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'jgrantd',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(15,'alarsone@tripod.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Antonio',' Larson','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'alarsone',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(16,'lpowellf@com.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Lois',' Powell','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'lpowellf',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(17,'malleng@com.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Mildred',' Allen','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'malleng',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(18,'caustinh@bigcartel.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Clarence',' Austin','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'caustinh',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(19,'wchavezi@blogs.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Walter',' Chavez','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'wchavezi',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(20,'melliottj@constantcontact.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Marie',' Elliott','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'melliottj',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(21,'bfordm@woothemes.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Benjamin',' Ford','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'bfordm',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(22,'twarrenn@printfriendly.com','$2y$10$MeHQGBejPHm0YLePHWzISutbekRfGDJ1gKeHAbw6xeEpas0oj5Qsq',NULL,1,NULL,NULL,NULL,NULL,NULL,'Timothy',' Warren','2016-12-19 21:49:34','2016-12-19 21:49:34',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'twarrenn',NULL,NULL,NULL,0,'en',1,NULL,0,0,NULL),(23,'oleta24@example.org','~(T$*jvkgD','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Seamus','Johnston','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'696-391-4397 x7738','voluptatibus',NULL,'30018',NULL,'cwalsh','Dolorem ut sunt enim ipsam et ex aliquid.',5,NULL,0,'es_ES',1,NULL,0,0,NULL),(24,'collins.felix@example.net','}mFLoec%d@%8F`\'','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Brooklyn','Kozey','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'298.890.9657 x932','consequatur',NULL,'4377',NULL,'palma.gusikowski','Fugiat quo alias sed illo est aut.',6,NULL,0,'st_LS',1,NULL,0,0,NULL),(25,'wallace74@example.com','BU_5GB^m<7QtA3A','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Delores','Glover','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'+1-494-731-3779','adipisci',NULL,'17781',NULL,'sbecker','Repellendus incidunt sit placeat provident id.',7,NULL,0,'ve_ZA',1,NULL,0,0,NULL),(26,'alex.ward@example.com','JP%\'2I>XCJH8P','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Olga','Dietrich','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'+1 (606) 203-6612','et',NULL,'18909',NULL,'nbarrows','Totam rerum dolores odit voluptate quasi.',8,NULL,0,'tig_ER',1,NULL,0,0,NULL),(27,'abe.greenfelder@example.org','wG*H7xY&QN:WWjh\'iSsG','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Mack','Ebert','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'558.948.8107','natus',NULL,'9036',NULL,'little.archibald','Repellat veniam eligendi occaecati.',9,NULL,0,'lv_LV',1,NULL,0,0,NULL),(28,'camila85@example.net','bqR_^Gx&@','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Miller','Bogisich','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'+1-956-557-3228','excepturi',NULL,'4977',NULL,'fern.batz','Autem quidem animi iste maxime vitae laborum vitae.',10,NULL,0,'tt_RU',1,NULL,0,0,NULL),(29,'veda.erdman@example.net','~+3v)}y~zZZmj','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Isaiah','Bogan','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'+1-602-935-4426','odit',NULL,'29496',NULL,'ssimonis','Deserunt eius voluptates velit illo dolores sunt ex.',11,NULL,0,'en_US',1,NULL,0,0,NULL),(30,'friedrich02@example.com','\'Y/^}J~{v!IN`Fg6','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Lavonne','Parisian','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'(478) 560-1259','quia',NULL,'23923',NULL,'mallie19','Architecto aut rerum modi est tempore et nobis.',12,NULL,0,'ms_MY',1,NULL,0,0,NULL),(31,'gerda44@example.net','US*`0L4','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Jeanne','Feest','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'682-498-7097 x96752','aperiam',NULL,'19524',NULL,'jessy12','Dignissimos voluptatum molestiae a velit optio quasi aliquam.',13,NULL,0,'gv_GB',1,NULL,0,0,NULL),(32,'clementine06@example.com','OD&VXKe\\','{\"user\":\"0\"}',0,NULL,NULL,NULL,NULL,NULL,'Llewellyn','Lubowitz','2016-12-19 21:50:31','2016-12-19 21:50:31',NULL,NULL,NULL,NULL,NULL,'819.370.6281 x2886','rerum',NULL,'6129',NULL,'fwalsh','Reprehenderit quos porro vitae mollitia ut ipsa rerum.',14,NULL,0,'fil_PH',1,NULL,0,0,NULL);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
@@ -1391,4 +1424,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2017-03-19 11:47:41
+-- Dump completed on 2017-06-12 18:14:38
diff --git a/tests/api/ApiAssetsCest.php b/tests/api/ApiAssetsCest.php
index eb076d048..6489e99f1 100644
--- a/tests/api/ApiAssetsCest.php
+++ b/tests/api/ApiAssetsCest.php
@@ -21,7 +21,7 @@ class ApiAssetsCest
$I->wantTo('Get a list of assets');
// setup
- $assets = factory(\App\Models\Asset::class, 'asset', 10)->create();
+ $assets = factory(\App\Models\Asset::class, 10)->create();
// call
$I->sendGET('/hardware');
@@ -121,7 +121,7 @@ class ApiAssetsCest
{
$I->wantTo('Create a new asset');
- $temp_asset = factory(\App\Models\Asset::class, 'asset')->make();
+ $temp_asset = factory(\App\Models\Asset::class)->make();
// setup
$data = [
@@ -153,10 +153,10 @@ class ApiAssetsCest
$I->wantTo('Update an asset with PATCH');
// create
- $asset = factory(\App\Models\Asset::class, 'asset')->create();
+ $asset = factory(\App\Models\Asset::class)->create();
$I->assertInstanceOf(\App\Models\Asset::class, $asset);
- $temp_asset = factory(\App\Models\Asset::class, 'asset')->make();
+ $temp_asset = factory(\App\Models\Asset::class)->make();
$data = [
'asset_tag' => $temp_asset->asset_tag,
@@ -279,11 +279,11 @@ class ApiAssetsCest
$I->wantTo('Update a asset with PUT');
// create
- $asset = factory(\App\Models\Asset::class, 'asset')->create();
+ $asset = factory(\App\Models\Asset::class)->create();
$I->assertInstanceOf(\App\Models\Asset::class, $asset);
$temp_asset_tag = $this->faker->uuid;
- $temp_asset = factory(\App\Models\Asset::class, 'asset')->make([
+ $temp_asset = factory(\App\Models\Asset::class)->make([
'asset_tag' => $temp_asset_tag,
]);
@@ -411,7 +411,7 @@ class ApiAssetsCest
$I->wantTo('Delete an asset');
// create
- $asset = factory(\App\Models\Asset::class, 'asset')->create();
+ $asset = factory(\App\Models\Asset::class)->create();
$I->assertInstanceOf(\App\Models\Asset::class, $asset);
// delete
diff --git a/tests/api/ApiComponentsAssetsCest.php b/tests/api/ApiComponentsAssetsCest.php
index 3beea1675..c3118c4e6 100644
--- a/tests/api/ApiComponentsAssetsCest.php
+++ b/tests/api/ApiComponentsAssetsCest.php
@@ -19,11 +19,11 @@ class ApiComponentsAssetsCest
$I->wantTo('Get a list of assets related to a component');
// generate component
- $component = factory(\App\Models\Component::class, 'component')
+ $component = factory(\App\Models\Component::class)
->create(['user_id' => $this->user->id, 'qty' => 20]);
// generate assets and associate component
- $assets = factory(\App\Models\Asset::class, 'asset', 2)
+ $assets = factory(\App\Models\Asset::class, 2)
->create(['user_id' => $this->user->id])
->each(function ($asset) use ($component) {
$component->assets()->attach($component->id, [
@@ -65,7 +65,7 @@ class ApiComponentsAssetsCest
{
$I->wantTo('See an empty response when there are no associated assets to a component');
- $component = factory(\App\Models\Component::class, 'component')
+ $component = factory(\App\Models\Component::class)
->create(['user_id' => $this->user->id, 'qty' => 20]);
$I->sendGET('/components/' . $component->id . '/assets');
diff --git a/tests/api/ApiComponentsCest.php b/tests/api/ApiComponentsCest.php
index a8e677bf3..d8714ef02 100644
--- a/tests/api/ApiComponentsCest.php
+++ b/tests/api/ApiComponentsCest.php
@@ -21,7 +21,7 @@ class ApiComponentsCest
$I->wantTo('Get a list of components');
// setup
- $components = factory(\App\Models\Component::class, 'component', 10)->create();
+ $components = factory(\App\Models\Component::class, 10)->create();
// call
$I->sendGET('/components');
@@ -46,9 +46,9 @@ class ApiComponentsCest
$I->wantTo('Create a new component');
// setup
- $category = factory(\App\Models\Category::class, 'category')->create(['user_id' => $this->user->id]);
- $location = factory(\App\Models\Location::class, 'location')->create(['user_id' => $this->user->id]);
- $company = factory(\App\Models\Company::class, 'company')->create();
+ $category = factory(\App\Models\Category::class)->create(['user_id' => $this->user->id]);
+ $location = factory(\App\Models\Location::class)->create(['user_id' => $this->user->id]);
+ $company = factory(\App\Models\Company::class)->create();
$data = [
'category_id' => $category->id,
@@ -107,7 +107,7 @@ class ApiComponentsCest
$I->wantTo('Update a component with PATCH');
// create
- $component = factory(\App\Models\Component::class, 'component')->create();
+ $component = factory(\App\Models\Component::class)->create();
$I->assertInstanceOf(\App\Models\Component::class, $component);
$data = [
@@ -142,7 +142,7 @@ class ApiComponentsCest
$I->wantTo('Update a component with PUT');
// create
- $component = factory(\App\Models\Component::class, 'component')->create();
+ $component = factory(\App\Models\Component::class)->create();
$I->assertInstanceOf(\App\Models\Component::class, $component);
$data = [
@@ -176,7 +176,7 @@ class ApiComponentsCest
$I->wantTo('Delete a component');
// create
- $component = factory(\App\Models\Component::class, 'component')->create();
+ $component = factory(\App\Models\Component::class)->create();
$I->assertInstanceOf(\App\Models\Component::class, $component);
// delete
diff --git a/tests/functional/AccessoriesCest.php b/tests/functional/AccessoriesCest.php
index 961874eca..96e3ab330 100644
--- a/tests/functional/AccessoriesCest.php
+++ b/tests/functional/AccessoriesCest.php
@@ -53,7 +53,7 @@ class AccessoriesCest
public function passesCorrectValidation(FunctionalTester $I)
{
- $accessory = factory(App\Models\Accessory::class,'accessory')->make();
+ $accessory = factory(App\Models\Accessory::class)->make();
$values = [
'company_id' => $accessory->company_id,
'name' => $accessory->name,
diff --git a/tests/functional/AssetModelsCest.php b/tests/functional/AssetModelsCest.php
index 2929ef277..a853b853a 100644
--- a/tests/functional/AssetModelsCest.php
+++ b/tests/functional/AssetModelsCest.php
@@ -33,7 +33,7 @@ class AssetModelsCest
public function passesCorrectValidation(FunctionalTester $I)
{
- $model = factory(App\Models\AssetModel::class, 'assetmodel')->make();
+ $model = factory(App\Models\AssetModel::class)->make();
$values = [
'name' => $model->name,
'manufacturer_id' => $model->manufacturer_id,
@@ -56,7 +56,7 @@ class AssetModelsCest
public function allowsDelete(FunctionalTester $I)
{
$I->wantTo('Ensure I can delete an asset model');
- $model = factory(App\Models\AssetModel::class, 'assetmodel')->create();
+ $model = factory(App\Models\AssetModel::class)->create();
$I->sendDelete(route('models.destroy', $model->id), ['_token' => csrf_token()]);
$I->seeResponseCodeIs(200);
}
diff --git a/tests/functional/AssetsCest.php b/tests/functional/AssetsCest.php
index b1a99fd13..2f517ca4a 100644
--- a/tests/functional/AssetsCest.php
+++ b/tests/functional/AssetsCest.php
@@ -33,7 +33,7 @@ class AssetsCest
public function passesCreateAndCheckout(FunctionalTester $I)
{
- $asset = factory(App\Models\Asset::class,'asset')->make();
+ $asset = factory(App\Models\Asset::class)->make();
$userId = $I->getUserId();
$values = [
'company_id' => $asset->company_id,
diff --git a/tests/functional/CategoriesCest.php b/tests/functional/CategoriesCest.php
index bea932aa0..7bf20a642 100644
--- a/tests/functional/CategoriesCest.php
+++ b/tests/functional/CategoriesCest.php
@@ -37,7 +37,7 @@ class CategoriesCest
public function passesCorrectValidation(FunctionalTester $I)
{
- $category = factory(App\Models\Category::class, 'category')->make();
+ $category = factory(App\Models\Category::class)->make();
$values = [
'name' => $category->name,
'category_type' => $category->category_type,
@@ -55,7 +55,7 @@ class CategoriesCest
public function allowsDelete(FunctionalTester $I)
{
$I->wantTo('Ensure I can delete a category');
- $category = factory(App\Models\Category::class, 'category')->create();
+ $category = factory(App\Models\Category::class)->create();
$I->sendDelete(route('categories.destroy', $category->id), ['_token' => csrf_token()]);
$I->seeResponseCodeIs(200);
}
diff --git a/tests/functional/CompaniesCest.php b/tests/functional/CompaniesCest.php
index acd5b6290..db2805cc3 100644
--- a/tests/functional/CompaniesCest.php
+++ b/tests/functional/CompaniesCest.php
@@ -32,7 +32,7 @@ class CompaniesCest
public function passesCorrectValidation(FunctionalTester $I)
{
- $company = factory(App\Models\Company::class, 'company')->make();
+ $company = factory(App\Models\Company::class)->make();
$values = [
'name' => $company->name
];
diff --git a/tests/functional/ComponentsCest.php b/tests/functional/ComponentsCest.php
index 63e37a330..2f37aff4c 100644
--- a/tests/functional/ComponentsCest.php
+++ b/tests/functional/ComponentsCest.php
@@ -47,7 +47,7 @@ class ComponentsCest
public function passesCorrectValidation(FunctionalTester $I)
{
- $component = factory(App\Models\Component::class, 'component')->make();
+ $component = factory(App\Models\Component::class)->make();
$values = [
'name' => $component->name,
diff --git a/tests/functional/ConsumablesCest.php b/tests/functional/ConsumablesCest.php
index 85f94fd73..ee33b1bf3 100644
--- a/tests/functional/ConsumablesCest.php
+++ b/tests/functional/ConsumablesCest.php
@@ -48,7 +48,7 @@ class ConsumablesCest
public function passesCorrectValidation(FunctionalTester $I)
{
- $consumable = factory(App\Models\Consumable::class, 'consumable')->make();
+ $consumable = factory(App\Models\Consumable::class)->make();
$values = [
'company_id' => $consumable->company_id,
'name' => $consumable->name,
diff --git a/tests/functional/DepreciationsCest.php b/tests/functional/DepreciationsCest.php
index db0114518..4d48a917a 100644
--- a/tests/functional/DepreciationsCest.php
+++ b/tests/functional/DepreciationsCest.php
@@ -44,7 +44,7 @@ class DepreciationCest
public function passesCorrectValidation(FunctionalTester $I)
{
- $depreciation = factory(App\Models\Depreciation::class, 'depreciation')->make();
+ $depreciation = factory(App\Models\Depreciation::class)->make();
$values = [
'name' => $depreciation->name,
'months' => $depreciation->months
diff --git a/tests/functional/LicensesCest.php b/tests/functional/LicensesCest.php
index d5c735e9a..4aa0fe973 100644
--- a/tests/functional/LicensesCest.php
+++ b/tests/functional/LicensesCest.php
@@ -47,7 +47,7 @@ class LicensesCest
public function passesCorrectValidation(FunctionalTester $I)
{
- $license = factory(App\Models\License::class, 'license')->make();
+ $license = factory(App\Models\License::class)->make();
$values = [
'name' => $license->name,
'serial' => $license->serial,
diff --git a/tests/functional/LocationsCest.php b/tests/functional/LocationsCest.php
index 75be76bc6..3c760a140 100644
--- a/tests/functional/LocationsCest.php
+++ b/tests/functional/LocationsCest.php
@@ -45,7 +45,7 @@ class LocationsCest
}
public function passesCorrectValidation(FunctionalTester $I)
{
- $location = factory(App\Models\Location::class, 'location')->make();
+ $location = factory(App\Models\Location::class)->make();
$values = [
'name' => $location->name,
'parent_id' => $I->getLocationId(),
@@ -67,7 +67,7 @@ class LocationsCest
public function allowsDelete(FunctionalTester $I)
{
$I->wantTo('Ensure I can delete a location');
- $location = factory(App\Models\Location::class, 'location')->create();
+ $location = factory(App\Models\Location::class)->create();
$I->sendDelete(route('locations.destroy', $location->id), ['_token' => csrf_token()]);
$I->seeResponseCodeIs(200);
}
diff --git a/tests/functional/ManufacturersCest.php b/tests/functional/ManufacturersCest.php
index 1babcf6e3..b2dd74e4c 100644
--- a/tests/functional/ManufacturersCest.php
+++ b/tests/functional/ManufacturersCest.php
@@ -43,7 +43,7 @@ class ManufacturersCest
}
public function passesCorrectValidation(FunctionalTester $I)
{
- $manufacturer = factory(App\Models\Manufacturer::class, 'manufacturer')->make();
+ $manufacturer = factory(App\Models\Manufacturer::class)->make();
$values = [
'name' => $manufacturer->name
];
@@ -57,7 +57,7 @@ class ManufacturersCest
public function allowsDelete(FunctionalTester $I)
{
$I->wantTo('Ensure I can delete a manufacturer');
- $manufacturerId = factory(App\Models\Manufacturer::class, 'manufacturer')->create()->id;
+ $manufacturerId = factory(App\Models\Manufacturer::class)->create()->id;
$I->sendDelete(route('manufacturers.destroy', $manufacturerId), ['_token' => csrf_token()]);
$I->seeResponseCodeIs(200);
}
diff --git a/tests/functional/StatusLabelsCest.php b/tests/functional/StatusLabelsCest.php
index 391f58f0e..a57f625ae 100644
--- a/tests/functional/StatusLabelsCest.php
+++ b/tests/functional/StatusLabelsCest.php
@@ -34,7 +34,7 @@ class StatusLabelsCest
public function passesCorrectValidation(FunctionalTester $I)
{
- $status = factory(App\Models\Statuslabel::class, 'pending')->make();
+ $status = factory(App\Models\Statuslabel::class)->states('pending')->make();
$submitValues = [
'name' => 'Testing Status',
'statuslabel_types' => 'pending',
diff --git a/tests/functional/SuppliersCest.php b/tests/functional/SuppliersCest.php
index 0ce3d8d8f..9ad9fc139 100644
--- a/tests/functional/SuppliersCest.php
+++ b/tests/functional/SuppliersCest.php
@@ -40,7 +40,7 @@ class SuppliersCest
}
public function passesCorrectValidation(FunctionalTester $I)
{
- $supplier = factory(App\Models\Supplier::class, 'supplier')->make();
+ $supplier = factory(App\Models\Supplier::class)->make();
$values = [
'name' => $supplier->name,
'address' => $supplier->address,
@@ -66,7 +66,7 @@ class SuppliersCest
public function allowsDelete(FunctionalTester $I)
{
$I->wantTo('Ensure I can delete a supplier');
- $supplier = factory(App\Models\Supplier::class, 'supplier')->create();
+ $supplier = factory(App\Models\Supplier::class)->create();
$I->sendDelete(route('suppliers.destroy', $supplier->id), ['_token' => csrf_token()]);
$I->seeResponseCodeIs(200);
}
diff --git a/tests/functional/UsersCest.php b/tests/functional/UsersCest.php
index 5e1073436..12164d9ed 100644
--- a/tests/functional/UsersCest.php
+++ b/tests/functional/UsersCest.php
@@ -49,7 +49,7 @@ class UsersCest
}
public function passesCorrectValidation(FunctionalTester $I)
{
- $user = factory(App\Models\User::class, 'valid-user')->make();
+ $user = factory(App\Models\User::class)->make();
$submitValues = [
'first_name' => $user->first_name,
'last_name' => $user->last_name,
@@ -61,8 +61,8 @@ class UsersCest
'locale' => $user->locale,
'employee_num' => $user->employee_num,
'jobtitle' => $user->jobtitle,
- 'manager_id' => 19,
- 'location_id' => 67,
+ 'manager_id' => $user->manager_id,
+ 'location_id' => $user->location_id,
'phone' => $user->phone,
'activated' => true,
'notes' => $user->notes
@@ -76,8 +76,8 @@ class UsersCest
'locale' => $user->locale,
'employee_num' => $user->employee_num,
'jobtitle' => $user->jobtitle,
- 'manager_id' => 19,
- 'location_id' => 67,
+ 'manager_id' => $user->manager_id,
+ 'location_id' => $user->location_id,
'phone' => $user->phone,
'activated' => true,
'notes' => $user->notes
@@ -91,7 +91,7 @@ class UsersCest
public function allowsDelete(FunctionalTester $I)
{
- $user = factory(App\Models\User::class, 'valid-user')->create();
+ $user = factory(App\Models\User::class)->create();
$I->wantTo('Ensure I can delete a user');
$I->sendDelete(route('users.destroy', $user->id), ['_token' => csrf_token()]);
$I->seeResponseCodeIs(200);
diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml
index 38d0e4f3f..0ddbee4ed 100644
--- a/tests/unit.suite.yml
+++ b/tests/unit.suite.yml
@@ -7,4 +7,4 @@ modules:
- \Helper\Unit
- Asserts
- Laravel5:
- environment_file: .env.tests
+ environment_file: .env.tests
\ No newline at end of file
diff --git a/tests/unit/AccessoryTest.php b/tests/unit/AccessoryTest.php
index e07da3817..ad9f68a33 100644
--- a/tests/unit/AccessoryTest.php
+++ b/tests/unit/AccessoryTest.php
@@ -1,5 +1,6 @@
make();
- $values = [
- 'name' => $accessory->name,
- 'category_id' => $accessory->category_id,
- 'qty' => $accessory->qty,
- ];
+ protected function _before()
+ {
+ Artisan::call('migrate');
+ }
- Accessory::create($values);
- $this->tester->seeRecord('accessories', $values);
- }
+ public function testAccessoryAdd()
+ {
+ $accessory = factory(Accessory::class)->make();
+
+ $values = [
+ 'name' => $accessory->name,
+ 'category_id' => $accessory->category_id,
+ 'qty' => $accessory->qty,
+ ];
+ Accessory::create($values);
+
+ $this->tester->seeRecord('accessories', $values);
+ }
+
+ public function testFailsEmptyValidation()
+ {
+ // An Accessory requires a name, a qty, and a category_id.
+ $a = Accessory::create();
+ $this->assertFalse($a->isValid());
+ $fields = [
+ 'name' => 'name',
+ 'qty' => 'qty',
+ 'category_id' => 'category id'
+ ];
+ $errors = $a->getErrors();
+ foreach ($fields as $field => $fieldTitle) {
+ $this->assertEquals($errors->get($field)[0], "The ${fieldTitle} field is required.");
+ }
+ }
+
+ public function testFailsMinValidation()
+ {
+ // An Accessory name has a min length of 3
+ // An Accessory has a min qty of 1
+ // An Accessory has a min amount of 0
+ $a = factory(Accessory::class)->make([
+ 'name' => 'a',
+ 'qty' => 0,
+ 'min_amt' => -1
+ ]);
+ $fields = [
+ 'name' => 'name',
+ 'qty' => 'qty',
+ 'min_amt' => 'min amt'
+ ];
+ $this->assertFalse($a->isValid());
+ $errors = $a->getErrors();
+ foreach ($fields as $field => $fieldTitle) {
+ $this->assertContains("The ${fieldTitle} must be at least", $errors->get($field)[0]);
+ }
+ }
+
+ public function testCategoryIdMustExist()
+ {
+ $category = factory(Category::class)->create(['category_type' => 'accessory']);
+ $accessory = factory(Accessory::class)->make(['category_id' => $category->id]);
+ $accessory->save();
+ $this->assertTrue($accessory->isValid());
+ $newId = $category->id + 1;
+ $accessory = factory(Accessory::class)->make(['category_id' => $newId]);
+ $accessory->save();
+
+ $this->assertFalse($accessory->isValid());
+ }
+
+ public function testAnAccessoryBelongsToACompany()
+ {
+ $accessory = factory(Accessory::class)->create();
+ $this->assertInstanceOf(App\Models\Company::class, $accessory->company);
+ }
+
+ public function testAnAccessoryHasALocation()
+ {
+ $accessory = factory(Accessory::class)->create();
+ $this->assertInstanceOf(App\Models\Location::class, $accessory->location);
+ }
+
+ public function testAnAccessoryBelongsToACategory()
+ {
+ $accessory = factory(Accessory::class)->create();
+ $this->assertInstanceOf(App\Models\Category::class, $accessory->category);
+ $this->assertEquals('accessory', $accessory->category->category_type);
+ }
+
+ public function testAnAccessoryHasAManufacturer()
+ {
+ $accessory = factory(Accessory::class)->create();
+ $this->assertInstanceOf(App\Models\Manufacturer::class, $accessory->manufacturer);
+ }
}
diff --git a/tests/unit/AssetModelTest.php b/tests/unit/AssetModelTest.php
index 483c9b9db..825017923 100644
--- a/tests/unit/AssetModelTest.php
+++ b/tests/unit/AssetModelTest.php
@@ -1,9 +1,10 @@
make();
- $values = [
+ $assetmodel = factory(AssetModel::class)->make();
+ $values = [
'name' => $assetmodel->name,
'manufacturer_id' => $assetmodel->manufacturer_id,
'category_id' => $assetmodel->category_id,
'eol' => $assetmodel->eol,
- ];
+ ];
- AssetModel::create($values);
- $this->tester->seeRecord('models', $values);
+ AssetModel::create($values);
+ $this->tester->seeRecord('models', $values);
}
- /**
- * @test
- */
- public function it_zeros_blank_eol_but_not_others()
+ public function testAnAssetModelRequiresAttributes()
+ {
+ // An Asset Model requires a name, a category_id, and a manufacturer_id.
+ $a = AssetModel::create();
+ $this->assertFalse($a->isValid());
+ $fields = [
+ 'name' => 'name',
+ 'manufacturer_id' => 'manufacturer id',
+ 'category_id' => 'category id'
+ ];
+ $errors = $a->getErrors();
+ foreach ($fields as $field => $fieldTitle) {
+ $this->assertEquals($errors->get($field)[0], "The ${fieldTitle} field is required.");
+ }
+ }
+
+ public function testAnAssetModelZerosOutBlankEols()
{
$am = new AssetModel;
$am->eol = '';
@@ -38,4 +56,31 @@ class AssetModelTest extends \Codeception\TestCase\Test
$am->eol = '4';
$this->assertTrue($am->eol==4);
}
+
+ public function testAnAssetModelContainsAssets()
+ {
+ $assetmodel = factory(AssetModel::class)->create();
+ $asset = factory(Asset::class)->create([
+ 'model_id' => $assetmodel->id,
+ ]);
+ $this->assertEquals(1,$assetmodel->assets()->count());
+ }
+
+ public function testAnAssetModelHasACategory()
+ {
+ $assetmodel = factory(AssetModel::class)->create();
+ $this->assertInstanceOf(App\Models\Category::class, $assetmodel->category);
+ }
+
+ public function anAssetModelHasADepreciation()
+ {
+ $assetmodel = factory(AssetModel::class)->create();
+ $this->assertInstanceOf(App\Models\Depreciation::class, $assetmodel->depreciation);
+ }
+
+ public function testAnAssetModelHasAManufacturer()
+ {
+ $assetmodel = factory(AssetModel::class)->create();
+ $this->assertInstanceOf(App\Models\Manufacturer::class, $assetmodel->manufacturer);
+ }
}
diff --git a/tests/unit/AssetTest.php b/tests/unit/AssetTest.php
index 48accbe08..57e965977 100644
--- a/tests/unit/AssetTest.php
+++ b/tests/unit/AssetTest.php
@@ -1,9 +1,10 @@
make();
+ $asset = factory(Asset::class)->make();
$values = [
- 'name' => $asset->name,
- 'model_id' => $asset->model_id,
- 'status_id' => $asset->status_id,
- 'asset_tag' => $asset->asset_tag,
- ];
+ 'name' => $asset->name,
+ 'model_id' => $asset->model_id,
+ 'status_id' => $asset->status_id,
+ 'asset_tag' => $asset->asset_tag,
+ ];
Asset::create($values);
$this->tester->seeRecord('assets', $values);
}
+ public function testFailsEmptyValidation()
+ {
+ // An Asset requires a name, a qty, and a category_id.
+ $a = Asset::create();
+ $this->assertFalse($a->isValid());
+
+ $fields = [
+ 'model_id' => 'model id',
+ 'status_id' => 'status id',
+ 'asset_tag' => 'asset tag'
+ ];
+ $errors = $a->getErrors();
+ foreach ($fields as $field => $fieldTitle) {
+ $this->assertEquals($errors->get($field)[0], "The ${fieldTitle} field is required.");
+ }
+ }
+
/**
* @test
*/
public function testWarrantyExpiresAttribute()
{
- $asset = factory(\App\Models\Asset::class, 'asset')->create();
+ $asset = factory(\App\Models\Asset::class)->create();
- $asset->purchase_date = \Carbon\Carbon::createFromDate(2017, 1, 1);
+ $asset->purchase_date = \Carbon\Carbon::createFromDate(2017, 1, 1)->hour(0)->minute(0)->second(0);
$asset->warranty_months = 24;
$asset->save();
@@ -43,22 +66,192 @@ class AssetTest extends \Codeception\TestCase\Test
$this->tester->assertInstanceOf(\DateTime::class, $saved_asset->purchase_date);
$this->tester->assertEquals(
- \Carbon\Carbon::createFromDate(2017,1,1)->format('Y-m-d'),
+ \Carbon\Carbon::createFromDate(2017, 1, 1)->format('Y-m-d'),
$saved_asset->purchase_date->format('Y-m-d')
- );
+ );
$this->tester->assertEquals(
- \Carbon\Carbon::createFromDate(2017,1,1)->setTime(0,0,0),
+ \Carbon\Carbon::createFromDate(2017, 1, 1)->setTime(0, 0, 0),
$saved_asset->purchase_date
- );
+ );
$this->tester->assertEquals(24, $saved_asset->warranty_months);
$this->tester->assertInstanceOf(\DateTime::class, $saved_asset->warranty_expires);
$this->tester->assertEquals(
- \Carbon\Carbon::createFromDate(2019,1,1)->format('Y-m-d'),
+ \Carbon\Carbon::createFromDate(2019, 1, 1)->format('Y-m-d'),
$saved_asset->warranty_expires->format('Y-m-d')
);
$this->tester->assertEquals(
- \Carbon\Carbon::createFromDate(2019,1,1)->setTime(0,0,0),
+ \Carbon\Carbon::createFromDate(2019, 1, 1)->setTime(0, 0, 0),
$saved_asset->warranty_expires
);
}
+
+ public function testModelIdMustExist()
+ {
+ $model = factory(AssetModel::class)->create();
+ $asset = factory(Asset::class)->make(['model_id' => $model->id]);
+ $asset->save();
+ $this->assertTrue($asset->isValid());
+ $newId = $model->id + 1;
+ $asset = factory(Asset::class)->make(['model_id' => $newId]);
+ $asset->save();
+
+ $this->assertFalse($asset->isValid());
+ }
+
+ public function testAnAssetHasRelationships()
+ {
+ $asset = factory(Asset::class)->create();
+ $this->assertInstanceOf(AssetModel::class, $asset->model);
+ $this->assertInstanceOf(Company::class, $asset->company);
+ $this->assertInstanceOf(App\Models\Depreciation::class, $asset->depreciation);
+ $this->assertInstanceOf(App\Models\Statuslabel::class, $asset->assetstatus);
+ $this->assertInstanceOf(App\Models\Supplier::class, $asset->supplier);
+ }
+
+ public function testAnAssetCanBeAvailableForCheckout()
+ {
+ // Logic: If the asset is not assigned to anyone,
+ // and the statuslabel type is "deployable"
+ // and the asset is not deleted
+ // Then it is available for checkout
+
+ // An asset assigned to someone should not be available for checkout.
+ $user = factory(App\Models\User::class)->create();
+ $assetAssigned = factory(Asset::class)->create(['assigned_to' => $user->id]);
+ $this->assertFalse($assetAssigned->availableForCheckout());
+
+ // An asset with a non deployable statuslabel should not be available for checkout.
+ $status = factory(App\Models\Statuslabel::class)->states('archived')->create();
+ $assetUndeployable = factory(Asset::class)->create(['status_id' => $status->id]);
+ $this->assertFalse($assetUndeployable->availableForCheckout());
+
+ // An asset that has been deleted is not avaiable for checkout.
+ $assetDeleted = factory(Asset::class)->states('deleted')->create();
+ $this->assertFalse($assetDeleted->availableForCheckout());
+
+ // A ready to deploy asset that isn't assigned to anyone is available for checkout
+ $status = factory(App\Models\Statuslabel::class)->states('rtd')->create();
+ $asset = factory(Asset::class)->create(['status_id' => $status->id]);
+ $this->assertTrue($asset->availableForCheckout());
+ }
+
+ public function testAnAssetCanHaveComponents()
+ {
+ $asset = factory(Asset::class)->create();
+ $components = factory(App\Models\Component::class, 5)->create();
+ $components->each(function($component) use ($asset) {
+ $component->assets()->attach($component, [
+ 'asset_id'=>$asset->id
+ ]);
+ });
+ $this->assertInstanceOf(App\Models\Component::class, $asset->components()->first());
+ $this->assertCount(5, $asset->components);
+ }
+
+ public function testAnAssetCanHaveUploads()
+ {
+ $asset = factory(Asset::class)->create();
+ $this->assertCount(0, $asset->uploads);
+ factory(App\Models\Actionlog::class, 'asset-upload')->create(['item_id' => $asset->id]);
+ $this->assertCount(1, $asset->fresh()->uploads);
+ }
+
+ // Helper Method for checking in assets.... We should extract this to the model or a trait.
+
+ private function checkin($asset, $target) {
+ $asset->expected_checkin = null;
+ $asset->last_checkout = null;
+ $asset->assigned_to = null;
+ $asset->assignedTo()->disassociate($asset);
+ $asset->accepted = null;
+ $asset->save();
+ $asset->logCheckin($target, 'Test Checkin');
+ }
+
+ public function testAnAssetCanBeCheckedOut()
+ {
+ // This tests Asset::checkOut(), Asset::assignedTo(), Asset::assignedAssets(), Asset::assetLoc(), Asset::assignedType(), defaultLoc()
+ // Need to mock settings here to avoid issues with checkout notifications.
+ factory(App\Models\Setting::class)->create();
+ $asset = factory(Asset::class)->create();
+ $adminUser = factory(App\Models\User::class)->states('superuser')->create();
+ Auth::login($adminUser);
+
+ $target = factory(App\Models\User::class)->create();
+ // An Asset Can be checked out to a user, and this should be logged.
+ $asset->checkOut($target, $adminUser);
+ $asset->save();
+
+ $this->assertInstanceOf(App\Models\User::class, $asset->assignedTo);
+ $this->assertEquals($asset->assetLoc->id, $target->userLoc->id);
+ $this->assertEquals('user', $asset->assignedType());
+ $this->assertEquals($asset->defaultLoc->id, $asset->rtd_location_id);
+ $this->tester->seeRecord('action_logs', [
+ 'action_type' => 'checkout',
+ 'target_type' => get_class($target),
+ 'target_id' => $target->id
+ ]);
+ $this->checkin($asset, $target);
+ $this->assertNull($asset->fresh()->assignedTo);
+
+ $this->tester->seeRecord('action_logs', [
+ 'action_type' => 'checkin from',
+ 'target_type' => get_class($target),
+ 'target_id' => $target->id
+ ]);
+
+
+ // An Asset Can be checked out to a asset, and this should be logged.
+ $target = factory(App\Models\Asset::class)->create();
+ $asset->checkOut($target, $adminUser);
+ $asset->save();
+ $this->assertInstanceOf(App\Models\Asset::class, $asset->fresh()->assignedTo);
+ $this->assertEquals($asset->fresh()->assetLoc->id, $target->fresh()->assetLoc->id);
+ $this->assertEquals('asset', $asset->assignedType());
+ $this->assertEquals($asset->defaultLoc->id, $asset->rtd_location_id);
+ $this->tester->seeRecord('action_logs', [
+ 'action_type' => 'checkout',
+ 'target_type' => get_class($target),
+ 'target_id' => $target->id
+ ]);
+
+ $this->assertCount(1, $target->assignedAssets);
+ $this->checkin($asset, $target);
+ $this->assertNull($asset->fresh()->assignedTo);
+
+ $this->tester->seeRecord('action_logs', [
+ 'action_type' => 'checkin from',
+ 'target_type' => get_class($target),
+ 'target_id' => $target->id
+ ]);
+
+ // An Asset Can be checked out to a location, and this should be logged.
+ $target = factory(App\Models\Location::class)->create();
+ $asset->checkOut($target, $adminUser);
+ $asset->save();
+ $this->assertInstanceOf(App\Models\Location::class, $asset->fresh()->assignedTo);
+ $this->assertEquals($asset->fresh()->assetLoc->id, $target->fresh()->id);
+ $this->assertEquals('location', $asset->assignedType());
+ $this->assertEquals($asset->defaultLoc->id, $asset->rtd_location_id);
+ $this->tester->seeRecord('action_logs', [
+ 'action_type' => 'checkout',
+ 'target_type' => get_class($target),
+ 'target_id' => $target->id
+ ]);
+ $this->checkin($asset, $target);
+ $this->assertNull($asset->fresh()->assignedTo);
+
+ $this->tester->seeRecord('action_logs', [
+ 'action_type' => 'checkin from',
+ 'target_type' => get_class($target),
+ 'target_id' => $target->id
+ ]);
+ }
+
+ public function testAnAssetHasMaintenances()
+ {
+ $asset = factory(Asset::class)->create();
+ factory(App\Models\AssetMaintenance::class)->create(['asset_id' => $asset->id]);
+ $this->assertCount(1, $asset->assetmaintenances);
+ }
}
diff --git a/tests/unit/CategoryTest.php b/tests/unit/CategoryTest.php
index 9ebc9b72e..e42ecc140 100644
--- a/tests/unit/CategoryTest.php
+++ b/tests/unit/CategoryTest.php
@@ -13,9 +13,14 @@ class CategoryTest extends \Codeception\TestCase\Test
protected $tester;
use DatabaseMigrations;
+ protected function _before()
+ {
+ Artisan::call('migrate');
+ }
+
public function testAssetCategoryAdd()
{
- $category = factory(Category::class, 'category')->make(['category_type' => 'asset']);
+ $category = factory(Category::class)->make(['category_type' => 'asset']);
$values = [
'name' => $category->name,
'category_type' => $category->category_type,
@@ -29,7 +34,7 @@ class CategoryTest extends \Codeception\TestCase\Test
public function testAccessoryCategoryAdd()
{
- $category = factory(Category::class, 'category')->make(['category_type' => 'accessory']);
+ $category = factory(Category::class)->make(['category_type' => 'accessory']);
$values = [
'name' => $category->name,
'category_type' => $category->category_type,
@@ -40,4 +45,57 @@ class CategoryTest extends \Codeception\TestCase\Test
Category::create($values);
$this->tester->seeRecord('categories', $values);
}
+
+ public function testFailsEmptyValidation()
+ {
+ // An Asset requires a name, a qty, and a category_id.
+ $a = Category::create();
+ $this->assertFalse($a->isValid());
+
+ $fields = [
+ 'name' => 'name',
+ 'category_type' => 'category type'
+ ];
+ $errors = $a->getErrors();
+ foreach ($fields as $field => $fieldTitle) {
+ $this->assertEquals($errors->get($field)[0], "The ${fieldTitle} field is required.");
+ }
+ }
+
+ public function testACategoryCanHaveAssets()
+ {
+ $category = factory(Category::class)->create(['category_type' => 'asset']);
+ $models = factory(App\Models\AssetModel::class, 5)->create(['category_id' => $category->id]);
+ $this->assertEquals(5, $category->has_models());
+ $this->assertCount(5, $category->models);
+
+ $models->each(function($model) {
+ factory(App\Models\Asset::class, 2)->create(['model_id' => $model->id]);
+ });
+ $this->assertEquals(10, $category->itemCount());
+ }
+
+ public function testACategoryCanHaveAccessories()
+ {
+ $category = factory(Category::class)->create(['category_type' => 'accessory']);
+ factory(App\Models\Accessory::class, 5)->create(['category_id' => $category->id]);
+ $this->assertCount(5, $category->accessories);
+ $this->assertEquals(5, $category->itemCount());
+ }
+
+ public function testACategoryCanHaveConsumables()
+ {
+ $category = factory(Category::class)->create(['category_type' => 'consumable']);
+ factory(App\Models\Consumable::class, 5)->create(['category_id' => $category->id]);
+ $this->assertCount(5, $category->consumables);
+ $this->assertEquals(5, $category->itemCount());
+ }
+
+ public function testACategoryCanHaveComponents()
+ {
+ $category = factory(Category::class)->create(['category_type' => 'component']);
+ factory(App\Models\Component::class, 5)->create(['category_id' => $category->id]);
+ $this->assertCount(5, $category->components);
+ $this->assertEquals(5, $category->itemCount());
+ }
}
diff --git a/tests/unit/CompanyTest.php b/tests/unit/CompanyTest.php
index fb0192806..8127cc10b 100644
--- a/tests/unit/CompanyTest.php
+++ b/tests/unit/CompanyTest.php
@@ -11,17 +11,81 @@ class CompanyTest extends \Codeception\TestCase\Test
* @var \UnitTester
*/
protected $tester;
+ private $company;
use DatabaseMigrations;
+ protected function _before()
+ {
+ Artisan::call('migrate');
+
+ $this->company = factory(Company::class)->create();
+ }
+
public function testAssetAdd()
{
- $company = factory(Company::class, 'company')->make();
- $values = [
+ $company = factory(Company::class)->make();
+ $values = [
'name' => $company->name,
- ];
+ ];
- Company::create($values);
- $this->tester->seeRecord('companies', $values);
+ Company::create($values);
+ $this->tester->seeRecord('companies', $values);
}
+ public function testFailsEmptyValidation()
+ {
+ // An Company requires a name, a qty, and a category_id.
+ $a = Company::create();
+ $this->assertFalse($a->isValid());
+
+ $fields = [
+ 'name' => 'name',
+ ];
+ $errors = $a->getErrors();
+ foreach ($fields as $field => $fieldTitle) {
+ $this->assertEquals($errors->get($field)[0], "The ${fieldTitle} field is required.");
+ }
+ }
+
+ public function testACompanyCanHaveUsers()
+ {
+ $this->company = factory(Company::class)->create();
+ factory(App\Models\User::class, 1)->create(['company_id'=>$this->company->id]);
+ $this->assertCount(1, $this->company->users);
+ }
+
+ public function testACompanyCanHaveAssets()
+ {
+ $this->company = factory(Company::class)->create();
+ factory(App\Models\Asset::class, 1)->create(['company_id'=>$this->company->id]);
+ $this->assertCount(1, $this->company->assets);
+ }
+
+ public function testACompanyCanHaveLicenses()
+ {
+ $this->company = factory(Company::class)->create();
+ factory(App\Models\License::class, 1)->create(['company_id'=>$this->company->id]);
+ $this->assertCount(1, $this->company->licenses);
+ }
+
+ public function testACompanyCanHaveAccessories()
+ {
+ $this->company = factory(Company::class)->create();
+ factory(App\Models\Accessory::class, 1)->create(['company_id'=>$this->company->id]);
+ $this->assertCount(1, $this->company->accessories);
+ }
+
+ public function testACompanyCanHaveConsumables()
+ {
+ $this->company = factory(Company::class)->create();
+ factory(App\Models\Consumable::class, 1)->create(['company_id'=>$this->company->id]);
+ $this->assertCount(1, $this->company->consumables);
+ }
+
+ public function testACompanyCanHaveComponents()
+ {
+ $this->company = factory(Company::class)->create();
+ factory(App\Models\Component::class, 1)->create(['company_id'=>$this->company->id]);
+ $this->assertCount(1, $this->company->components);
+ }
}
diff --git a/tests/unit/ConsumableTest.php b/tests/unit/ConsumableTest.php
index 8e5fb31c6..f3dbf63a2 100644
--- a/tests/unit/ConsumableTest.php
+++ b/tests/unit/ConsumableTest.php
@@ -13,9 +13,14 @@ class ConsumableTest extends \Codeception\TestCase\Test
protected $tester;
use DatabaseMigrations;
+ protected function _before()
+ {
+ Artisan::call('migrate');
+ }
+
public function testConsumableAdd()
{
- $consumable = factory(Consumable::class, 'consumable')->make();
+ $consumable = factory(Consumable::class)->make();
$values = [
'name' => $consumable->name,
'qty' => $consumable->qty,
@@ -27,4 +32,31 @@ class ConsumableTest extends \Codeception\TestCase\Test
$this->tester->seeRecord('consumables', $values);
}
+ public function testFailsEmptyValidation()
+ {
+ // An Consumable requires a name, a qty, and a category_id.
+ $a = Consumable::create();
+ $this->assertFalse($a->isValid());
+
+ $fields = [
+ 'name' => 'name',
+ 'qty' => 'qty',
+ 'category_id' => 'category id'
+ ];
+ $errors = $a->getErrors();
+ foreach ($fields as $field => $fieldTitle) {
+ $this->assertEquals($errors->get($field)[0], "The ${fieldTitle} field is required.");
+ }
+ }
+
+ public function testAConsumableHasRelationships()
+ {
+ $consumable = factory(Consumable::class)->create();
+ $this->assertInstanceOf(App\Models\User::class, $consumable->admin);
+ $this->assertInstanceOf(App\Models\Company::class, $consumable->company);
+ $this->assertInstanceOf(App\Models\Manufacturer::class, $consumable->manufacturer);
+ $this->assertInstanceOf(App\Models\Location::class, $consumable->location);
+ $this->assertInstanceOf(App\Models\Category::class, $consumable->category);
+ }
+
}
diff --git a/tests/unit/CustomFieldTest.php b/tests/unit/CustomFieldTest.php
index 3d224a93d..07c9800e7 100644
--- a/tests/unit/CustomFieldTest.php
+++ b/tests/unit/CustomFieldTest.php
@@ -14,6 +14,11 @@ class CustomFieldTest extends \Codeception\TestCase\Test
protected $tester;
use DatabaseMigrations;
+ protected function _before()
+ {
+ Artisan::call('migrate');
+ }
+
public function testConstructor()
{
$customfield = new CustomField();
@@ -21,7 +26,7 @@ class CustomFieldTest extends \Codeception\TestCase\Test
public function testFormat()
{
- $customfield = factory(CustomField::class, 'customfield-ip')->make();
+ $customfield = factory(CustomField::class)->make();
$values = [
'name' => $customfield->name,
'format' => $customfield->format,
diff --git a/tests/unit/DepartmentTest.php b/tests/unit/DepartmentTest.php
index a97fdc480..8aa97d807 100644
--- a/tests/unit/DepartmentTest.php
+++ b/tests/unit/DepartmentTest.php
@@ -1,9 +1,10 @@
make();
+ $department = factory(Department::class)->make();
$values = [
'name' => $department->name,
+ 'user_id' => $department->user_id,
+ 'manager_id' => $department->manager_id,
];
Department::create($values);
diff --git a/tests/unit/DepreciationTest.php b/tests/unit/DepreciationTest.php
index 862e65e1c..2e61f721c 100644
--- a/tests/unit/DepreciationTest.php
+++ b/tests/unit/DepreciationTest.php
@@ -12,9 +12,14 @@ class DepreciationTest extends \Codeception\TestCase\Test
protected $tester;
use DatabaseMigrations;
+ protected function _before()
+ {
+ Artisan::call('migrate');
+ }
+
public function testDepreciationAdd()
{
- $depreciations = factory(Depreciation::class, 'depreciation')->make();
+ $depreciations = factory(Depreciation::class)->make();
$values = [
'name' => $depreciations->name,
'months' => $depreciations->months,
@@ -24,4 +29,33 @@ class DepreciationTest extends \Codeception\TestCase\Test
$this->tester->seeRecord('depreciations', $values);
}
+ public function testFailsEmptyValidation()
+ {
+ // An Asset requires a name, a qty, and a category_id.
+ $a = Depreciation::create();
+ $this->assertFalse($a->isValid());
+
+ $fields = [
+ 'name' => 'name',
+ 'months' => 'months',
+ ];
+ $errors = $a->getErrors();
+ foreach ($fields as $field => $fieldTitle) {
+ $this->assertEquals($errors->get($field)[0], "The ${fieldTitle} field is required.");
+ }
+ }
+
+ public function testADepreciationHasModels()
+ {
+ $depreciation = factory(Depreciation::class)->create();
+ factory(App\Models\AssetModel::class, 5)->create(['depreciation_id'=>$depreciation->id]);
+ $this->assertEquals(5,$depreciation->has_models());
+ }
+
+ public function testADepreciationHasLicenses()
+ {
+ $depreciation = factory(Depreciation::class)->create();
+ factory(App\Models\License::class, 5)->create(['depreciation_id'=>$depreciation->id]);
+ $this->assertEquals(5,$depreciation->has_licenses());
+ }
}
diff --git a/tests/unit/LocationTest.php b/tests/unit/LocationTest.php
index 56bcc6ba3..57efe8937 100644
--- a/tests/unit/LocationTest.php
+++ b/tests/unit/LocationTest.php
@@ -8,20 +8,24 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
class LocationTest extends \Codeception\TestCase\Test
{
/**
- * @var \UnitTester
- */
+ * @var \UnitTester
+ */
protected $tester;
use DatabaseMigrations;
- public function testLocationAdd()
+ protected function _before()
{
- $location = factory(Location::class, 'location')->make();
- $values = [
- 'name' => $location->name,
- ];
-
- Location::create($values);
- $this->tester->seeRecord('locations', $values);
+ Artisan::call('migrate');
}
+ public function testAssetAdd()
+ {
+ $location = factory(Location::class)->make();
+ $values = [
+ 'name' => $location->name,
+ ];
+
+ Location::create($values);
+ $this->tester->seeRecord('locations', $values);
+ }
}
diff --git a/tests/unit/ManufacturerTest.php b/tests/unit/ManufacturerTest.php
index 7644f685b..96d443d93 100644
--- a/tests/unit/ManufacturerTest.php
+++ b/tests/unit/ManufacturerTest.php
@@ -13,9 +13,14 @@ class ManufacturerTest extends \Codeception\TestCase\Test
protected $tester;
use DatabaseMigrations;
+ protected function _before()
+ {
+ Artisan::call('migrate');
+ }
+
public function testManufacturerAdd()
{
- $manufacturers = factory(Manufacturer::class, 'manufacturer')->make();
+ $manufacturers = factory(Manufacturer::class)->make();
$values = [
'name' => $manufacturers->name,
];
diff --git a/tests/unit/PermissionsTest.php b/tests/unit/PermissionsTest.php
index 5027c5a9b..09e9e0af5 100644
--- a/tests/unit/PermissionsTest.php
+++ b/tests/unit/PermissionsTest.php
@@ -10,66 +10,56 @@ use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\WithoutMiddleware;
-class PermissionsTest extends TestCase
+class PermissionsTest extends \Codeception\TestCase\Test
{
- // use DatabaseMigrations;
- use DatabaseTransactions;
- public function setUp()
+
+ public function _before()
{
- parent::setUp();
- $this->hardwareId = Asset::first()->id;
+ Artisan::call('migrate');
$this->noHardware = [
- route('hardware.index') => 403,
- route('hardware.create') => 403,
- route('hardware.edit', $this->hardwareId) => 403,
- route('hardware.show', $this->hardwareId) => 403,
+ 'assets.view' => false,
+ 'assets.create' => false,
+ 'assets.edit' => false,
+ 'assets.delete' => false,
];
- $this->licenseId = License::first()->id;
$this->noLicenses = [
- route('licenses.index') => 403,
- route('licenses.create') => 403,
- route('licenses.edit', $this->licenseId) => 403,
- route('licenses.show', $this->licenseId) => 403,
+ 'licenses.view' => false,
+ 'licenses.create' => false,
+ 'licenses.edit' => false,
+ 'licenses.delete' => false,
];
- $this->accessoryId = Accessory::first()->id;
$this->noAccessories = [
- route('accessories.index') => 403,
- route('accessories.create') => 403,
- route('accessories.edit', $this->accessoryId) => 403,
- route('accessories.show', $this->accessoryId) => 403,
+ 'accessories.view' => false,
+ 'accessories.create' => false,
+ 'accessories.edit' => false,
+ 'accessories.delete' => false,
];
- $this->consumableId = Consumable::first()->id;
$this->noConsumables = [
- route('consumables.index') => 403,
- route('consumables.create') => 403,
- route('consumables.edit', $this->consumableId) => 403,
- route('consumables.show', $this->consumableId) => 403,
+ 'consumables.view' => false,
+ 'consumables.create' => false,
+ 'consumables.edit' => false,
+ 'consumables.delete' => false,
];
- $this->componentId = Component::first()->id;
$this->noComponents = [
- route('components.index') => 403,
- route('components.create') => 403,
- route('components.edit', $this->componentId) => 403,
- route('components.show', $this->componentId) => 403,
+ 'components.view' => false,
+ 'components.create' => false,
+ 'components.edit' => false,
+ 'components.delete' => false,
];
- $this->userId = User::first()->id;
$this->noUsers = [
- route('users.index') => 403,
- route('users.create') => 403,
- route('users.edit', $this->userId) => 403,
- route('users.show', $this->userId) => 403,
+ 'users.view' => false,
+ 'users.create' => false,
+ 'users.edit' => false,
+ 'users.delete' => false,
];
}
- public function tearDown()
- {
- }
private $noHardware;
private $noLicenses;
private $noAccessories;
@@ -77,24 +67,16 @@ class PermissionsTest extends TestCase
private $noComponents;
private $noUsers;
- // An existing id for each type;
- private $hardwareId;
- private $licenseId;
- private $accessoryId;
- private $consumableId;
- private $componentId;
- private $userId;
// tests
/**
* @test
*/
public function a_user_with_no_permissions_sees_nothing()
{
- $u = factory(App\Models\User::class, 'valid-user')->create();
+ $u = factory(App\Models\User::class)->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noAccessories + $this->noConsumables + $this->noComponents + $this->noUsers;
// $permissions = $this->noHardware;
$this->hitRoutes($permissions, $u);
-
}
/**
@@ -102,14 +84,14 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_view_asset_permissions_can_view_assets()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('view-assets')->create();
+ $u = factory(App\Models\User::class)->states('view-assets')->create();
$permissions = $this->noLicenses + $this->noAccessories + $this->noConsumables + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('hardware.index') => 200,
- route('hardware.create') => 403,
- route('hardware.edit', $this->hardwareId) => 403,
- route('hardware.show', $this->hardwareId) => 200,
+ 'assets.view' => true,
+ 'assets.create' => false,
+ 'assets.edit' => false,
+ 'assets.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -119,14 +101,14 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_create_asset_permissions_can_create_assets()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('create-assets')->create();
+ $u = factory(App\Models\User::class)->states('create-assets')->create();
$permissions = $this->noLicenses + $this->noAccessories + $this->noConsumables + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('hardware.index') => 403,
- route('hardware.create') => 200,
- route('hardware.edit', $this->hardwareId) => 403,
- route('hardware.show', $this->hardwareId) => 403,
+ 'assets.view' => false,
+ 'assets.create' => true,
+ 'assets.edit' => false,
+ 'assets.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -136,15 +118,31 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_edit_assets_permissions_can_edit_assets()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('edit-assets')->create();
+ $u = factory(App\Models\User::class)->states('edit-assets')->create();
$permissions = $this->noLicenses + $this->noAccessories + $this->noConsumables + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('hardware.index') => 403,
- route('hardware.create') => 403,
- route('hardware.edit', $this->hardwareId) => 200,
- route('hardware.show', $this->hardwareId) => 403,
+ 'assets.view' => false,
+ 'assets.create' => false,
+ 'assets.edit' => true,
+ 'assets.delete' => false,
+ ]);
+ $this->hitRoutes($permissions, $u);
+ }
+
+ /**
+ * @test
+ */
+ public function a_user_with_delete_assets_permissions_can_delete_assets()
+ {
+ $u = factory(App\Models\User::class)->states('delete-assets')->create();
+ $permissions = $this->noLicenses + $this->noAccessories + $this->noConsumables + $this->noComponents + $this->noUsers;
+ $permissions = array_merge($permissions, [
+ 'assets.view' => false,
+ 'assets.create' => false,
+ 'assets.edit' => false,
+ 'assets.delete' => true,
]);
$this->hitRoutes($permissions, $u);
}
@@ -154,14 +152,14 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_view_licenses_permissions_can_view_licenses()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('view-licenses')->create();
+ $u = factory(App\Models\User::class)->states('view-licenses')->create();
$permissions = $this->noHardware + $this->noAccessories + $this->noConsumables + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('licenses.index') => 200,
- route('licenses.create') => 403,
- route('licenses.edit', $this->licenseId) => 403,
- route('licenses.show', $this->licenseId) => 200,
+ 'licenses.view' => true,
+ 'licenses.create' => false,
+ 'licenses.edit' => false,
+ 'licenses.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -171,14 +169,14 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_create_licenses_permissions_can_create_licenses()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('create-licenses')->create();
+ $u = factory(App\Models\User::class)->states('create-licenses')->create();
$permissions = $this->noHardware + $this->noAccessories + $this->noConsumables + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('licenses.index') => 403,
- route('licenses.create') => 200,
- route('licenses.edit', $this->licenseId) => 403,
- route('licenses.show', $this->licenseId) => 403,
+ 'licenses.view' => false,
+ 'licenses.create' => true,
+ 'licenses.edit' => false,
+ 'licenses.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -188,14 +186,31 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_edit_licenses_permissions_can_edit_licenses()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('edit-licenses')->create();
+ $u = factory(App\Models\User::class)->states('edit-licenses')->create();
$permissions = $this->noHardware + $this->noAccessories + $this->noConsumables + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('licenses.index') => 403,
- route('licenses.create') => 403,
- route('licenses.edit', $this->licenseId) => 200,
- route('licenses.show', $this->licenseId) => 403,
+ 'licenses.view' => false,
+ 'licenses.create' => false,
+ 'licenses.edit' => true,
+ 'licenses.delete' => false,
+ ]);
+ $this->hitRoutes($permissions, $u);
+ }
+
+ /**
+ * @test
+ */
+ public function a_user_with_delete_licenses_permissions_can_delete_licenses()
+ {
+ $u = factory(App\Models\User::class)->states('delete-licenses')->create();
+ $permissions = $this->noHardware + $this->noAccessories + $this->noConsumables + $this->noComponents + $this->noUsers;
+
+ $permissions = array_merge($permissions, [
+ 'licenses.view' => false,
+ 'licenses.create' => false,
+ 'licenses.edit' => false,
+ 'licenses.delete' => true,
]);
$this->hitRoutes($permissions, $u);
}
@@ -205,15 +220,15 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_view_accessories_permissions_can_view_accessories()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('view-accessories')->create();
+ $u = factory(App\Models\User::class)->states('view-accessories')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noConsumables + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('accessories.index') => 200,
- route('accessories.create') => 403,
- route('accessories.edit', $this->accessoryId) => 403,
- route('accessories.show', $this->accessoryId) => 200,
+ 'accessories.view' => true,
+ 'accessories.create' => false,
+ 'accessories.edit' => false,
+ 'accessories.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -223,15 +238,15 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_create_accessories_permissions_can_create_accessories()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('create-accessories')->create();
+ $u = factory(App\Models\User::class)->states('create-accessories')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noConsumables + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('accessories.index') => 403,
- route('accessories.create') => 200,
- route('accessories.edit', $this->accessoryId) => 403,
- route('accessories.show', $this->accessoryId) => 403,
+ 'accessories.view' => false,
+ 'accessories.create' => true,
+ 'accessories.edit' => false,
+ 'accessories.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -241,15 +256,33 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_edit_accessories_permissions_can_edit_accessories()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('edit-accessories')->create();
+ $u = factory(App\Models\User::class)->states('edit-accessories')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noConsumables + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('accessories.index') => 403,
- route('accessories.create') => 403,
- route('accessories.edit', $this->accessoryId) => 200,
- route('accessories.show', $this->accessoryId) => 403,
+ 'accessories.view' => false,
+ 'accessories.create' => false,
+ 'accessories.edit' => true,
+ 'accessories.delete' => false,
+ ]);
+ $this->hitRoutes($permissions, $u);
+ }
+
+ /**
+ * @test
+ */
+ public function a_user_with_delete_accessories_permissions_can_delete_accessories()
+ {
+ $u = factory(App\Models\User::class)->states('delete-accessories')->create();
+
+ $permissions = $this->noHardware + $this->noLicenses + $this->noConsumables + $this->noComponents + $this->noUsers;
+
+ $permissions = array_merge($permissions, [
+ 'accessories.view' => false,
+ 'accessories.create' => false,
+ 'accessories.edit' => false,
+ 'accessories.delete' => true,
]);
$this->hitRoutes($permissions, $u);
}
@@ -259,15 +292,15 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_view_consumables_permissions_can_view_consumables()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('view-consumables')->create();
+ $u = factory(App\Models\User::class)->states('view-consumables')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noAccessories + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('consumables.index') => 200,
- route('consumables.create') => 403,
- route('consumables.edit', $this->consumableId) => 403,
- route('consumables.show', $this->consumableId) => 200,
+ 'consumables.view' => true,
+ 'consumables.create' => false,
+ 'consumables.edit' => false,
+ 'consumables.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -277,15 +310,15 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_create_consumables_permissions_can_create_consumables()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('create-consumables')->create();
+ $u = factory(App\Models\User::class)->states('create-consumables')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noConsumables + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('consumables.index') => 403,
- route('consumables.create') => 200,
- route('consumables.edit', $this->consumableId) => 403,
- route('consumables.show', $this->consumableId) => 403,
+ 'consumables.view' => false,
+ 'consumables.create' => true,
+ 'consumables.edit' => false,
+ 'consumables.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -295,15 +328,33 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_edit_consumables_permissions_can_edit_consumables()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('edit-consumables')->create();
+ $u = factory(App\Models\User::class)->states('edit-consumables')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noAccessories + $this->noComponents + $this->noUsers;
$permissions = array_merge($permissions, [
- route('consumables.index') => 403,
- route('consumables.create') => 403,
- route('consumables.edit', $this->consumableId) => 200,
- route('consumables.show', $this->consumableId) => 403,
+ 'consumables.view' => false,
+ 'consumables.create' => false,
+ 'consumables.edit' => true,
+ 'consumables.delete' => false,
+ ]);
+ $this->hitRoutes($permissions, $u);
+ }
+
+ /**
+ * @test
+ */
+ public function a_user_with_delete_consumables_permissions_can_delete_consumables()
+ {
+ $u = factory(App\Models\User::class)->states('delete-consumables')->create();
+
+ $permissions = $this->noHardware + $this->noLicenses + $this->noAccessories + $this->noComponents + $this->noUsers;
+
+ $permissions = array_merge($permissions, [
+ 'consumables.view' => false,
+ 'consumables.create' => false,
+ 'consumables.edit' => false,
+ 'consumables.delete' => true,
]);
$this->hitRoutes($permissions, $u);
}
@@ -313,15 +364,15 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_view_users_permissions_can_view_users()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('view-users')->create();
+ $u = factory(App\Models\User::class)->states('view-users')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noAccessories +$this->noConsumables + $this->noComponents;
$permissions = array_merge($permissions, [
- route('users.index') => 200,
- route('users.create') => 403,
- route('users.edit', $this->userId) => 403,
- route('users.show', $this->userId) => 200,
+ 'users.view' => true,
+ 'users.create' => false,
+ 'users.edit' => false,
+ 'users.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -331,15 +382,15 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_create_users_permissions_can_create_users()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('create-users')->create();
+ $u = factory(App\Models\User::class)->states('create-users')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noAccessories +$this->noConsumables + $this->noComponents;
$permissions = array_merge($permissions, [
- route('users.index') => 403,
- route('users.create') => 200,
- route('users.edit', $this->userId) => 403,
- route('users.show', $this->userId) => 403,
+ 'users.view' => false,
+ 'users.create' => true,
+ 'users.edit' => false,
+ 'users.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -349,15 +400,33 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_edit_users_permissions_can_edit_users()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('edit-users')->create();
+ $u = factory(App\Models\User::class)->states('edit-users')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noAccessories +$this->noConsumables + $this->noComponents;
$permissions = array_merge($permissions, [
- route('users.index') => 403,
- route('users.create') => 403,
- route('users.edit', $this->userId) => 200,
- route('users.show', $this->userId) => 403,
+ 'users.view' => false,
+ 'users.create' => false,
+ 'users.edit' => true,
+ 'users.delete' => false,
+ ]);
+ $this->hitRoutes($permissions, $u);
+ }
+
+ /**
+ * @test
+ */
+ public function a_user_with_delete_users_permissions_can_delete_users()
+ {
+ $u = factory(App\Models\User::class)->states('delete-users')->create();
+
+ $permissions = $this->noHardware + $this->noLicenses + $this->noAccessories +$this->noConsumables + $this->noComponents;
+
+ $permissions = array_merge($permissions, [
+ 'users.view' => false,
+ 'users.create' => false,
+ 'users.edit' => false,
+ 'users.delete' => true,
]);
$this->hitRoutes($permissions, $u);
}
@@ -367,15 +436,15 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_view_components_permissions_can_view_components()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('view-components')->create();
+ $u = factory(App\Models\User::class)->states('view-components')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noAccessories +$this->noConsumables + $this->noUsers;
$permissions = array_merge($permissions, [
- route('components.index') => 200,
- route('components.create') => 403,
- route('components.edit', $this->componentId) => 403,
- route('components.show', $this->componentId) => 200,
+ 'components.view' => true,
+ 'components.create' => false,
+ 'components.edit' => false,
+ 'components.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -385,14 +454,14 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_create_components_permissions_can_create_components()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('create-components')->create();
+ $u = factory(App\Models\User::class)->states('create-components')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noAccessories +$this->noConsumables + $this->noUsers;
$permissions = array_merge($permissions, [
- route('components.index') => 403,
- route('components.create') => 200,
- route('components.edit', $this->componentId) => 403,
- route('components.show', $this->componentId) => 403,
+ 'components.view' => false,
+ 'components.create' => true,
+ 'components.edit' => false,
+ 'components.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
@@ -402,26 +471,42 @@ class PermissionsTest extends TestCase
*/
public function a_user_with_edit_components_permissions_can_edit_components()
{
- $u = factory(App\Models\User::class, 'valid-user')->states('edit-components')->create();
+ $u = factory(App\Models\User::class)->states('edit-components')->create();
$permissions = $this->noHardware + $this->noLicenses + $this->noAccessories +$this->noConsumables + $this->noUsers;
$permissions = array_merge($permissions, [
- route('components.index') => 403,
- route('components.create') => 403,
- route('components.edit', $this->componentId) => 200,
- route('components.show', $this->componentId) => 403,
+ 'components.view' => false,
+ 'components.create' => false,
+ 'components.edit' => true,
+ 'components.delete' => false,
]);
$this->hitRoutes($permissions, $u);
}
+ /**
+ * @test
+ */
+ public function a_user_with_delete_components_permissions_can_delete_components()
+ {
+ $u = factory(App\Models\User::class)->states('delete-components')->create();
+
+ $permissions = $this->noHardware + $this->noLicenses + $this->noAccessories +$this->noConsumables + $this->noUsers;
+
+ $permissions = array_merge($permissions, [
+ 'components.view' => false,
+ 'components.create' => false,
+ 'components.edit' => false,
+ 'components.delete' => true,
+ ]);
+ // dd($u);
+ $this->hitRoutes($permissions, $u);
+ }
+
private function hitRoutes(array $routes, User $user)
{
- $this->actingAs($user);
-
- foreach ($routes as $route => $response) {
- $this->get($route)
- ->assertStatus($response);
+ foreach ($routes as $route => $expectation) {
+ $this->assertEquals($user->hasAccess($route), $expectation);
}
}
}
diff --git a/tests/unit/SnipeModelTest.php b/tests/unit/SnipeModelTest.php
index 1cd0f5158..452afa49c 100644
--- a/tests/unit/SnipeModelTest.php
+++ b/tests/unit/SnipeModelTest.php
@@ -14,6 +14,11 @@ class SnipeModelTest extends \Codeception\TestCase\Test
/**
* @test
*/
+
+ protected function _before()
+ {
+ Artisan::call('migrate');
+ }
public function it_sets_purchase_dates_appropriately()
{
$c = new SnipeModel;
diff --git a/tests/unit/StatuslabelTest.php b/tests/unit/StatuslabelTest.php
index e3b65d380..5354d81f1 100644
--- a/tests/unit/StatuslabelTest.php
+++ b/tests/unit/StatuslabelTest.php
@@ -8,112 +8,112 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
class StatuslabelTest extends \Codeception\TestCase\Test
{
/**
- * @var \UnitTester
- */
+ * @var \UnitTester
+ */
protected $tester;
use DatabaseMigrations;
+ protected function _before()
+ {
+ Artisan::call('migrate');
+ }
+
public function testRTDStatuslabelAdd()
{
- $statuslabel = factory(Statuslabel::class, 'rtd')->make();
- $values = [
+ $statuslabel = factory(Statuslabel::class)->states('rtd')->make();
+ $values = [
'name' => $statuslabel->name,
'deployable' => $statuslabel->deployable,
'pending' => $statuslabel->pending,
'archived' => $statuslabel->archived,
- ];
+ ];
- Statuslabel::create($values);
- $this->tester->seeRecord('status_labels', $values);
+ Statuslabel::create($values);
+ $this->tester->seeRecord('status_labels', $values);
}
public function testPendingStatuslabelAdd()
{
- $statuslabel = factory(Statuslabel::class, 'pending')->make();
- $values = [
+ $statuslabel = factory(Statuslabel::class)->states('pending')->make();
+ $values = [
'name' => $statuslabel->name,
'deployable' => $statuslabel->deployable,
'pending' => $statuslabel->pending,
'archived' => $statuslabel->archived,
- ];
+ ];
- Statuslabel::create($values);
- $this->tester->seeRecord('status_labels', $values);
+ Statuslabel::create($values);
+ $this->tester->seeRecord('status_labels', $values);
}
public function testArchivedStatuslabelAdd()
{
- $statuslabel = factory(Statuslabel::class, 'archived')->make();
- $values = [
+ $statuslabel = factory(Statuslabel::class)->states('archived')->make();
+ $values = [
'name' => $statuslabel->name,
'deployable' => $statuslabel->deployable,
'pending' => $statuslabel->pending,
'archived' => $statuslabel->archived,
- ];
+ ];
- Statuslabel::create($values);
- $this->tester->seeRecord('status_labels', $values);
+ Statuslabel::create($values);
+ $this->tester->seeRecord('status_labels', $values);
}
public function testOutForRepairStatuslabelAdd()
{
- $statuslabel = factory(Statuslabel::class, 'out_for_repair')->make();
- $values = [
+ $statuslabel = factory(Statuslabel::class)->states('out_for_repair')->make();
+ $values = [
'name' => $statuslabel->name,
'deployable' => $statuslabel->deployable,
'pending' => $statuslabel->pending,
'archived' => $statuslabel->archived,
- ];
+ ];
- Statuslabel::create($values);
- $this->tester->seeRecord('status_labels', $values);
+ Statuslabel::create($values);
+ $this->tester->seeRecord('status_labels', $values);
}
public function testOutForDiagnosticsStatuslabelAdd()
{
- $statuslabel = factory(Statuslabel::class, 'out_for_diagnostics')->make();
- $values = [
+ $statuslabel = factory(Statuslabel::class)->states('out_for_diagnostics')->make();
+ $values = [
'name' => $statuslabel->name,
'deployable' => $statuslabel->deployable,
'pending' => $statuslabel->pending,
'archived' => $statuslabel->archived,
- ];
+ ];
- Statuslabel::create($values);
- $this->tester->seeRecord('status_labels', $values);
+ Statuslabel::create($values);
+ $this->tester->seeRecord('status_labels', $values);
}
public function testBrokenStatuslabelAdd()
{
- $statuslabel = factory(Statuslabel::class, 'broken')->make();
- $values = [
+ $statuslabel = factory(Statuslabel::class)->states('broken')->make();
+ $values = [
'name' => $statuslabel->name,
'deployable' => $statuslabel->deployable,
'pending' => $statuslabel->pending,
'archived' => $statuslabel->archived,
- ];
+ ];
- Statuslabel::create($values);
- $this->tester->seeRecord('status_labels', $values);
+ Statuslabel::create($values);
+ $this->tester->seeRecord('status_labels', $values);
}
public function testLostStatuslabelAdd()
{
- $statuslabel = factory(Statuslabel::class, 'lost')->make();
- $values = [
+ $statuslabel = factory(Statuslabel::class)->states('lost')->make();
+ $values = [
'name' => $statuslabel->name,
'deployable' => $statuslabel->deployable,
'pending' => $statuslabel->pending,
'archived' => $statuslabel->archived,
- ];
+ ];
- Statuslabel::create($values);
- $this->tester->seeRecord('status_labels', $values);
+ Statuslabel::create($values);
+ $this->tester->seeRecord('status_labels', $values);
}
-
-
-
-
-
}
diff --git a/tests/unit/SupplierTest.php b/tests/unit/SupplierTest.php
index 11beebeaf..f14f61363 100644
--- a/tests/unit/SupplierTest.php
+++ b/tests/unit/SupplierTest.php
@@ -13,9 +13,14 @@ class SupplierTest extends \Codeception\TestCase\Test
protected $tester;
use DatabaseMigrations;
+ protected function _before()
+ {
+ Artisan::call('migrate');
+ }
+
public function testSupplierAdd()
{
- $supplier = factory(Supplier::class, 'supplier')->make();
+ $supplier = factory(Supplier::class)->make();
$values = [
'name' => $supplier->name,
];
diff --git a/tests/unit/UserTest.php b/tests/unit/UserTest.php
index 094d17f27..45ae8ac10 100644
--- a/tests/unit/UserTest.php
+++ b/tests/unit/UserTest.php
@@ -13,9 +13,14 @@ class UserTest extends \Codeception\TestCase\Test
protected $tester;
use DatabaseMigrations;
+ protected function _before()
+ {
+ Artisan::call('migrate');
+ }
+
public function testUserAdd()
{
- $user = factory(User::class, 'valid-user')->make();
+ $user = factory(User::class)->make();
$values = [
'first_name' => $user->first_name,
'last_name' => $user->last_name,