62 lines
2.1 KiB
PHP
62 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Business;
|
|
|
|
use App\Models\Common\Company;
|
|
use App\Models\Common\Permission;
|
|
use Mockery;
|
|
use Modules\EcommerceFinance\Services\StoreReceivingBalanceOverviewService;
|
|
use Tests\Feature\FeatureTestCase;
|
|
|
|
class StoreReceivingBalanceOverviewEndpointTest extends FeatureTestCase
|
|
{
|
|
public function test_overview_endpoint_returns_the_selected_month_payload(): void
|
|
{
|
|
$this->user->attachPermission(
|
|
Permission::where('name', 'read-admin-panel')->firstOrFail()
|
|
);
|
|
|
|
$payload = [
|
|
'month' => '2026-10',
|
|
'period' => ['start' => '2026-10-01', 'end' => '2026-10-31'],
|
|
'summary' => [
|
|
'opening_balance' => 100.0,
|
|
'income' => 30.0,
|
|
'expense' => 10.0,
|
|
'balance' => 120.0,
|
|
'platform_count' => 8,
|
|
'available_platform_count' => 8,
|
|
'complete' => true,
|
|
],
|
|
'platforms' => [],
|
|
];
|
|
$service = Mockery::mock(StoreReceivingBalanceOverviewService::class);
|
|
$service->shouldReceive('overview')->once()->with('2026-10')->andReturn($payload);
|
|
$this->app->instance(StoreReceivingBalanceOverviewService::class, $service);
|
|
|
|
$this->loginAs()
|
|
->getJson(route('ecommerce-finance.account-bills.overview', ['month' => '2026-10']))
|
|
->assertOk()
|
|
->assertJsonPath('month', '2026-10')
|
|
->assertJsonPath('summary.balance', 120)
|
|
->assertJsonPath('summary.complete', true);
|
|
}
|
|
|
|
public function test_overview_page_uses_the_vue_mount_point(): void
|
|
{
|
|
$this->user->attachPermission(
|
|
Permission::where('name', 'read-admin-panel')->firstOrFail()
|
|
);
|
|
|
|
$this->loginAs()
|
|
->get(route('business.pages.show', [
|
|
'section' => 'billing-transactions',
|
|
'page' => 'store-receiving-bills',
|
|
'tab' => 'balance-overview',
|
|
]))
|
|
->assertOk()
|
|
->assertSee('class="biz-card mt-6 business-blank-page"', false)
|
|
->assertSee('public/js/business/pages.min.js', false);
|
|
}
|
|
}
|