/vendor/phpunit/phpunit/src/Util/ConfigurationGenerator.php

https://bitbucket.org/alan_cordova/api-sb-map · PHP · 66 lines · 43 code · 4 blank · 19 comment · 0 complexity · 44ffa918b2f3d3d13abc6d1bdede050d MD5 · raw file

  1. <?php
  2. /*
  3. * This file is part of PHPUnit.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. class PHPUnit_Util_ConfigurationGenerator
  11. {
  12. /**
  13. * @var string
  14. */
  15. private $defaultTemplate = <<<EOT
  16. <?xml version="1.0" encoding="UTF-8"?>
  17. <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  18. xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/{phpunit_version}/phpunit.xsd"
  19. bootstrap="{bootstrap_script}"
  20. backupGlobals="false"
  21. beStrictAboutCoversAnnotation="true"
  22. beStrictAboutOutputDuringTests="true"
  23. beStrictAboutTestsThatDoNotTestAnything="true"
  24. beStrictAboutTodoAnnotatedTests="true"
  25. verbose="true">
  26. <testsuite name="default">
  27. <directory suffix="Test.php">{tests_directory}</directory>
  28. </testsuite>
  29. <filter>
  30. <whitelist processUncoveredFilesFromWhitelist="true">
  31. <directory suffix=".php">{src_directory}</directory>
  32. </whitelist>
  33. </filter>
  34. </phpunit>
  35. EOT;
  36. /**
  37. * @param string $phpunitVersion
  38. * @param string $bootstrapScript
  39. * @param string $testsDirectory
  40. * @param string $srcDirectory
  41. *
  42. * @return string
  43. */
  44. public function generateDefaultConfiguration($phpunitVersion, $bootstrapScript, $testsDirectory, $srcDirectory)
  45. {
  46. return str_replace(
  47. [
  48. '{phpunit_version}',
  49. '{bootstrap_script}',
  50. '{tests_directory}',
  51. '{src_directory}'
  52. ],
  53. [
  54. $phpunitVersion,
  55. $bootstrapScript,
  56. $testsDirectory,
  57. $srcDirectory
  58. ],
  59. $this->defaultTemplate
  60. );
  61. }
  62. }