EgameItemTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Tests\Unit;
  3. use App\Models\EgameItem;
  4. use PHPUnit\Framework\TestCase;
  5. class EgameItemTest extends TestCase
  6. {
  7. public function test_ingress_labels_match_admin_ui(): void
  8. {
  9. $this->assertSame('电脑网页', EgameItem::ingressName('1'));
  10. $this->assertSame('手机网页', EgameItem::ingressName('2'));
  11. $this->assertSame('电脑/手机网页', EgameItem::ingressName('3'));
  12. $this->assertSame('', EgameItem::ingressName('9'));
  13. }
  14. public function test_network_labels_match_admin_ui(): void
  15. {
  16. $this->assertSame('大陆', EgameItem::networkName('mainland'));
  17. $this->assertSame('香港', EgameItem::networkName('hk'));
  18. $this->assertSame('韩国', EgameItem::networkName('kr'));
  19. $this->assertSame('日本', EgameItem::networkName('jp'));
  20. $this->assertSame('', EgameItem::networkName(''));
  21. }
  22. public function test_option_list_preserves_codes(): void
  23. {
  24. $options = EgameItem::optionList(EgameItem::NETWORK_LABELS);
  25. $this->assertSame('mainland', $options[0]['value']);
  26. $this->assertSame('大陆', $options[0]['label']);
  27. $this->assertCount(4, $options);
  28. }
  29. }