| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace Tests\Unit;
- use App\Services\WorldCup\Repositories\SqlWorldCupReviewRepository;
- use PHPUnit\Framework\TestCase;
- use ReflectionClass;
- class WorldCupReviewRepositoryMailCopyTest extends TestCase
- {
- public function testInviteeApprovedMailUsesWelcomeRewardCopy(): void
- {
- $repository = new SqlWorldCupReviewRepository();
- $reward = $this->reward();
- $title = $this->callPrivate($repository, 'approvedInviteeMailTitle', [$reward]);
- $text = $this->callPrivate($repository, 'approvedInviteeMailText', [$reward]);
- $this->assertSame('Claim your $60 welcome reward', $title);
- $this->assertContains('Welcome! Your referral reward is ready to claim.', $text);
- $this->assertContains('You signed up with an invite and made your first deposit of $120.', $text);
- $this->assertContains('Reward: $60 (50% of your first deposit).', $text);
- $this->assertContains('Tap Claim to add it to your balance.', $text);
- }
- public function testInviteeRejectedMailUsesWelcomeRewardCopy(): void
- {
- $repository = new SqlWorldCupReviewRepository();
- $reward = $this->reward();
- $title = $this->callPrivate($repository, 'rejectedInviteeMailTitle', [$reward]);
- $text = $this->callPrivate($repository, 'rejectedInviteeMailText', [$reward, 'Same device']);
- $this->assertSame('Welcome reward not approved', $title);
- $this->assertContains('Your welcome reward could not be approved.', $text);
- $this->assertContains('Reason: Same device.', $text);
- $this->assertContains('If you think this is a mistake, contact support.', $text);
- }
- private function reward(): array
- {
- return [
- 'reward_id' => 1,
- 'referrer_id' => 1001,
- 'invitee_id' => 1002,
- 'first_deposit_amt' => 12000,
- 'reward_each' => 6000,
- 'total_liability' => 12000,
- 'risk_level' => 'low',
- 'status' => 'reviewing',
- ];
- }
- private function callPrivate(object $object, string $method, array $arguments)
- {
- $reflection = new ReflectionClass($object);
- $method = $reflection->getMethod($method);
- $method->setAccessible(true);
- return $method->invokeArgs($object, $arguments);
- }
- }
|