No Description

RuntimeTest.php 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. /**
  3. * Environment
  4. *
  5. * Copyright (c) 2014, Sebastian Bergmann <sebastian@phpunit.de>.
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * * Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * * Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. *
  20. * * Neither the name of Sebastian Bergmann nor the names of his
  21. * contributors may be used to endorse or promote products derived
  22. * from this software without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  27. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  28. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  29. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  30. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  31. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  32. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  33. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  34. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  35. * POSSIBILITY OF SUCH DAMAGE.
  36. *
  37. * @package Environment
  38. * @author Sebastian Bergmann <sebastian@phpunit.de>
  39. * @copyright 2014 Sebastian Bergmann <sebastian@phpunit.de>
  40. * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
  41. * @link http://www.github.com/sebastianbergmann/environment
  42. */
  43. namespace SebastianBergmann\Environment;
  44. use PHPUnit_Framework_TestCase;
  45. class RuntimeTest extends PHPUnit_Framework_TestCase
  46. {
  47. /**
  48. * @var \SebastianBergmann\Environment\Runtime
  49. */
  50. private $env;
  51. protected function setUp()
  52. {
  53. $this->env = new Runtime;
  54. }
  55. /**
  56. * @covers \SebastianBergmann\Environment\Runtime::canCollectCodeCoverage
  57. * @uses \SebastianBergmann\Environment\Runtime::hasXdebug
  58. * @uses \SebastianBergmann\Environment\Runtime::isHHVM
  59. * @uses \SebastianBergmann\Environment\Runtime::isPHP
  60. */
  61. public function testAbilityToCollectCodeCoverageCanBeAssessed()
  62. {
  63. $this->assertInternalType('boolean', $this->env->canCollectCodeCoverage());
  64. }
  65. /**
  66. * @covers \SebastianBergmann\Environment\Runtime::getBinary
  67. * @uses \SebastianBergmann\Environment\Runtime::isHHVM
  68. */
  69. public function testBinaryCanBeRetrieved()
  70. {
  71. $this->assertInternalType('string', $this->env->getBinary());
  72. }
  73. /**
  74. * @covers \SebastianBergmann\Environment\Runtime::isHHVM
  75. */
  76. public function testCanBeDetected()
  77. {
  78. $this->assertInternalType('boolean', $this->env->isHHVM());
  79. }
  80. /**
  81. * @covers \SebastianBergmann\Environment\Runtime::isPHP
  82. * @uses \SebastianBergmann\Environment\Runtime::isHHVM
  83. */
  84. public function testCanBeDetected2()
  85. {
  86. $this->assertInternalType('boolean', $this->env->isPHP());
  87. }
  88. /**
  89. * @covers \SebastianBergmann\Environment\Runtime::hasXdebug
  90. * @uses \SebastianBergmann\Environment\Runtime::isHHVM
  91. * @uses \SebastianBergmann\Environment\Runtime::isPHP
  92. */
  93. public function testXdebugCanBeDetected()
  94. {
  95. $this->assertInternalType('boolean', $this->env->hasXdebug());
  96. }
  97. /**
  98. * @covers \SebastianBergmann\Environment\Runtime::getNameWithVersion
  99. * @uses \SebastianBergmann\Environment\Runtime::getName
  100. * @uses \SebastianBergmann\Environment\Runtime::getVersion
  101. * @uses \SebastianBergmann\Environment\Runtime::isHHVM
  102. * @uses \SebastianBergmann\Environment\Runtime::isPHP
  103. */
  104. public function testNameAndVersionCanBeRetrieved()
  105. {
  106. $this->assertInternalType('string', $this->env->getNameWithVersion());
  107. }
  108. /**
  109. * @covers \SebastianBergmann\Environment\Runtime::getName
  110. * @uses \SebastianBergmann\Environment\Runtime::isHHVM
  111. */
  112. public function testNameCanBeRetrieved()
  113. {
  114. $this->assertInternalType('string', $this->env->getName());
  115. }
  116. /**
  117. * @covers \SebastianBergmann\Environment\Runtime::getVersion
  118. * @uses \SebastianBergmann\Environment\Runtime::isHHVM
  119. */
  120. public function testVersionCanBeRetrieved()
  121. {
  122. $this->assertInternalType('string', $this->env->getVersion());
  123. }
  124. /**
  125. * @covers \SebastianBergmann\Environment\Runtime::getVendorUrl
  126. * @uses \SebastianBergmann\Environment\Runtime::isHHVM
  127. */
  128. public function testVendorUrlCanBeRetrieved()
  129. {
  130. $this->assertInternalType('string', $this->env->getVendorUrl());
  131. }
  132. }