mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 00:11:27 -08:00
66 lines
1.6 KiB
PHP
66 lines
1.6 KiB
PHP
<?php
|
|||
|
|||
declare(strict_types=1);
|
|||
|
|||
namespace Tests\Support\Importing;
|
|||
|
|||
use Illuminate\Support\Str;
|
|||
|
|||
/**
|
|||
* Build a users import file at runtime for testing.
|
|||
*
|
|||
* @template Row of array{
|
|||
* companyName?: string,
|
|||
* email?: string,
|
|||
* employeeNumber?: int,
|
|||
* firstName?: string,
|
|||
* lastName?: string,
|
|||
* location?: string,
|
|||
* phoneNumber?: string,
|
|||
* position?: string,
|
|||
* username?: string,
|
|||
* }
|
|||
*
|
|||
* @extends FileBuilder<Row>
|
|||
*/
|
|||
class UsersImportFileBuilder extends FileBuilder
|
|||
{
|
|||
/**
|
|||
* @inheritdoc
|
|||
*/
|
|||
protected function getDictionary(): array
|
|||
{
|
|||
return [
|
|||
'companyName' => 'Company',
|
|||
'email' => 'email',
|
|||
'employeeNumber' => 'Employee Number',
|
|||
'firstName' => 'First Name',
|
|||
'lastName' => 'Last Name',
|
|||
'location' => 'Location',
|
|||
'phoneNumber' => 'Phone Number',
|
|||
'position' => 'Job Title',
|
|||
'username' => 'Username',
|
|||
];
|
|||
}
|
|||
|
|||
/**
|
|||
* @inheritdoc
|
|||
*/
|
|||
public function definition(): array
|
|||
{
|
|||
$faker = fake();
|
|||
|
|||
return [
|
|||
'companyName' => $faker->company,
|
|||
'email' => Str::random(32) . "@{$faker->freeEmailDomain}",
|
|||
'employeeNumber' => $faker->uuid,
|
|||
'firstName' => $faker->firstName,
|
|||
'lastName' => $faker->lastName,
|
|||
'location' => "{$faker->city}, {$faker->country}",
|
|||
'phoneNumber' => $faker->phoneNumber,
|
|||
'position' => $faker->jobTitle,
|
|||
'username' => Str::random(),
|
|||
];
|
|||
}
|
|||
}
|