Tony Murray 26318dc4b3 Improve trap testing (#14546)
* Improve trap testing
Add helper log() to Trap
Avoid saving to the database at all

* style

* Move all traps to $trap->log()

* Update tests

* Lint and style fixes

* Use correct partial mock call

* more style

* Add docs

* debug in ci

* use the correct log function....................

* all, I guess

* not the first??

* 3rd?

* use event_id to order
2022-11-05 14:43:54 -05:00

54 lines
1.5 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Device;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<Device> */
class DeviceFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Device::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'hostname' => $this->faker->domainWord() . '-' . $this->faker->domainWord() . '-' . $this->faker->domainWord() . '.' . $this->faker->domainName(),
'ip' => $this->faker->randomElement([$this->faker->ipv4(), $this->faker->ipv6()]),
'type' => $this->faker->randomElement([
'appliance',
'camera',
'collaboration',
'encoder',
'environment',
'firewall',
'loadbalancer',
'management',
'network',
'power',
'printer',
'proxy',
'sensor',
'server',
'storage',
'timing',
'wireless',
'workstation',
]),
'sysDescr' => $this->faker->text(64),
'status' => $status = random_int(0, 1),
'status_reason' => $status == 0 ? $this->faker->randomElement(['snmp', 'icmp']) : '', // allow invalid states?
];
}
}