AgentDomainServiceTest.php 891 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Tests\Unit;
  3. use App\Services\Agent\AgentDomainService;
  4. use PHPUnit\Framework\TestCase;
  5. use ReflectionMethod;
  6. class AgentDomainServiceTest extends TestCase
  7. {
  8. public function test_hash_router_registration_urls_keep_agent_code_inside_fragment_route(): void
  9. {
  10. $method = new ReflectionMethod(AgentDomainService::class, 'registerUrl');
  11. $method->setAccessible(true);
  12. $service = new AgentDomainService();
  13. $this->assertSame(
  14. 'https://pc.example.com/#/user/register?agent_code=ABC123',
  15. $method->invoke($service, 'https://pc.example.com', '/#/user/register', 'ABC123')
  16. );
  17. $this->assertSame(
  18. 'https://h5.example.com/#/pages/login/login?type=reg&agent_code=ABC123',
  19. $method->invoke($service, 'https://h5.example.com', '/#/pages/login/login?type=reg', 'ABC123')
  20. );
  21. }
  22. }