|
|
@@ -234,6 +234,30 @@ class AutomaticRewardGrantTest extends TestCase
|
|
|
return $cases;
|
|
|
}
|
|
|
|
|
|
+ public function test_melbet_message_lists_returns_the_rebate_and_backflow_notices(): void
|
|
|
+ {
|
|
|
+ $rebate = $this->rebate(); $backflow = $this->backflow();
|
|
|
+ Schema::table('users', function (Blueprint $t) { $t->string('user_id')->nullable(); $t->dateTime('delete_time')->nullable(); });
|
|
|
+ DB::table('users')->where('member_id', '1001')->update(['user_id' => 'login-1001', 'language' => 'en']);
|
|
|
+ RewardGrantService::grant('rebate', $rebate, 'operator-one');
|
|
|
+ RewardGrantService::grant('backflow', $backflow, 'operator-one');
|
|
|
+ $snapshot = tempnam(sys_get_temp_dir(), 'reward-inbox-');
|
|
|
+ unlink($snapshot); // VACUUM INTO requires a new file.
|
|
|
+ try {
|
|
|
+ DB::statement('VACUUM INTO ?', [$snapshot]);
|
|
|
+ $probe = new \Symfony\Component\Process\Process([PHP_BINARY, '-d', 'xdebug.mode=off', dirname(__DIR__) . '/fixtures/reward_message_inbox_probe.php', $snapshot, 'login-1001']);
|
|
|
+ $probe->mustRun();
|
|
|
+ $result = json_decode($probe->getOutput(), true, 512, JSON_THROW_ON_ERROR);
|
|
|
+ $this->assertSame(2, $result['listing']['count']);
|
|
|
+ $this->assertEqualsCanonicalizing(['Bet rebate credited', 'Loss rebate credited'], array_column($result['listing']['list'], 'title'));
|
|
|
+ $this->assertSame(['en', 'en'], array_column($result['listing']['list'], 'language'));
|
|
|
+ $this->assertSame([false, false], array_column($result['listing']['list'], 'is_read'));
|
|
|
+ $this->assertCount(2, $result['details']);
|
|
|
+ } finally {
|
|
|
+ if (is_file($snapshot)) unlink($snapshot);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function test_message_failure_rolls_back_the_payout_and_retry_delivers_once(): void
|
|
|
{
|
|
|
$id = $this->rebate(); $this->enable('rebate');
|