feat(portal): lead module, WHMCS sync report/contacts/mapping, service lifecycle email templates
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
3c7710f1de
commit
a443ec3bf6
@@ -61,4 +61,23 @@ class AdminProductResourceTest extends TestCase
|
||||
$this->assertSame('onetime', $data['billing_type']);
|
||||
$this->assertSame('15000000.00', $data['price_onetime']);
|
||||
}
|
||||
|
||||
public function test_custom_prices_serialize_as_json_object_even_when_empty(): void
|
||||
{
|
||||
$product = new Product(['name' => 'No custom cycles', 'is_active' => true, 'setup_fee' => 0]);
|
||||
$product->id = 6;
|
||||
$product->setRelation('pricings', new Collection([
|
||||
new ProductPricings(['billing_cycle' => 'annually', 'price' => 1000000, 'currency' => 'VND']),
|
||||
new ProductPricings(['billing_cycle' => 'months_60', 'price' => 5000000, 'currency' => 'VND']),
|
||||
]));
|
||||
|
||||
$withCustom = json_decode((new ProductResource($product))->toResponse(request())->getContent());
|
||||
$this->assertIsObject($withCustom->data->custom_prices ?? $withCustom->custom_prices);
|
||||
|
||||
$product->setRelation('pricings', new Collection([
|
||||
new ProductPricings(['billing_cycle' => 'annually', 'price' => 1000000, 'currency' => 'VND']),
|
||||
]));
|
||||
$empty = json_decode((new ProductResource($product))->toResponse(request())->getContent());
|
||||
$this->assertIsObject($empty->data->custom_prices ?? $empty->custom_prices);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user