Helps the per-type SUM balance query. M13 (service_items.section_id) and M15 (clinic_doctor_invitations.doctor_id) were false positives — both columns carry a FK and are therefore auto-indexed by InnoDB; verified against the live schema. Structural regression: InfraSmokeTest::testWalletUserTypeIndexExists. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Tests\Smoke;
|
|
|
|
use App\Tests\ApiTestCase;
|
|
|
|
/**
|
|
* Confirms the test infrastructure itself works: app boots, /health serves,
|
|
* and JWT-authenticated requests reach protected endpoints.
|
|
*/
|
|
class InfraSmokeTest extends ApiTestCase
|
|
{
|
|
public function testHealthIsPublicAnd200(): void
|
|
{
|
|
$this->client->request('GET', '/health');
|
|
$this->assertSame(200, $this->responseCode());
|
|
}
|
|
|
|
public function testUnauthenticatedApiIs401(): void
|
|
{
|
|
$this->client->request('GET', '/oauth/userinfo');
|
|
$this->assertSame(401, $this->responseCode());
|
|
}
|
|
|
|
public function testJwtAuthReachesUserInfo(): void
|
|
{
|
|
$user = $this->createUser(['ROLE_USER']);
|
|
$body = $this->authJson('GET', '/oauth/userinfo', $user);
|
|
|
|
$this->assertSame(200, $this->responseCode());
|
|
$this->assertTrue($body['success']);
|
|
$this->assertSame($user->getUuid(), $body['data']['uuid']);
|
|
}
|
|
|
|
public function testWalletUserTypeIndexExists(): void
|
|
{
|
|
$conn = $this->em->getConnection();
|
|
$count = (int) $conn->fetchOne(
|
|
"SELECT COUNT(*) FROM information_schema.STATISTICS
|
|
WHERE TABLE_SCHEMA = DATABASE()
|
|
AND TABLE_NAME = 'wallet_transactions'
|
|
AND INDEX_NAME = 'idx_wallet_user_type'"
|
|
);
|
|
$this->assertGreaterThan(0, $count, 'composite index idx_wallet_user_type is missing');
|
|
}
|
|
}
|