Small fixes

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2021-12-01 23:33:20 -08:00
parent ad6d70b86f
commit ed2797afdd
4 changed files with 8 additions and 25 deletions

View file

@ -2,20 +2,11 @@
namespace Database\Factories;
use App\Models\Company;
use Illuminate\Database\Eloquent\Factories\Factory;
use \Auth;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = \App\Models\User::class;
/**
* Define the model's default state.
*
@ -23,7 +14,6 @@ class UserFactory extends Factory
*/
public function definition()
{
$password = Hash::make('password');
return [
'activated' => 1,
'address' => $this->faker->address,
@ -39,7 +29,7 @@ class UserFactory extends Factory
'locale' => $this->faker->locale,
'location_id' => rand(1, 5),
'notes' => 'Created by DB seeder',
'password' => $password,
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'permissions' => '{"user":"0"}',
'phone' => $this->faker->phoneNumber,
'state' => $this->faker->stateAbbr,
@ -408,4 +398,5 @@ class UserFactory extends Factory
];
});
}
}

View file

@ -6,6 +6,7 @@ use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Tests\TestCase;
use Auth;
class BaseTest extends TestCase
{
@ -25,13 +26,12 @@ class BaseTest extends TestCase
]);
}
Auth::login($user);
return $user;
}
protected function createValidAssetModel($state = 'mbp-13-model', $overrides = [])
{
return \App\Models\AssetModel::factory()->state()->create(array_merge([
return \App\Models\AssetModel::factory()->state($state)->create(array_merge([
'category_id' => $this->createValidCategory(),
'manufacturer_id' => $this->createValidManufacturer(),
'depreciation_id' => $this->createValidDepreciation(),

View file

@ -3,8 +3,7 @@ namespace Tests\Unit;
use App\Models\Location;
use Tests\Unit\BaseTest;
use Illuminate\Database\Eloquent\Factories\Factory;
use Tests\TestCase;
class LocationTest extends BaseTest
{

View file

@ -1,18 +1,11 @@
<?php
namespace Tests\Unit;
use App\Exceptions\CheckoutNotAllowed;
use App\Models\Asset;
use App\Models\AssetModel;
use App\Models\Category;
use App\Models\Location;
use App\Models\User;
use App\Notifications\CheckoutAssetNotification;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Support\Facades\Notification;
use Tests\Unit\BaseTest;
use Auth;
class NotificationTest extends BaseTest
{