Merge branch 'develop' of github.com:snipe/snipe-it into develop

This commit is contained in:
snipe 2017-01-24 17:07:23 -08:00
commit eea779c16d
4 changed files with 18 additions and 16 deletions

View file

@ -21,11 +21,11 @@ before_script:
- chmod -R 777 storage - chmod -R 777 storage
- php artisan migrate --env=testing-ci --database=mysql --force - php artisan migrate --env=testing-ci --database=mysql --force
- ./vendor/bin/codecept build - ./vendor/bin/codecept build
- php artisan key:generate --env=testing-ci - php artisan --env=testing-ci key:generate
- php artisan db:seed --env=testing-ci --database=mysql --force - php artisan --env=testing-ci db:seed --database=mysql --force
- php artisan --env=testing-ci snipeit:create-admin --first_name=Alison --last_name=Foobar --email=me@example.com --username=snipe --password=password - php artisan --env=testing-ci snipeit:create-admin --first_name=Alison --last_name=Foobar --email=me@example.com --username=snipe --password=password
- php artisan --env=testing-ci snipeit:travisci-install - php artisan --env=testing-ci snipeit:travisci-install
- php artisan passport:install - php artisan --env=testing-ci passport:install
- php artisan serve --env=testing-ci --port=8000 --host=localhost & - php artisan serve --env=testing-ci --port=8000 --host=localhost &
- sleep 5 - sleep 5
- pip install --user codecov - pip install --user codecov

View file

@ -11,26 +11,28 @@
| |
*/ */
use App\Models\AssetModel;
use App\Models\Category; use App\Models\Category;
use App\Models\Company; use App\Models\Company;
use App\Models\Location; use App\Models\Location;
use App\Models\Manufacturer; use App\Models\Manufacturer;
use App\Models\Statuslabel;
use App\Models\Supplier; use App\Models\Supplier;
$factory->defineAs(App\Models\Asset::class, 'asset', function (Faker\Generator $faker) { $factory->defineAs(App\Models\Asset::class, 'asset', function (Faker\Generator $faker) {
return [ return [
'name' => $faker->catchPhrase, 'name' => $faker->catchPhrase,
'model_id' => $faker->numberBetween(1, 5), 'model_id' => AssetModel::inRandomOrder()->first()->id,
'rtd_location_id' => $faker->numberBetween(1, 5), 'rtd_location_id' => Location::inRandomOrder()->first()->id,
'serial' => $faker->uuid, 'serial' => $faker->uuid,
'status_id' => 1, 'status_id' => Statuslabel::inRandomOrder()->first()->id,
'user_id' => 1, 'user_id' => 1,
'asset_tag' => $faker->unixTime('now'), 'asset_tag' => $faker->unixTime('now'),
'notes' => $faker->sentence, 'notes' => $faker->sentence,
'purchase_date' => $faker->dateTime(), 'purchase_date' => $faker->dateTime(),
'purchase_cost' => $faker->randomFloat(2), 'purchase_cost' => $faker->randomFloat(2),
'order_number' => $faker->numberBetween(1000000, 50000000), 'order_number' => $faker->numberBetween(1000000, 50000000),
'supplier_id' => $faker->numberBetween(1, 5), 'supplier_id' => Supplier::inRandomOrder()->first()->id,
'company_id' => Company::inRandomOrder()->first()->id, 'company_id' => Company::inRandomOrder()->first()->id,
'requestable' => $faker->boolean() 'requestable' => $faker->boolean()
]; ];
@ -40,8 +42,8 @@ $factory->defineAs(App\Models\Asset::class, 'asset', function (Faker\Generator $
$factory->defineAs(App\Models\AssetModel::class, 'assetmodel', function (Faker\Generator $faker) { $factory->defineAs(App\Models\AssetModel::class, 'assetmodel', function (Faker\Generator $faker) {
return [ return [
'name' => $faker->catchPhrase, 'name' => $faker->catchPhrase,
'manufacturer_id' => $faker->numberBetween(1, 10), 'manufacturer_id' => Manufacturer::inRandomOrder()->first()->id,
'category_id' => $faker->numberBetween(1, 9), 'category_id' => Category::where('category_type', 'asset')->inRandomOrder()->first()->id,
'model_number' => $faker->numberBetween(1000000, 50000000), 'model_number' => $faker->numberBetween(1000000, 50000000),
'eol' => 1, 'eol' => 1,
'notes' => $faker->paragraph(), 'notes' => $faker->paragraph(),
@ -88,7 +90,7 @@ $factory->defineAs(App\Models\Manufacturer::class, 'manufacturer', function (Fak
$factory->defineAs(App\Models\Component::class, 'component', function (Faker\Generator $faker) { $factory->defineAs(App\Models\Component::class, 'component', function (Faker\Generator $faker) {
return [ return [
'name' => $faker->text(20), 'name' => $faker->text(20),
'category_id' => $faker->numberBetween(21, 25), 'category_id' => Category::where('category_type', 'component')->inRandomOrder()->first()->id,
'location_id' => Location::inRandomOrder()->first()->id, 'location_id' => Location::inRandomOrder()->first()->id,
'serial' => $faker->uuid, 'serial' => $faker->uuid,
'qty' => $faker->numberBetween(3, 10), 'qty' => $faker->numberBetween(3, 10),
@ -113,7 +115,7 @@ $factory->defineAs(App\Models\Accessory::class, 'accessory', function (Faker\Gen
'name' => $faker->text(20), 'name' => $faker->text(20),
'category_id' => Category::where('category_type', 'accessory')->inRandomOrder()->first()->id, 'category_id' => Category::where('category_type', 'accessory')->inRandomOrder()->first()->id,
'manufacturer_id' => Manufacturer::inRandomOrder()->first()->id, 'manufacturer_id' => Manufacturer::inRandomOrder()->first()->id,
'location_id' => $faker->numberBetween(1, 5), 'location_id' => Location::inRandomOrder()->first()->id,
'order_number' => $faker->numberBetween(1000000, 50000000), 'order_number' => $faker->numberBetween(1000000, 50000000),
'purchase_date' => $faker->dateTime(), 'purchase_date' => $faker->dateTime(),
'purchase_cost' => $faker->randomFloat(2), 'purchase_cost' => $faker->randomFloat(2),
@ -147,7 +149,7 @@ $factory->defineAs(App\Models\Consumable::class, 'consumable', function (Faker\G
return [ return [
'name' => $faker->text(20), 'name' => $faker->text(20),
'company_id' => Company::inRandomOrder()->first()->id, 'company_id' => Company::inRandomOrder()->first()->id,
'category_id' => $faker->numberBetween(16, 20), 'category_id' => Category::where('category_type', 'consumable')->inRandomOrder()->first()->id,
'model_number' => $faker->numberBetween(1000000, 50000000), 'model_number' => $faker->numberBetween(1000000, 50000000),
'item_no' => $faker->numberBetween(1000000, 50000000), 'item_no' => $faker->numberBetween(1000000, 50000000),
'order_number' => $faker->numberBetween(1000000, 50000000), 'order_number' => $faker->numberBetween(1000000, 50000000),

View file

@ -10,9 +10,7 @@ $factory->defineAs(App\Models\User::class, 'valid-user', function (Faker\Generat
'password' => $faker->password, 'password' => $faker->password,
'permissions' => '{"user":"0"}', 'permissions' => '{"user":"0"}',
'email' => $faker->safeEmail, 'email' => $faker->safeEmail,
'company_id' => function () { 'company_id' => Company::inRandomOrder()->first()->id,
return factory(App\Models\Company::class, 'company')->create()->id;
},
'locale' => $faker->locale, 'locale' => $faker->locale,
'employee_num' => $faker->numberBetween(3500, 35050), 'employee_num' => $faker->numberBetween(3500, 35050),
'jobtitle' => $faker->word, 'jobtitle' => $faker->word,

View file

@ -22,12 +22,14 @@ class DatabaseSeeder extends Seeder
$this->call(LocationSeeder::class); $this->call(LocationSeeder::class);
$this->call(SupplierSeeder::class); $this->call(SupplierSeeder::class);
$this->call(AssetModelSeeder::class); $this->call(AssetModelSeeder::class);
$this->call(DepreciationSeeder::class);
$this->call(StatuslabelSeeder::class);
$this->call(AccessorySeeder::class); $this->call(AccessorySeeder::class);
$this->call(AssetSeeder::class); $this->call(AssetSeeder::class);
$this->call(LicenseSeeder::class); $this->call(LicenseSeeder::class);
$this->call(ComponentSeeder::class); $this->call(ComponentSeeder::class);
$this->call(ConsumableSeeder::class); $this->call(ConsumableSeeder::class);
$this->call(StatuslabelSeeder::class); $this->call(LicenseSeeder::class);
$this->call(ActionlogSeeder::class); $this->call(ActionlogSeeder::class);
$this->call(CustomFieldSeeder::class); $this->call(CustomFieldSeeder::class);