| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace Tests\Unit;
- use App\Services\RecordPlatformData;
- use ReflectionClass;
- use Tests\TestCase;
- class RecordPlatformDataServiceTest extends TestCase
- {
- public function testStatisticsQueriesUseNolockTableExpressions()
- {
- $source = $this->getServiceSource();
- $this->assertContains(
- '->table($this->withNoLock(TableName::QPAccountsDB() . \'AccountsInfo as ai\'))',
- $source
- );
- $this->assertContains(
- '->table($this->withNoLock(TableName::QPRecordDB() . \'RecordUserLogin as rul\'))',
- $source
- );
- $this->assertContains(
- '->table($this->withNoLock(TableName::QPRecordDB() . \'RecordUserDataStatisticsNew as record\'))',
- $source
- );
- $this->assertContains(
- '->from($this->withNoLock(TableName::QPRecordDB() . \'RecordUserGamePlay as rl\'))',
- $source
- );
- $this->assertContains(
- '->from($this->withNoLock(TableName::QPRecordDB() . \'RecordUserLogin as rl\'))',
- $source
- );
- $this->assertContains(
- '->join($this->withNoLock(TableName::QPAccountsDB() . \'AccountsInfo as ai\')',
- $source
- );
- $this->assertNotContains(
- "->join(TableName::QPAccountsDB().'AccountsInfo as ai'",
- $source
- );
- }
- private function getServiceSource()
- {
- $reflection = new ReflectionClass(RecordPlatformData::class);
- return file_get_contents($reflection->getFileName());
- }
- }
|