UserAgentTest.php 908 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Faker\Test\Provider;
  3. use Faker\Provider\UserAgent;
  4. class UserAgentTest extends \PHPUnit_Framework_TestCase
  5. {
  6. public function testRandomUserAgent()
  7. {
  8. $this->assertNotNull(UserAgent::userAgent());
  9. }
  10. public function testFirefoxUserAgent()
  11. {
  12. $this->stringContains(' Firefox/', UserAgent::firefox());
  13. }
  14. public function testSafariUserAgent()
  15. {
  16. $this->stringContains('Safari/', UserAgent::safari());
  17. }
  18. public function testInternetExplorerUserAgent()
  19. {
  20. $this->assertStringStartsWith('Mozilla/5.0 (compatible; MSIE ', UserAgent::internetExplorer());
  21. }
  22. public function testOperaUserAgent()
  23. {
  24. $this->assertStringStartsWith('Opera/', UserAgent::opera());
  25. }
  26. public function testChromeUserAgent()
  27. {
  28. $this->stringContains('(KHTML, like Gecko) Chrome/', UserAgent::chrome());
  29. }
  30. }