DoctrineAnnotationIndentationFixerTest.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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\Fixer\DoctrineAnnotation;
  12. use PhpCsFixer\Tests\AbstractDoctrineAnnotationFixerTestCase;
  13. /**
  14. * @internal
  15. *
  16. * @covers \PhpCsFixer\AbstractDoctrineAnnotationFixer
  17. * @covers \PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationIndentationFixer
  18. */
  19. final class DoctrineAnnotationIndentationFixerTest extends AbstractDoctrineAnnotationFixerTestCase
  20. {
  21. /**
  22. * @param string $expected
  23. * @param string|null $input
  24. *
  25. * @dataProvider getFixCases
  26. */
  27. public function testFix($expected, $input = null)
  28. {
  29. $this->doTest($expected, $input);
  30. }
  31. /**
  32. * @return array
  33. */
  34. public function getFixCases()
  35. {
  36. return $this->createTestCases([
  37. ['
  38. /**
  39. * Foo.
  40. *
  41. * @author John Doe
  42. *
  43. * @Foo
  44. * @Bar
  45. */', '
  46. /**
  47. * Foo.
  48. *
  49. * @author John Doe
  50. *
  51. * @Foo
  52. * @Bar
  53. */'],
  54. ['
  55. /**
  56. * @Foo(
  57. * foo="foo"
  58. * )
  59. */', '
  60. /**
  61. * @Foo(
  62. * foo="foo"
  63. * )
  64. */'],
  65. ['
  66. /**
  67. * @Foo(foo="foo", bar={
  68. * "foo": 1,
  69. * "foobar": 2,
  70. * "foobarbaz": 3
  71. * })
  72. */', '
  73. /**
  74. * @Foo(foo="foo", bar={
  75. * "foo": 1,
  76. * "foobar": 2,
  77. * "foobarbaz": 3
  78. * })
  79. */'],
  80. ['
  81. /**
  82. * @Foo(@Bar({
  83. * "FOO": 1,
  84. * "BAR": 2,
  85. * "BAZ": 3
  86. * }))
  87. */', '
  88. /**
  89. * @Foo(@Bar({
  90. * "FOO": 1,
  91. * "BAR": 2,
  92. * "BAZ": 3
  93. * }))
  94. */'],
  95. ['
  96. /**
  97. * @Foo(
  98. * @Bar({
  99. * "FOO": 1,
  100. * "BAR": 2,
  101. * "BAZ": 3
  102. * })
  103. * )
  104. */', '
  105. /**
  106. * @Foo(
  107. * @Bar({
  108. * "FOO": 1,
  109. * "BAR": 2,
  110. * "BAZ": 3
  111. * })
  112. * )
  113. */'],
  114. ['
  115. /**
  116. * @Foo(
  117. * @Bar(
  118. * "baz"
  119. * )
  120. */'],
  121. ['
  122. /**
  123. * Foo(
  124. * Bar()
  125. * "baz"
  126. * )
  127. */'],
  128. ['
  129. /**
  130. * @Foo( @Bar(
  131. * "baz"
  132. * ) )
  133. */', '
  134. /**
  135. * @Foo( @Bar(
  136. * "baz"
  137. * ) )
  138. */'],
  139. ['
  140. /**
  141. * Description with a single " character.
  142. *
  143. * @Foo(
  144. * "string "" with inner quote"
  145. * )
  146. *
  147. * @param mixed description with a single " character.
  148. */', '
  149. /**
  150. * Description with a single " character.
  151. *
  152. * @Foo(
  153. * "string "" with inner quote"
  154. * )
  155. *
  156. * @param mixed description with a single " character.
  157. */'],
  158. ['
  159. /**
  160. * // PHPDocumentor 1
  161. * @abstract
  162. * @access
  163. * @code
  164. * @deprec
  165. * @encode
  166. * @exception
  167. * @final
  168. * @ingroup
  169. * @inheritdoc
  170. * @inheritDoc
  171. * @magic
  172. * @name
  173. * @toc
  174. * @tutorial
  175. * @private
  176. * @static
  177. * @staticvar
  178. * @staticVar
  179. * @throw
  180. *
  181. * // PHPDocumentor 2
  182. * @api
  183. * @author
  184. * @category
  185. * @copyright
  186. * @deprecated
  187. * @example
  188. * @filesource
  189. * @global
  190. * @ignore
  191. * @internal
  192. * @license
  193. * @link
  194. * @method
  195. * @package
  196. * @param
  197. * @property
  198. * @property-read
  199. * @property-write
  200. * @return
  201. * @see
  202. * @since
  203. * @source
  204. * @subpackage
  205. * @throws
  206. * @todo
  207. * @TODO
  208. * @usedBy
  209. * @uses
  210. * @var
  211. * @version
  212. *
  213. * // PHPUnit
  214. * @after
  215. * @afterClass
  216. * @backupGlobals
  217. * @backupStaticAttributes
  218. * @before
  219. * @beforeClass
  220. * @codeCoverageIgnore
  221. * @codeCoverageIgnoreStart
  222. * @codeCoverageIgnoreEnd
  223. * @covers
  224. * @coversDefaultClass
  225. * @coversNothing
  226. * @dataProvider
  227. * @depends
  228. * @expectedException
  229. * @expectedExceptionCode
  230. * @expectedExceptionMessage
  231. * @expectedExceptionMessageRegExp
  232. * @group
  233. * @large
  234. * @medium
  235. * @preserveGlobalState
  236. * @requires
  237. * @runTestsInSeparateProcesses
  238. * @runInSeparateProcess
  239. * @small
  240. * @test
  241. * @testdox
  242. * @ticket
  243. * @uses
  244. *
  245. * // PHPCheckStyle
  246. * @SuppressWarnings
  247. *
  248. * // PHPStorm
  249. * @noinspection
  250. *
  251. * // PEAR
  252. * @package_version
  253. *
  254. * // PlantUML
  255. * @enduml
  256. * @startuml
  257. *
  258. * // other
  259. * @fix
  260. * @FIXME
  261. * @fixme
  262. * @override
  263. */'],
  264. ]);
  265. }
  266. }