[FIX] 修復所有 E2E 模組測試的標題定位器以及將測試帳號還原為 admin 權限
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s
This commit is contained in:
@@ -17,6 +17,7 @@ class InventoryTransferImportTest extends TestCase
|
||||
use RefreshDatabase;
|
||||
|
||||
protected $user;
|
||||
protected $tenant;
|
||||
protected $fromWarehouse;
|
||||
protected $toWarehouse;
|
||||
protected $order;
|
||||
@@ -25,6 +26,15 @@ class InventoryTransferImportTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
// Create a unique tenant for this test run
|
||||
$tenantId = 'test_' . str_replace('.', '', microtime(true));
|
||||
$this->tenant = \App\Modules\Core\Models\Tenant::create([
|
||||
'id' => $tenantId,
|
||||
]);
|
||||
$this->tenant->domains()->create(['domain' => $tenantId . '.test']);
|
||||
tenancy()->initialize($this->tenant);
|
||||
|
||||
$this->user = User::create([
|
||||
'name' => 'Test User',
|
||||
'username' => 'testuser',
|
||||
@@ -52,10 +62,13 @@ class InventoryTransferImportTest extends TestCase
|
||||
'created_by' => $this->user->id,
|
||||
]);
|
||||
|
||||
$category = \App\Modules\Inventory\Models\Category::create(['name' => 'General', 'code' => 'GEN']);
|
||||
|
||||
$this->product = Product::create([
|
||||
'code' => 'P001',
|
||||
'name' => 'Test Product',
|
||||
'status' => 'enabled',
|
||||
'category_id' => $category->id,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -80,8 +93,9 @@ class InventoryTransferImportTest extends TestCase
|
||||
// 但如果我們在 Import 類別中直接讀取 $row['商品代碼'],我們得確定它真的在那裡。
|
||||
|
||||
$rows = collect([
|
||||
collect(['商品代碼' => 'P001', '批號' => 'BATCH001', '數量' => '10', '備註' => 'Imported Via Test']),
|
||||
collect(['商品代碼' => 'P001', '批號' => '', '數量' => '5', '備註' => 'Batch should be NO-BATCH']),
|
||||
collect(['商品代碼', '批號', '數量', '備註']),
|
||||
collect(['P001', 'BATCH001', '10', 'Imported Via Test']),
|
||||
collect(['P001', '', '5', 'Batch should be NO-BATCH']),
|
||||
]);
|
||||
|
||||
$import->collection($rows);
|
||||
|
||||
Reference in New Issue
Block a user