CaiWuXiTong/tests/Feature/Common/SourcesTest.php
WuYongJie 9595267ee7
Some checks failed
Tests / PHP 8.1 (push) Has been cancelled
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
chore: 导入 Akaunting 初始源码与团队协作规则
2026-07-20 18:20:25 +08:00

47 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature\Common;
use App\Jobs\Setting\CreateCategory;
use Tests\Feature\FeatureTestCase;
class SourcesTest extends FeatureTestCase
{
public function testItShouldHaveAutoSource()
{
$request = $this->getRequest();
$category = $this->dispatch(new CreateCategory($request));
$this->assertDatabaseHas('categories', [
'id' => $category->id,
'created_from' => 'core::console',
]);
}
public function testItShouldHaveManualSource()
{
$request = $this->getRequest();
$request['created_from'] = 'manual';
$category = $this->dispatch(new CreateCategory($request));
$this->assertDatabaseHas('categories', [
'id' => $category->id,
'created_from' => 'manual',
]);
}
public function getRequest()
{
return [
'company_id' => $this->company->id,
'name' => $this->faker->text(15),
'type' => 'income',
'color' => $this->faker->hexColor,
'enabled' => $this->faker->boolean ? 1 : 0,
];
}
}