mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-08 21:15:33 +09:00
66 lines
1.6 KiB
PHP
66 lines
1.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Copyright 2022-2026 FOSSBilling
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*
|
|
* @copyright FOSSBilling (https://www.fossbilling.org)
|
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Helpers;
|
|
|
|
use Box\Mod\Staff\Entity\Admin;
|
|
|
|
/**
|
|
* Create a client order model.
|
|
*/
|
|
function order(array $attributes = []): object
|
|
{
|
|
$defaults = [
|
|
'id' => random_int(1, 10000),
|
|
'client_id' => random_int(1, 10000),
|
|
'product_id' => random_int(1, 10000),
|
|
'status' => \Box\Mod\Order\Entity\Order::STATUS_ACTIVE,
|
|
'created_at' => date('Y-m-d H:i:s'),
|
|
'updated_at' => date('Y-m-d H:i:s'),
|
|
];
|
|
|
|
return createEntity(\Box\Mod\Order\Entity\Order::class, array_merge($defaults, $attributes));
|
|
}
|
|
|
|
/**
|
|
* Create a client model.
|
|
*/
|
|
function client(array $attributes = []): object
|
|
{
|
|
$defaults = [
|
|
'id' => random_int(1, 10000),
|
|
'email' => 'test' . uniqid() . '@example.com',
|
|
'first_name' => 'Test',
|
|
'last_name' => 'User',
|
|
'status' => \Box\Mod\Client\Entity\Client::ACTIVE,
|
|
'created_at' => date('Y-m-d H:i:s'),
|
|
'updated_at' => date('Y-m-d H:i:s'),
|
|
];
|
|
|
|
return createEntity(\Box\Mod\Client\Entity\Client::class, array_merge($defaults, $attributes));
|
|
}
|
|
|
|
/**
|
|
* Create an admin model.
|
|
*/
|
|
function admin(array $attributes = []): object
|
|
{
|
|
$defaults = [
|
|
'id' => random_int(1, 10000),
|
|
'email' => 'admin' . uniqid() . '@example.com',
|
|
'name' => 'Admin User',
|
|
'status' => Admin::STATUS_ACTIVE,
|
|
];
|
|
|
|
return createEntity(Admin::class, array_merge($defaults, $attributes));
|
|
}
|