ToolInfoTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /*
  3. * This file is part of PHP CS Fixer.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  7. *
  8. * This source file is subject to the MIT license that is bundled
  9. * with this source code in the file LICENSE.
  10. */
  11. namespace PhpCsFixer\Tests;
  12. use PhpCsFixer\ToolInfo;
  13. /**
  14. * @author SpacePossum
  15. *
  16. * @internal
  17. *
  18. * @covers \PhpCsFixer\ToolInfo
  19. */
  20. final class ToolInfoTest extends TestCase
  21. {
  22. public function testGetVersion()
  23. {
  24. $toolInfo = new ToolInfo();
  25. $this->assertInternalType('string', $toolInfo->getVersion());
  26. }
  27. public function testIsInstallAsPhar()
  28. {
  29. $toolInfo = new ToolInfo();
  30. $this->assertFalse($toolInfo->isInstalledAsPhar());
  31. }
  32. public function testIsInstalledByComposer()
  33. {
  34. $toolInfo = new ToolInfo();
  35. $this->assertFalse($toolInfo->isInstalledByComposer());
  36. }
  37. public function testGetComposerVersionThrowsExceptionIfOutsideComposerScope()
  38. {
  39. $toolInfo = new ToolInfo();
  40. $this->expectException(\LogicException::class);
  41. $toolInfo->getComposerVersion();
  42. }
  43. public function testGetPharDownloadUri()
  44. {
  45. $toolInfo = new ToolInfo();
  46. $this->assertSame(
  47. 'https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/foo/php-cs-fixer.phar',
  48. $toolInfo->getPharDownloadUri('foo')
  49. );
  50. }
  51. }