Warenwirtschaft: Test — API verarbeitet Produkte mit show_on=10 (intern)
Bestätigt, dass die Bestellannahme rein über die WP-Nummer zuordnet und show_on nur die Anzeige steuert — Produkte „zur internen Berechnung" sind damit API-bestellbar, ohne in Shops/Bestelllisten aufzutauchen. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
0e27478b44
commit
7265d9cd19
1 changed files with 23 additions and 0 deletions
|
|
@ -174,6 +174,29 @@ test('variations-sku wird dem basisprodukt zugeordnet', function () {
|
|||
expect(ShoppingOrderItem::query()->where('shopping_order_id', $log->shopping_order_id)->where('product_id', $product->id)->count())->toBe(1);
|
||||
});
|
||||
|
||||
test('produkt nur zur internen berechnung (show_on 10) wird per api zugeordnet', function () {
|
||||
// show_on steuert nur die Anzeige (Shop, Bestelllisten, Microsite …) —
|
||||
// die API-Zuordnung läuft ausschließlich über die WP-Nummer.
|
||||
Mail::fake();
|
||||
Passport::actingAs(apilogMakeUser());
|
||||
$product = apilogMakeProduct('Apilog Intern', 10050);
|
||||
$product->update(['show_on' => ['10']]);
|
||||
apilogMakeShoppingUser(4718);
|
||||
|
||||
$this->postJson('https://api.'.config('app.api_domain').'/wp/order', [
|
||||
'wp_order_number' => 4718,
|
||||
'wp_order' => [
|
||||
['article' => 10050, 'qty' => 1, 'price' => 1990],
|
||||
],
|
||||
])->assertOk();
|
||||
|
||||
$log = ApiOrderLog::query()->sole();
|
||||
expect($log->has_errors)->toBeFalse()
|
||||
->and($log->payload['lines'][0]['product_id'])->toBe($product->id);
|
||||
|
||||
expect(ShoppingOrderItem::query()->where('shopping_order_id', $log->shopping_order_id)->where('product_id', $product->id)->count())->toBe(1);
|
||||
});
|
||||
|
||||
test('sku ohne basis vor dem minus wird nicht zugeordnet', function () {
|
||||
Mail::fake();
|
||||
Passport::actingAs(apilogMakeUser());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue