Fixtures.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. namespace Drupal\Tests\Composer\Generator;
  3. use Drupal\Composer\Generator\Util\DrupalCoreComposer;
  4. /**
  5. * Convenience class for creating fixtures.
  6. */
  7. class Fixtures {
  8. /**
  9. * Generate a suitable DrupalCoreComposer fixture for testing.
  10. *
  11. * @return \Drupal\Composer\Generator\Util\DrupalCoreComposer
  12. * DrupalCoreComposer fixture.
  13. */
  14. public function drupalCoreComposerFixture() {
  15. return new DrupalCoreComposer($this->composerJson(), $this->composerLock());
  16. }
  17. /**
  18. * Data for a composer.json fixture.
  19. *
  20. * @return array
  21. * composer.json fixture data.
  22. */
  23. protected function composerJson() {
  24. return [
  25. 'name' => 'drupal/project-fixture',
  26. 'description' => 'A fixture for testing the metapackage generator.',
  27. 'type' => 'project',
  28. 'license' => 'GPL-2.0-or-later',
  29. 'require' =>
  30. [
  31. 'composer/installers' => '^1.9',
  32. 'php' => '>=7.0.8',
  33. 'symfony/yaml' => '~3.4.5',
  34. ],
  35. 'require-dev' =>
  36. [
  37. 'behat/mink' => '^1.8',
  38. ],
  39. ];
  40. }
  41. /**
  42. * Data for a composer.lock fixture.
  43. *
  44. * @return array
  45. * composer.lock fixture data.
  46. */
  47. protected function composerLock() {
  48. return [
  49. '_readme' =>
  50. [
  51. 'This is a composer.lock fixture. It contains only a subset of a',
  52. 'typical composer.lock file (just what is needed for testing).',
  53. ],
  54. 'content-hash' => 'da9910627bab73a256b39ceda83d7167',
  55. 'packages' =>
  56. [
  57. [
  58. 'name' => "composer/installers",
  59. 'version' => 'v1.9.0',
  60. 'source' => [
  61. 'type' => 'git',
  62. 'url' => 'https://github.com/composer/installers.git',
  63. 'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
  64. ],
  65. ],
  66. [
  67. 'name' => 'symfony/polyfill-ctype',
  68. 'version' => 'v1.12.0',
  69. 'source' =>
  70. [
  71. 'type' => 'git',
  72. 'url' => 'https://github.com/symfony/polyfill-ctype.git',
  73. 'reference' => '550ebaac289296ce228a706d0867afc34687e3f4',
  74. ],
  75. ],
  76. [
  77. 'name' => 'symfony/yaml',
  78. 'version' => 'v3.4.32',
  79. 'source' =>
  80. [
  81. 'type' => 'git',
  82. 'url' => 'https://github.com/symfony/yaml.git',
  83. 'reference' => '768f817446da74a776a31eea335540f9dcb53942',
  84. ],
  85. ],
  86. ],
  87. 'packages-dev' =>
  88. [
  89. [
  90. 'name' => 'behat/mink',
  91. 'version' => 'v1.8.0',
  92. 'source' =>
  93. [
  94. 'type' => 'git',
  95. 'url' => 'https://github.com/minkphp/Mink.git',
  96. 'reference' => 'e1772aabb6b654464264a6cc72158c8b3409d8bc',
  97. ],
  98. ],
  99. [
  100. 'name' => 'symfony/css-selector',
  101. 'version' => 'v4.3.5',
  102. 'source' =>
  103. [
  104. 'type' => 'git',
  105. 'url' => 'https://github.com/symfony/css-selector.git',
  106. 'reference' => 'f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9',
  107. ],
  108. ],
  109. ],
  110. ];
  111. }
  112. }