Skip to content
Browse files

Published additional tests and fixes

- Various code integrity fixes in different places:
-- Fixed obsolete references to classes
-- Fixed broken references to template and static view files
-- Fixed some minor occurrences of deprecated code
-- Code style minor fixes
- Various minor bugfixes
- Implemented "developer mode" in integration tests
- Added "rollback" scripts capability for data fixtures
- Removed deprecated methods and attributes from product type class
- Restructured code integrity tests:
-- Moved out part of the tests from integration into static tests
-- Introduced "Legacy" test suite in static tests. This test suite is not executed by default when running either phpunit directly or using the "batch tool"
-- Simplified and reorganized the "Exemplar" and self-assessment tests for static code analysis
- Covered previously made backwards-incompatible changes with legacy tests
- Changed storage of class map from a PHP-file with array into a better-performing text file with serialized array.
- Published dev/tests/static and dev/tests/unit
  • Loading branch information...
1 parent 9b9ce2c commit 68bdc66b233a55f27af17e0ae257f0db5c811aa9 @magento-team magento-team committed
Showing with 9,072 additions and 218 deletions.
  1. +5 −2 app/bootstrap.php
  2. +7 −1 app/code/community/Phoenix/Moneybookers/etc/adminhtml.xml
  3. +14 −0 app/code/core/Mage/Catalog/Model/Resource/Abstract.php
  4. +1 −1 app/code/core/Mage/Core/Model/Config.php
  5. +0 −1 app/code/core/Mage/Core/Model/Convert.php
  6. +5 −5 app/code/core/Mage/Core/Model/{Shell/Abstract.php → ShellAbstract.php}
  7. +1 −1 app/code/core/Mage/Directory/Model/Resource/Currency.php
  8. +1 −1 app/code/core/Mage/ImportExport/Model/Import.php
  9. +26 −0 app/code/core/Mage/ImportExport/view/adminhtml/layout.xml
  10. +1 −1 app/code/core/Mage/Index/Model/Shell.php
  11. +1 −1 app/code/core/Mage/Log/Model/Shell.php
  12. +1 −1 app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php
  13. +1 −1 app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php
  14. +0 −78 dev/tests/integration/framework/Magento/Test/TestCase/VisitorAbstract.php
  15. +26 −0 ...ation/framework/tests/unit/testsuite/Magento/Test/Listener/_files/sample_fixture_two_rollback.php
  16. +1 −1 ...tests/integration/testsuite/Mage/Core/Model/_files/design/frontend/package/default/fallback.phtml
  17. +1 −1 ...ration/testsuite/Mage/Core/Model/_files/design/frontend/package/default/skin/access_violation.php
  18. +0 −87 dev/tests/integration/testsuite/integrity/ConfigTest.php
  19. +4 −0 dev/tests/static/.gitignore
  20. +107 −0 dev/tests/static/framework/Inspection/CodeSniffer/Command.php
  21. +124 −0 dev/tests/static/framework/Inspection/CommandAbstract.php
  22. +131 −0 dev/tests/static/framework/Inspection/CopyPasteDetector/Command.php
  23. +98 −0 dev/tests/static/framework/Inspection/CopyPasteDetector/html_report.xslt
  24. +95 −0 dev/tests/static/framework/Inspection/MessDetector/Command.php
  25. +41 −0 dev/tests/static/framework/bootstrap.php
  26. +37 −0 dev/tests/static/framework/tests/unit/phpunit.xml.dist
  27. +126 −0 dev/tests/static/framework/tests/unit/testsuite/Inspection/CodeSniffer/CommandTest.php
  28. +109 −0 dev/tests/static/framework/tests/unit/testsuite/Inspection/CopyPasteDetector/CommandTest.php
  29. +115 −0 dev/tests/static/framework/tests/unit/testsuite/Inspection/MessDetector/CommandTest.php
  30. +39 −0 dev/tests/static/phpunit-all.xml.dist
  31. +42 −0 dev/tests/static/phpunit.xml.dist
  32. +202 −0 dev/tests/static/testsuite/FileDataProvider.php
  33. +312 −0 dev/tests/static/testsuite/Integrity/ClassesTest.php
  34. +303 −0 dev/tests/static/testsuite/Legacy/ClassesTest.php
  35. +67 −0 dev/tests/static/testsuite/Legacy/ConfigTest.php
  36. +51 −0 dev/tests/static/testsuite/Legacy/EmailTemplateTest.php
  37. +10 −27 dev/tests/{integration/testsuite/integrity → static/testsuite/Legacy}/LayoutTest.php
  38. +82 −0 dev/tests/static/testsuite/Legacy/LicenseTest.php
  39. +277 −0 dev/tests/static/testsuite/Legacy/ObsoleteCodeTest.php
  40. +248 −0 dev/tests/static/testsuite/Legacy/TableTest.php
  41. +181 −0 dev/tests/static/testsuite/Legacy/_files/obsolete_classes.php
  42. +60 −0 dev/tests/static/testsuite/Legacy/_files/obsolete_constants.php
  43. +323 −0 dev/tests/static/testsuite/Legacy/_files/obsolete_methods.php
  44. +60 −0 dev/tests/static/testsuite/Legacy/_files/obsolete_properties.php
  45. +176 −0 dev/tests/static/testsuite/Php/Exemplar/CodeMessTest.php
  46. +251 −0 dev/tests/static/testsuite/Php/Exemplar/CodeStyleTest.php
  47. +4 −0 ...ests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/classes/brace_same_line.xml
  48. +4 −0 ...c/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/classes/brace_several_lines_below.xml
  49. +4 −0 ...ests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/classes/brace_with_code.xml
  50. +4 −0 ...ts/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/classes/brace_with_spaces.xml
  51. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/classes/normal_class.xml
  52. +6 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/demarcation/asp_tag.xml
  53. +6 −0 ...tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/demarcation/short_echo.xml
  54. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/demarcation/short_tag.xml
  55. +5 −0 ...static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/function_usage/wrong_spacing.xml
  56. +6 −0 ...c/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/function_usage/wrong_spacing_ends.xml
  57. +4 −0 ...ts/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/brace_same_line.xml
  58. +4 −0 ...testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/brace_several_lines_below.xml
  59. +5 −0 ...ts/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/brace_with_code.xml
  60. +4 −0 .../static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/brace_with_spaces.xml
  61. +5 −0 ...estsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/calltime_pass_by_reference.xml
  62. +4 −0 ...te/Php/Exemplar/_files/phpcs/expected/coding_style/functions/calltime_pass_by_reference_mimic.xml
  63. +4 −0 ...atic/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/method_without_scope.xml
  64. +8 −0 ...stsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/multiline_wrong_declaration.xml
  65. +4 −0 ...atic/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/normal_arg_reference.xml
  66. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/normal_func.xml
  67. +4 −0 ...ests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/normal_lambda.xml
  68. +5 −0 ...static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/functions/unneeded_multiline.xml
  69. +4 −0 ...s/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/brace_double_space.xml
  70. +4 −0 ...ests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/brace_next_line.xml
  71. +4 −0 ...tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/brace_no_space.xml
  72. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/braces_absent.xml
  73. +4 −0 ...tic/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/closing_brace_same_line.xml
  74. +4 −0 ...suite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/closing_brace_wrong_indentation.xml
  75. +5 −0 ...c/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/multiline_brace_same_line.xml
  76. +5 −0 ...estsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/multiline_operator_same_line.xml
  77. +5 −0 ...testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/multiline_wrong_indentation.xml
  78. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/normal.xml
  79. +4 −0 ...sts/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/normal_multiline.xml
  80. +4 −0 ...static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/parenthesis_no_space.xml
  81. +5 −0 ...ts/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/wrong_indentation.xml
  82. +18 −0 ...tic/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/wrong_spacing_operators.xml
  83. +8 −0 ...suite/Php/Exemplar/_files/phpcs/expected/coding_style/if_else/wrong_spacing_operators_logical.xml
  84. +7 −0 ...tatic/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/inline_doc/format/wrong_align.xml
  85. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/inline_doc/normal.xml
  86. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/coding_style/switch/normal.xml
  87. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/general/closing_tag.xml
  88. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/general/closing_tag_middle.xml
  89. +9 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/general/indentation.xml
  90. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/general/indentation_nonexact_code.xml
  91. +4 −0 ...tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/general/indentation_nonexact_phpdoc.xml
  92. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/general/line_endings_cr.xml
  93. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/general/line_endings_crlf.xml
  94. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/general/line_length.xml
  95. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/class/minuscule.xml
  96. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/class/one_word.xml
  97. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/class/two_capitals.xml
  98. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/class/two_underscores.xml
  99. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/class/underscore_start.xml
  100. +6 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/constant/minuscule_letter.xml
  101. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/constant/normal_constant.xml
  102. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/function/capital_start.xml
  103. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/function/normal_camelcase.xml
  104. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/function/normal_plain.xml
  105. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/function/underscore_middle.xml
  106. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/function/underscore_start.xml
  107. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/method/capital_start.xml
  108. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/method/normal_camelcase.xml
  109. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/method/normal_plain.xml
  110. +5 −0 ...sts/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/method/normal_underscore_start.xml
  111. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/method/underscore_middle.xml
  112. +5 −0 ...sts/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/method/underscore_start_public.xml
  113. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/property/capital_start.xml
  114. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/property/normal_camelcase.xml
  115. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/property/normal_plain.xml
  116. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/property/normal_underscore.xml
  117. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/property/underscore_absent.xml
  118. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/property/underscore_middle.xml
  119. +4 −0 ...s/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/property/underscore_start_public.xml
  120. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/variable/capital_start.xml
  121. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/variable/normal_camelcase.xml
  122. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/variable/normal_loop.xml
  123. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/variable/normal_plain.xml
  124. +5 −0 ...s/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/variable/short_name_in_long_loop.xml
  125. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/variable/underscore_middle.xml
  126. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/expected/naming/variable/underscore_start.xml
  127. +3 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/classes/brace_same_line.php
  128. +6 −0 ...atic/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/classes/brace_several_lines_below.php
  129. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/classes/brace_with_code.php
  130. +4 −0 ...tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/classes/brace_with_spaces.php
  131. +75 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/classes/normal_class.php
  132. +2 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/demarcation/asp_tag.php
  133. +1 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/demarcation/short_echo.php
  134. +2 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/demarcation/short_tag.php
  135. +4 −0 ...ts/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/function_usage/wrong_spacing.php
  136. +4 −0 ...atic/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/function_usage/wrong_spacing_ends.php
  137. +3 −0 ...tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/brace_same_line.php
  138. +7 −0 ...ic/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/brace_several_lines_below.php
  139. +4 −0 ...tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/brace_with_code.php
  140. +4 −0 ...sts/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/brace_with_spaces.php
  141. +7 −0 ...c/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/calltime_pass_by_reference.php
  142. +2 −0 ...suite/Php/Exemplar/_files/phpcs/input/coding_style/functions/calltime_pass_by_reference_mimic.php
  143. +20 −0 .../static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/method_without_scope.php
  144. +95 −0 .../testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/multiline_wrong_declaration.php
  145. +6 −0 .../static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/normal_arg_reference.php
  146. +34 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/normal_func.php
  147. +10 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/normal_lambda.php
  148. +17 −0 ...ts/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/functions/unneeded_multiline.php
  149. +4 −0 ...ests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/brace_double_space.php
  150. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/brace_next_line.php
  151. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/brace_no_space.php
  152. +3 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/braces_absent.php
  153. +3 −0 ...static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/closing_brace_same_line.php
  154. +6 −0 ...estsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/closing_brace_wrong_indentation.php
  155. +5 −0 ...atic/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/multiline_brace_same_line.php
  156. +6 −0 ...c/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/multiline_operator_same_line.php
  157. +8 −0 ...ic/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/multiline_wrong_indentation.php
  158. +12 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/normal.php
  159. +14 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/normal_multiline.php
  160. +4 −0 ...ts/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/parenthesis_no_space.php
  161. +4 −0 ...tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/wrong_indentation.php
  162. +60 −0 ...static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/wrong_spacing_operators.php
  163. +20 −0 ...estsuite/Php/Exemplar/_files/phpcs/input/coding_style/if_else/wrong_spacing_operators_logical.php
  164. +24 −0 ...s/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/inline_doc/format/wrong_align.php
  165. +25 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/inline_doc/normal.php
  166. +19 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/coding_style/switch/normal.php
  167. +3 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/general/closing_tag.php
  168. +7 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/general/closing_tag_middle.php
  169. +14 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/general/indentation.php
  170. +6 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/general/indentation_nonexact_code.php
  171. +13 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/general/indentation_nonexact_phpdoc.php
  172. +1 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/general/line_endings_cr.php
  173. +1 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/general/line_endings_crlf.php
  174. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/general/line_length.php
  175. +6 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/class/minuscule.php
  176. +6 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/class/one_word.php
  177. +6 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/class/two_capitals.php
  178. +6 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/class/two_underscores.php
  179. +6 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/class/underscore_start.php
  180. +7 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/constant/minuscule_letter.php
  181. +7 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/constant/normal_constant.php
  182. +3 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/function/capital_start.php
  183. +3 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/function/normal_camelcase.php
  184. +3 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/function/normal_plain.php
  185. +3 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/function/underscore_middle.php
  186. +3 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/function/underscore_start.php
  187. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/method/capital_start.php
  188. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/method/normal_camelcase.php
  189. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/method/normal_plain.php
  190. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/method/normal_underscore_start.php
  191. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/method/underscore_middle.php
  192. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/method/underscore_start_public.php
  193. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/property/capital_start.php
  194. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/property/normal_camelcase.php
  195. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/property/normal_plain.php
  196. +6 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/property/normal_underscore.php
  197. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/property/underscore_absent.php
  198. +5 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/property/underscore_middle.php
  199. +5 −0 ...ests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/property/underscore_start_public.php
  200. +2 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/variable/capital_start.php
  201. +2 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/variable/normal_camelcase.php
  202. +4 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/variable/normal_loop.php
  203. +2 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/variable/normal_plain.php
  204. +28 −0 ...ests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/variable/short_name_in_long_loop.php
  205. +2 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/variable/underscore_middle.php
  206. +2 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpcs/input/naming/variable/underscore_start.php
  207. +78 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/coupling.php
  208. +43 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/cyclomatic_complexity.php
  209. +33 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/descendant_count.php
  210. +29 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/field_count.php
  211. +15 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/inheritance_depth.php
  212. +116 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/method_count.php
  213. +108 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/method_length.php
  214. +40 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/naming.php
  215. +12 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/parameter_list.php
  216. +14 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/prohibited_statement.php
  217. +17 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/prohibited_statement_goto.php
  218. +58 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/public_count.php
  219. +13 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/input/unused.php
  220. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/coupling.xml
  221. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/cyclomatic_complexity.xml
  222. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/descendant_count.xml
  223. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/field_count.xml
  224. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/inheritance_depth.xml
  225. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/method_count.xml
  226. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/method_length.xml
  227. +35 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/naming.xml
  228. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/parameter_list.xml
  229. +11 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/prohibited_statement.xml
  230. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/prohibited_statement_goto.xml
  231. +8 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/public_count.xml
  232. +17 −0 dev/tests/static/testsuite/Php/Exemplar/_files/phpmd/output/unused.xml
  233. +108 −0 dev/tests/static/testsuite/Php/LiveCodeTest.php
  234. +7 −0 dev/tests/static/testsuite/Php/_files/blacklist/core.txt
  235. +55 −0 dev/tests/static/testsuite/Php/_files/phpcs/ruleset.xml
  236. +65 −0 dev/tests/static/testsuite/Php/_files/phpmd/ruleset.xml
  237. +18 −0 dev/tests/static/testsuite/Php/_files/whitelist/core.txt
  238. +71 −0 dev/tests/unit/framework/bootstrap.php
  239. +47 −0 dev/tests/unit/phpunit.xml.dist
  240. +37 −0 dev/tests/unit/testsuite/AllTests.php
  241. +41 −0 dev/tests/unit/testsuite/Magento/AllTests.php
  242. +32 −0 dev/tests/unit/testsuite/Magento/Autoload/Ns/TestClass.php
  243. +8 −8 _classmap.php → dev/tests/unit/testsuite/Magento/Autoload/TestClass.php
  244. +30 −0 dev/tests/unit/testsuite/Magento/Autoload/TestClassExists.php
  245. +30 −0 dev/tests/unit/testsuite/Magento/Autoload/TestClassMapInFile.php
  246. +35 −0 dev/tests/unit/testsuite/Magento/Autoload/TestMap.php
  247. +1 −0 dev/tests/unit/testsuite/Magento/Autoload/classmap.ser
  248. +124 −0 dev/tests/unit/testsuite/Magento/AutoloadTest.php
  249. +38 −0 dev/tests/unit/testsuite/Magento/Config/AllTests.php
  250. +135 −0 dev/tests/unit/testsuite/Magento/Config/DomTest.php
  251. +133 −0 dev/tests/unit/testsuite/Magento/Config/ThemeTest.php
  252. +73 −0 dev/tests/unit/testsuite/Magento/Config/ViewTest.php
  253. +58 −0 dev/tests/unit/testsuite/Magento/Config/XsdTest.php
  254. +33 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/ambiguous_merged.xml
  255. +33 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/ambiguous_new_one.xml
  256. +34 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/ambiguous_new_two.xml
  257. +33 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/ambiguous_one.xml
  258. +34 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/ambiguous_two.xml
  259. +40 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/ids.xml
  260. +43 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/ids_merged.xml
  261. +41 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/ids_new.xml
  262. +37 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/no_ids.xml
  263. +40 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/no_ids_merged.xml
  264. +40 −0 dev/tests/unit/testsuite/Magento/Config/_files/dom/no_ids_new.xml
  265. +39 −0 dev/tests/unit/testsuite/Magento/Config/_files/packages/default/default/theme.xml
  266. +39 −0 dev/tests/unit/testsuite/Magento/Config/_files/packages/default/test/theme.xml
  267. +39 −0 dev/tests/unit/testsuite/Magento/Config/_files/packages/default/test2/theme.xml
  268. +39 −0 dev/tests/unit/testsuite/Magento/Config/_files/packages/test/default/theme.xml
  269. +48 −0 dev/tests/unit/testsuite/Magento/Config/_files/sample.xsd
  270. +54 −0 dev/tests/unit/testsuite/Magento/Config/_files/theme_invalid.xml
  271. +37 −0 dev/tests/unit/testsuite/Magento/Config/_files/view_invalid.xml
  272. +36 −0 dev/tests/unit/testsuite/Magento/Config/_files/view_one.xml
  273. +39 −0 dev/tests/unit/testsuite/Magento/Config/_files/view_two.xml
  274. +36 −0 dev/tests/unit/testsuite/Magento/Convert/AllTests.php
  275. +147 −0 dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php
  276. +1 −0 dev/tests/unit/testsuite/Magento/Convert/_files/output.txt
  277. +113 −0 dev/tests/unit/testsuite/Magento/Crypt/_files/_cipher_info.php
  278. +299 −0 dev/tests/unit/testsuite/Magento/Crypt/_files/_crypt_fixtures.php
  279. +239 −0 dev/tests/unit/testsuite/Magento/CryptTest.php
  280. +37 −0 dev/tests/unit/testsuite/Magento/Profiler/AllTests.php
  281. +38 −0 dev/tests/unit/testsuite/Magento/Profiler/Output/AllTests.php
  282. +94 −0 dev/tests/unit/testsuite/Magento/Profiler/Output/CsvfileTest.php
  283. +112 −0 dev/tests/unit/testsuite/Magento/Profiler/Output/FirebugTest.php
  284. +73 −0 dev/tests/unit/testsuite/Magento/Profiler/Output/HtmlTest.php
  285. +215 −0 dev/tests/unit/testsuite/Magento/Profiler/OutputAbstractTest.php
  286. +43 −0 dev/tests/unit/testsuite/Magento/Profiler/_files/output.html
  287. +4 −0 dev/tests/unit/testsuite/Magento/Profiler/_files/output_custom.csv
  288. +4 −0 dev/tests/unit/testsuite/Magento/Profiler/_files/output_default.csv
  289. +65 −0 dev/tests/unit/testsuite/Magento/Profiler/_files/timers.php
Sorry, we could not display the entire diff because too many files (302) changed.
View
7 app/bootstrap.php
@@ -82,9 +82,12 @@
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'community';
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core';
$paths[] = BP . DS . 'lib';
+Magento_Autoload::getInstance()->addIncludePath($paths);
-Magento_Autoload::getInstance()->addIncludePath($paths)
- ->addFilesMap(BP . '/_classmap.php');
+$classMapPath = BP . DS . 'var/classmap.ser';
+if (file_exists($classMapPath)) {
+ Magento_Autoload::getInstance()->addFilesMap($classMapPath);
+}
#Magento_Profiler::enable();
#Magento_Profiler::registerOutput(new Magento_Profiler_Output_Html());
View
8 app/code/community/Phoenix/Moneybookers/etc/adminhtml.xml
@@ -13,9 +13,15 @@
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
* @category Phoenix
* @package Phoenix_Moneybookers
- * @copyright Copyright (c) 2009 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
+ * @copyright Copyright (c) 2011 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-->
View
14 app/code/core/Mage/Catalog/Model/Resource/Abstract.php
@@ -312,6 +312,20 @@ protected function _insertAttribute($object, $attribute, $value)
}
/**
+ * Update entity attribute value
+ *
+ * @param Varien_Object $object
+ * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
+ * @param mixed $valueId
+ * @param mixed $value
+ * @return Mage_Catalog_Model_Resource_Abstract
+ */
+ protected function _updateAttribute($object, $attribute, $valueId, $value)
+ {
+ return $this->_saveAttributeValue($object, $attribute, $value);
+ }
+
+ /**
* Update attribute value for specific store
*
* @param Mage_Catalog_Model_Abstract $object
View
2 app/code/core/Mage/Core/Model/Config.php
@@ -1241,7 +1241,7 @@ public function getHelperClassName($helperClass)
* Retrieve resource helper instance
*
* Example:
- * $config->getResourceHelper('Mage_Cms')
+ * $config->getResourceHelper('Mage_Core')
* will instantiate Mage_Cms_Model_Resource_Helper_<db_adapter_name>
*
* @param string $moduleName
View
1 app/code/core/Mage/Core/Model/Convert.php
@@ -31,7 +31,6 @@
* @package Mage_Core
* @author Magento Core Team <core@magentocommerce.com>
*/
-//class Mage_Core_Model_Convert extends Varien_Convert_Profile_Collection
class Mage_Core_Model_Convert extends Mage_Dataflow_Model_Convert_Profile_Collection
{
public function __construct()
View
10 ...e/core/Mage/Core/Model/Shell/Abstract.php → ...de/core/Mage/Core/Model/ShellAbstract.php
@@ -31,7 +31,7 @@
* @package Mage_Shell
* @author Magento Core Team <core@magentocommerce.com>
*/
-abstract class Mage_Core_Model_Shell_Abstract
+abstract class Mage_Core_Model_ShellAbstract
{
/**
* Raw arguments, that should be parsed
@@ -75,7 +75,7 @@ public function __construct($entryPoint)
* Sets raw arguments to be parsed
*
* @param array $args
- * @return Mage_Core_Model_Shell_Abstract
+ * @return Mage_Core_Model_ShellAbstract
*/
public function setRawArgs($args)
{
@@ -98,7 +98,7 @@ protected function _getRootPath()
/**
* Parses .htaccess file and apply php settings to shell script
*
- * @return Mage_Core_Model_Shell_Abstract
+ * @return Mage_Core_Model_ShellAbstract
*/
protected function _applyPhpVariables()
{
@@ -126,7 +126,7 @@ protected function _applyPhpVariables()
/**
* Parses input arguments
*
- * @return Mage_Core_Model_Shell_Abstract
+ * @return Mage_Core_Model_ShellAbstract
*/
protected function _parseArgs()
{
@@ -150,7 +150,7 @@ protected function _parseArgs()
/**
* Runs script
*
- * @return Mage_Core_Model_Shell_Abstract
+ * @return Mage_Core_Model_ShellAbstract
*/
abstract public function run();
View
2 app/code/core/Mage/Directory/Model/Resource/Currency.php
@@ -54,7 +54,7 @@ class Mage_Directory_Model_Resource_Currency extends Mage_Core_Model_Resource_Db
*/
protected function _construct()
{
- $this->_init('Mage_Directory_Model_Currency', 'currency_code');
+ $this->_init('directory_currency', 'currency_code');
$this->_currencyRateTable = $this->getTable('directory_currency_rate');
}
View
2 app/code/core/Mage/ImportExport/Model/Import.php
@@ -374,7 +374,7 @@ public function expandSource()
$count = self::MAX_IMPORT_CHUNKS;
for ($i = 1; $i < $count; $i++) {
$writer = Mage::getModel(
- 'importexport/export_adapter_csv',
+ 'Mage_ImportExport_Model_Export_Adapter_Csv',
self::getWorkingDir() . sprintf($filenameFormat, $i)
);
View
26 app/code/core/Mage/ImportExport/view/adminhtml/layout.xml
@@ -1,4 +1,30 @@
<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Mage
+ * @package Mage_ImportExport
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+ */
+-->
<layout>
<adminhtml_import_index>
<reference name="content">
View
2 app/code/core/Mage/Index/Model/Shell.php
@@ -31,7 +31,7 @@
* @package Mage_Shell
* @author Magento Core Team <core@magentocommerce.com>
*/
-class Mage_Index_Model_Shell extends Mage_Core_Model_Shell_Abstract
+class Mage_Index_Model_Shell extends Mage_Core_Model_ShellAbstract
{
/**
* Gets indexer instance
View
2 app/code/core/Mage/Log/Model/Shell.php
@@ -31,7 +31,7 @@
* @package Mage_Log
* @author Magento Core Team <core@magentocommerce.com>
*/
-class Mage_Log_Model_Shell extends Mage_Core_Model_Shell_Abstract
+class Mage_Log_Model_Shell extends Mage_Core_Model_ShellAbstract
{
/**
* Converts count to human view
View
2 app/code/core/Mage/XmlConnect/Block/Cart/Paypal/Mecl/Shippingmethods.php
@@ -43,7 +43,7 @@ protected function _toHtml()
{
/** @var $listXmlObj Mage_XmlConnect_Model_Simplexml_Element */
$methodListXmlObj = Mage::getModel(
- 'xmlconnect/simplexml_element',
+ 'Mage_XmlConnect_Model_Simplexml_Element',
'<shipping_method_list></shipping_method_list>'
);
View
2 app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php
@@ -106,7 +106,7 @@ protected function _toHtml()
$action = Mage::helper('Mage_XmlConnect_Helper_Data')->getActionUrl('xmlconnect/customer/saveaddress');
/** @var Mage_XmlConnect_Model_Simplexml_Form $fromXmlObj */
- $fromXmlObj = Mage::getModel('xmlconnect/simplexml_form', array(
+ $fromXmlObj = Mage::getModel('Mage_XmlConnect_Model_Simplexml_Form', array(
'xml_id' => 'address_form',
'action' => $action,
'use_container' => true
View
78 dev/tests/integration/framework/Magento/Test/TestCase/VisitorAbstract.php
@@ -1,78 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Magento
- * @package Test
- * @subpackage integration_tests
- * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * An ancestor class for tests, that visit many files, and where more visiting method can be added with time
- */
-abstract class Magento_Test_TestCase_VisitorAbstract extends PHPUnit_Framework_TestCase
-{
- /**
- * List of methods in this class, that are designed to check file content.
- * Filled automatically via reflection.
- *
- * @var array
- */
- protected $_visitorMethods = null;
-
- /**
- * Returns all methods in this class, that are designed to visit the file content.
- * Protected methods starting with '_visit' are considered to be visitor methods.
- *
- * @return array
- */
- protected function _getVisitorMethods()
- {
- if ($this->_visitorMethods === null) {
- $this->_visitorMethods = array();
- $reflection = new ReflectionClass($this);
- foreach ($reflection->getMethods(ReflectionMethod::IS_PROTECTED) as $method) {
- if (substr($method->name, 0, 6) == '_visit') {
- $this->_visitorMethods[] = $method->name;
- }
- }
- }
-
- return $this->_visitorMethods;
- }
-
- /**
- * Checks whether file path has required extension
- *
- * @param string|array $extensions
- * @return bool
- */
- protected function _fileHasExtensions($fileInfo, $extensions)
- {
- if (is_string($extensions)) {
- $extensions = array($extensions);
- }
-
- $fileExtension = pathinfo($fileInfo->getBasename(), PATHINFO_EXTENSION);
- $key = array_search($fileExtension, $extensions);
- return ($key !== false);
- }
-}
View
26 ...amework/tests/unit/testsuite/Magento/Test/Listener/_files/sample_fixture_two_rollback.php
@@ -1,2 +1,28 @@
<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Magento
+ * @package Magento
+ * @subpackage integration_tests
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
// Empty texture for test purpose
View
2 ...tegration/testsuite/Mage/Core/Model/_files/design/frontend/package/default/fallback.phtml
@@ -23,4 +23,4 @@
* @subpackage integration_tests
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
- */
+ */
View
2 ...estsuite/Mage/Core/Model/_files/design/frontend/package/default/skin/access_violation.php
@@ -23,4 +23,4 @@
* @subpackage integration_tests
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
+ */
View
87 dev/tests/integration/testsuite/integrity/ConfigTest.php
@@ -1,87 +0,0 @@
-<?php
-/**
- * Integrity test for configuration (config.xml)
- *
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category tests
- * @package integration
- * @subpackage integrity
- * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-class Integrity_ConfigTest extends PHPUnit_Framework_TestCase
-{
- /**
- * The node 'config/global/fieldsets' had been relocated from config.xml to fieldset.xml
- *
- * @param string $path
- * @dataProvider fieldsetsRemovalDataProvider
- */
- public function testFieldsetsRemoval($path)
- {
- $this->assertFalse(Mage::getConfig()->getNode($path));
- $config = new Mage_Core_Model_Config_Fieldset;
- $this->assertInstanceOf('Mage_Core_Model_Config_Element', $config->getNode($path));
- }
-
- public function fieldsetsRemovalDataProvider()
- {
- return array(array('global/fieldsets'), array('admin/fieldsets'));
- }
-
- /**
- * The "deprecated node" feature had been removed
- */
- public function testDeprecatedNodeRemoval()
- {
- $this->assertSame(array(), Mage::getConfig()->getNode()->xpath('/config/global/models/*/deprecatedNode'));
- }
-
- /**
- * Verification that there no table definition in configuration
- */
- public function testTableDefinitionRemoval()
- {
- $this->assertSame(array(), Mage::getConfig()->getNode()->xpath('/config/global/models/*/entities/*/table'));
- }
-
- /**
- * @dataProvider classPrefixRemovalDataProvider
- */
- public function testClassPrefixRemoval($classType)
- {
- $this->assertSame(array(), Mage::getConfig()->getNode()->xpath("/config/global/{$classType}s/*/class"));
- }
-
- public function classPrefixRemovalDataProvider()
- {
- return array(
- array('model'),
- array('helper'),
- array('block'),
- );
- }
-
- public function testResourceModelMappingRemoval()
- {
- $this->assertSame(array(), Mage::getConfig()->getNode()->xpath('/config/global/models/*/resourceModel'));
- }
-}
View
4 dev/tests/static/.gitignore
@@ -0,0 +1,4 @@
+*.xml
+framework/tests/unit/*.xml
+report/
+tmp/
View
107 dev/tests/static/framework/Inspection/CodeSniffer/Command.php
@@ -0,0 +1,107 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Magento
+ * @package Magento
+ * @subpackage static_tests
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+/**
+ * PHP Code Sniffer shell command
+ */
+class Inspection_CodeSniffer_Command extends Inspection_CommandAbstract
+{
+ /**
+ * @var string
+ */
+ protected $_rulesetDir;
+
+ /**
+ * @var array
+ */
+ protected $_extensions = array();
+
+ /**
+ * Constructor
+ *
+ * @param string $rulesetDir Directory that locates the inspection rules
+ * @param string $reportFile Destination file to write inspection report to
+ */
+ public function __construct($rulesetDir, $reportFile)
+ {
+ parent::__construct($reportFile);
+ $this->_rulesetDir = $rulesetDir;
+ }
+
+ /**
+ * Limit scanning folders by file extensions
+ *
+ * Array of alphanumeric strings, for example: 'php', 'xml', 'phtml', 'css'...
+ *
+ * @param array $extensions
+ * @return Inspection_CodeSniffer_Command
+ */
+ public function setExtensions(array $extensions)
+ {
+ $this->_extensions = $extensions;
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function _buildVersionShellCmd()
+ {
+ return 'phpcs --version';
+ }
+
+ /**
+ * @param array $whiteList
+ * @param array $blackList
+ * @return string
+ */
+ protected function _buildShellCmd($whiteList, $blackList)
+ {
+ $whiteList = array_map('escapeshellarg', $whiteList);
+ $whiteList = implode(' ', $whiteList);
+
+ /* Note: phpcs allows regular expressions for the ignore list */
+ $blackListStr = '';
+ if ($blackList) {
+ foreach ($blackList as $fileOrDir) {
+ $fileOrDir = str_replace('/', DIRECTORY_SEPARATOR, $fileOrDir);
+ $blackListStr .= ($blackListStr ? ',' : '') . preg_quote($fileOrDir);
+ }
+ $blackListStr = '--ignore=' . escapeshellarg($blackListStr);
+ }
+
+ return 'phpcs'
+ . ($blackListStr ? ' ' . $blackListStr : '')
+ . ' --standard=' . escapeshellarg($this->_rulesetDir)
+ . ' --report=checkstyle'
+ . ($this->_extensions ? ' --extensions=' . implode(',', $this->_extensions) : '')
+ . ' --report-file=' . escapeshellarg($this->_reportFile)
+ . ' -n'
+ . ' ' . $whiteList
+ ;
+ }
+}
View
124 dev/tests/static/framework/Inspection/CommandAbstract.php
@@ -0,0 +1,124 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Magento
+ * @package Magento
+ * @subpackage static_tests
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+/**
+ * Abstract shell command for the static code inspection
+ */
+abstract class Inspection_CommandAbstract
+{
+ /**
+ * @var string
+ */
+ protected $_reportFile;
+
+ /**
+ * Constructor
+ *
+ * @param string $reportFile Destination file to write inspection report to
+ */
+ public function __construct($reportFile)
+ {
+ $this->_reportFile = $reportFile;
+ }
+
+ /**
+ * Build and execute the shell command
+ *
+ * @param array $whiteList Files/directories to be inspected
+ * @param array $blackList Files/directories to be excluded from the inspection
+ * @return bool
+ */
+ public function run(array $whiteList, array $blackList = array())
+ {
+ $shellCmd = $this->_buildShellCmd($whiteList, $blackList);
+ return $this->_execShellCmd($shellCmd);
+ }
+
+ /**
+ * Whether the command can be ran on the current environment
+ *
+ * @return bool
+ */
+ public function canRun()
+ {
+ return $this->_execShellCmd($this->_buildVersionShellCmd());
+ }
+
+ /**
+ * Retrieve the shell command version
+ *
+ * @return string|null
+ */
+ public function getVersion()
+ {
+ if (!$this->_execShellCmd($this->_buildVersionShellCmd(), $versionOutput)) {
+ return null;
+ }
+ $versionOutput = implode("\n", $versionOutput);
+ return (preg_match('/[^\d]*([^\s]+)/', $versionOutput, $matches) ? $matches[1] : $versionOutput);
+ }
+
+ /**
+ * Get path to the report file
+ *
+ * @return string
+ */
+ public function getReportFile()
+ {
+ return $this->_reportFile;
+ }
+
+ /**
+ * Build the shell command that outputs the version
+ *
+ * @return string
+ */
+ abstract protected function _buildVersionShellCmd();
+
+ /**
+ * Build the valid shell command
+ *
+ * @param array $whiteList
+ * @param array $blackList
+ * @return string
+ */
+ abstract protected function _buildShellCmd($whiteList, $blackList);
+
+ /**
+ * Execute the shell command on the current environment
+ *
+ * @param string $shellCmd
+ * @param array $output
+ * @return bool
+ */
+ protected function _execShellCmd($shellCmd, array &$output = null)
+ {
+ $output = array();
+ exec($shellCmd . ' 2>&1', $output, $exitCode);
+ return ($exitCode === 0);
+ }
+}
View
131 dev/tests/static/framework/Inspection/CopyPasteDetector/Command.php
@@ -0,0 +1,131 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Magento
+ * @package Magento
+ * @subpackage static_tests
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+/**
+ * PHP Copy/Paste Detector shell command
+ */
+class Inspection_CopyPasteDetector_Command extends Inspection_CommandAbstract
+{
+ /**
+ * @var int|null
+ */
+ protected $_minLines;
+
+ /**
+ * @var int|null
+ */
+ protected $_minTokens;
+
+ /**
+ * Constructor
+ *
+ * @param string $reportFile Destination file to write inspection report to
+ * @param int|null $minLines Minimum number of identical lines
+ * @param int|null $minTokens Minimum number of identical tokens
+ */
+ public function __construct($reportFile, $minLines = null, $minTokens = null)
+ {
+ parent::__construct($reportFile);
+ $this->_minLines = $minLines;
+ $this->_minTokens = $minTokens;
+ }
+
+ /**
+ * @return string
+ */
+ public function _buildVersionShellCmd()
+ {
+ return 'phpcpd --version';
+ }
+
+ /**
+ * @param array $whiteList
+ * @param array $blackList
+ * @return string
+ */
+ protected function _buildShellCmd($whiteList, $blackList)
+ {
+ $whiteList = array_map('escapeshellarg', $whiteList);
+ $whiteList = implode(' ', $whiteList);
+
+ if ($blackList) {
+ $blackList = array_map('escapeshellarg', $blackList);
+ $blackList = '--exclude ' . implode(' --exclude ', $blackList);
+ } else {
+ $blackList = '';
+ }
+
+ return 'phpcpd'
+ . ' --log-pmd ' . escapeshellarg($this->_reportFile)
+ . ($blackList ? ' ' . $blackList : '')
+ . ($this->_minLines ? ' --min-lines ' . $this->_minLines : '')
+ . ($this->_minTokens ? ' --min-tokens ' . $this->_minTokens : '')
+ . ' ' . $whiteList
+ ;
+ }
+
+ /**
+ * Runs command and produces report in html format
+ *
+ * @param array $whiteList
+ * @param array $blackList
+ * @return bool
+ */
+ public function run(array $whiteList, array $blackList = array())
+ {
+ $result = parent::run($whiteList, $blackList);
+ if ($result) {
+ $generateHtmlResult = $this->_generateHtmlReport();
+ if ($generateHtmlResult === false) {
+ $result = false;
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Under Unix platform creates one more report in html-format.
+ * The report is generated based on already existing report in xml format and XSLT conversion scheme
+ * in "html_report.xslt". Returns null, if conversion tool was not found, otherwise returns true/false as a result
+ * of conversion tool execution.
+ *
+ * @return bool|null
+ */
+ protected function _generateHtmlReport()
+ {
+ $isWindows = strncasecmp(PHP_OS, 'win', 3) == 0;
+ if ($isWindows) {
+ return null;
+ }
+ if (!$this->_execShellCmd('xsltproc --version')) {
+ return null;
+ }
+ $xsltFile = __DIR__ . '/html_report.xslt';
+ $result = $this->_execShellCmd("xsltproc {$xsltFile} {$this->_reportFile} > {$this->_reportFile}.html");
+ return $result;
+ }
+}
View
98 dev/tests/static/framework/Inspection/CopyPasteDetector/html_report.xslt
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Stylesheet to turn the XML output of CPD into a nice-looking HTML page -->
+<!-- $Id: cpdhtml.xslt 461 2008-04-21 10:20:34Z mplesser $ -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd" indent="yes"/>
+
+<xsl:template match="pmd-cpd">
+<html>
+ <head>
+ <script type="text/javascript">
+ function toggleCodeSection(btn, id)
+ {
+ area = document.getElementById(id);
+ if (area.style.display == 'none')
+ {
+ btn.innerHTML = '-';
+ area.style.display = 'inline';
+ }
+ else
+ {
+ btn.innerHTML = '+';
+ area.style.display = 'none';
+ }
+ }
+ </script>
+ <style>
+ .SummaryTitle { }
+ .SummaryNumber { background-color:#DDDDDD; text-align: center; }
+ .ItemNumber { background-color: #DDDDDD; }
+ .CodeFragment { background-color: #BBBBBB; display:none; font:normal normal normal 9pt Courier; }
+ .ExpandButton { background-color: #FFFFFF; font-size: 8pt; width: 20px; height: 20px; margin:0px; }
+ </style>
+ </head>
+<body>
+ <h2>Summary of duplicated code</h2>
+ This page summarizes the code fragments that have been found to be replicated in the code.
+ Only those fragments longer than 30 lines of code are shown.
+ <p/>
+ <table border="1" class="summary" cellpadding="2">
+ <tr style="background-color:#CCCCCC;">
+ <th># duplications</th>
+ <th>Total lines</th>
+ <th>Total tokens</th>
+ <th>Approx # bytes</th>
+ </tr>
+ <tr>
+ <td class="SummaryNumber"><xsl:value-of select="count(//duplication[@lines>30])"/></td>
+ <td class="SummaryNumber"><xsl:value-of select="sum(//duplication[@lines>30]/@lines)"/></td>
+ <td class="SummaryNumber"><xsl:value-of select="sum(//duplication[@lines>30]/@tokens)"/></td>
+ <td class="SummaryNumber"><xsl:value-of select="sum(//duplication[@lines>30]/@tokens) * 4"/></td>
+ </tr>
+ </table>
+ <p/>
+ You expand and collapse the code fragments using the + buttons. You can also navigate to the source code by clicking
+ on the file names.
+ <p/>
+ <table>
+ <tr style="background-color: #444444; color: #DDDDDD;"><td>ID</td><td>Files</td><td>Lines</td></tr>
+ <xsl:for-each select="//duplication[@lines>30]">
+ <xsl:sort data-type="number" order="descending" select="@lines"/>
+ <tr>
+ <td class="ItemNumber"><xsl:value-of select="position()"/></td>
+ <td>
+ <table>
+ <xsl:for-each select="file">
+ <tr><td><a><xsl:attribute name="href">../src/<xsl:value-of select="@path"/>.html#<xsl:value-of select="@line"/></xsl:attribute><xsl:value-of select="@path"/></a></td><td> line <xsl:value-of select="@line"/></td></tr>
+ </xsl:for-each>
+ </table>
+ </td>
+ <td># lines : <xsl:value-of select="@lines"/></td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td colspan="2" valign="top">
+ <table><tr>
+ <td valign="top">
+ <button class="ExpandButton" ><xsl:attribute name="onclick">blur(); toggleCodeSection(this, 'frag_<xsl:value-of select="position()"/>')</xsl:attribute>+</button>
+ </td>
+ <td>
+ <textarea cols="100" rows="30" wrap="off" class='CodeFragment' style='display:none;'>
+ <xsl:attribute name="id">frag_<xsl:value-of select="position()"/></xsl:attribute>
+ <xsl:value-of select="codefragment"/>
+ </textarea>
+ </td>
+ </tr></table>
+ </td>
+ </tr>
+ <tr><td colspan="2"><hr/></td></tr>
+ </xsl:for-each>
+ </table>
+
+
+</body>
+</html>
+</xsl:template>
+
+</xsl:stylesheet>
View
95 dev/tests/static/framework/Inspection/MessDetector/Command.php
@@ -0,0 +1,95 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Magento
+ * @package Magento
+ * @subpackage static_tests
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+/**
+ * PHP Mess Detector shell command
+ */
+class Inspection_MessDetector_Command extends Inspection_CommandAbstract
+{
+ /**
+ * @var string
+ */
+ protected $_rulesetFile;
+
+ /**
+ * Constructor
+ *
+ * @param string $rulesetFile File that declares the inspection rules
+ * @param string $reportFile Destination file to write inspection report to
+ */
+ public function __construct($rulesetFile, $reportFile)
+ {
+ parent::__construct($reportFile);
+ $this->_rulesetFile = $rulesetFile;
+ }
+
+ /**
+ * Get path to the ruleset file
+ *
+ * @return string
+ */
+ public function getRulesetFile()
+ {
+ return $this->_rulesetFile;
+ }
+
+ /**
+ * @return string
+ */
+ public function _buildVersionShellCmd()
+ {
+ return 'phpmd --version';
+ }
+
+ /**
+ * @param array $whiteList
+ * @param array $blackList
+ * @return string
+ */
+ protected function _buildShellCmd($whiteList, $blackList)
+ {
+ $whiteList = implode(',', $whiteList);
+ $whiteList = escapeshellarg($whiteList);
+
+ $blackListStr = '';
+ if ($blackList) {
+ foreach ($blackList as $fileOrDir) {
+ $fileOrDir = str_replace('/', DIRECTORY_SEPARATOR, $fileOrDir);
+ $blackListStr .= ($blackListStr ? ',' : '') . $fileOrDir;
+ }
+ $blackListStr = '--exclude ' . escapeshellarg($blackListStr);
+ }
+
+ return 'phpmd'
+ . ' ' . $whiteList
+ . ' xml'
+ . ' ' . escapeshellarg($this->_rulesetFile)
+ . ($blackListStr ? ' ' . $blackListStr : '')
+ . ' --reportfile ' . escapeshellarg($this->_reportFile)
+ ;
+ }
+}
View
41 dev/tests/static/framework/bootstrap.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Magento
+ * @package Magento
+ * @subpackage static_tests
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+if (!defined('PATH_TO_SOURCE_CODE')) {
+ define('PATH_TO_SOURCE_CODE', realpath(dirname(__FILE__) . '/../../../..'));
+}
+
+$includePath = array(
+ __DIR__,
+ dirname(__DIR__) . '/testsuite',
+ get_include_path()
+);
+set_include_path(implode(PATH_SEPARATOR, $includePath));
+
+spl_autoload_register(function ($class) {
+ $file = str_replace('_', '/', $class) . '.php';
+ require_once $file;
+});
View
37 dev/tests/static/framework/tests/unit/phpunit.xml.dist
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Magento
+ * @package unit_tests
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+ */
+-->
+<phpunit bootstrap="../../bootstrap.php">
+ <testsuites>
+ <testsuite name="Magento Unit Tests for Static Code Analysis Framework">
+ <directory suffix="Test.php">testsuite</directory>
+ </testsuite>
+ </testsuites>
+ <php>
+ <ini name="date.timezone" value="America/Los_Angeles"/>
+ </php>
+</phpunit>
View
126 dev/tests/static/framework/tests/unit/testsuite/Inspection/CodeSniffer/CommandTest.php
@@ -0,0 +1,126 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Magento
+ * @package Magento
+ * @subpackage static_tests
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+class Inspection_CodeSniffer_CommandTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @var Inspection_CodeSniffer_Command|PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $_cmd;
+
+ protected function setUp()
+ {
+ $this->_cmd = $this->getMock(
+ 'Inspection_CodeSniffer_Command',
+ array('_execShellCmd'),
+ array('some/ruleset/dir', 'some/report/file.xml')
+ );
+ }
+
+ /**
+ * @dataProvider canRunDataProvider
+ */
+ public function testCanRun($expectedResult)
+ {
+ $this->_cmd
+ ->expects($this->once())
+ ->method('_execShellCmd')
+ ->with($this->stringContains('phpcs'))
+ ->will($this->returnValue($expectedResult))
+ ;
+ $this->assertEquals($expectedResult, $this->_cmd->canRun());
+ }
+
+ public function canRunDataProvider()
+ {
+ return array(
+ 'success' => array(true),
+ 'failure' => array(false),
+ );
+ }
+
+ /**
+ * @dataProvider getVersionDataProvider
+ */
+ public function testGetVersion($versionCmdOutput, $expectedVersion)
+ {
+ $cmdCallback = function ($shellCmd, array &$output = null) use ($versionCmdOutput)
+ {
+ $output = array($versionCmdOutput);
+ return !empty($shellCmd);
+ };
+ $this->_cmd
+ ->expects($this->once())
+ ->method('_execShellCmd')
+ ->with($this->stringContains('phpcs'))
+ ->will($this->returnCallback($cmdCallback))
+ ;
+ $this->assertEquals($expectedVersion, $this->_cmd->getVersion());
+ }
+
+ public function getVersionDataProvider()
+ {
+ return array(
+ array('PHP_CodeSniffer version 1.3.0RC2 (beta) by Squiz Pty Ltd. (http://www.squiz.net)', '1.3.0RC2'),
+ array('PHP_CodeSniffer version 1.3.0 (stable) by Squiz Pty Ltd. (http://www.squiz.net)', '1.3.0'),
+ );
+ }
+
+ public function testRun()
+ {
+ $expectedQuoteChar = substr(escapeshellarg(' '), 0, 1);
+ $expectedCmd = 'phpcs'
+ . ' --standard="some/ruleset/dir"'
+ . ' --report=checkstyle'
+ . ' --report-file="some/report/file.xml"'
+ . ' -n'
+ . ' "some/test/dir with space"'
+ . ' "some/test/file with space.php"'
+ ;
+ $expectedCmd = str_replace('"', $expectedQuoteChar, $expectedCmd);
+ $this->_cmd
+ ->expects($this->once())
+ ->method('_execShellCmd')
+ ->with($expectedCmd)
+ ;
+ $this->_cmd->run(array('some/test/dir with space', 'some/test/file with space.php'));
+ }
+
+ /**
+ * @depends testRun
+ */
+ public function testRunWithExtensions()
+ {
+ $this->assertSame($this->_cmd, $this->_cmd->setExtensions(array('txt', 'xml')));
+ $this->_cmd
+ ->expects($this->once())
+ ->method('_execShellCmd')
+ ->with($this->stringContains(' --extensions=txt,xml '))
+ ;
+ $this->_cmd->run(array());
+ }
+}
View
109 dev/tests/static/framework/tests/unit/testsuite/Inspection/CopyPasteDetector/CommandTest.php
@@ -0,0 +1,109 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Magento
+ * @package Magento
+ * @subpackage static_tests
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+class Inspection_CopyPasteDetector_CommandTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @var Inspection_CopyPasteDetector_Command|PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $_cmd;
+
+ protected function setUp()
+ {
+ $this->_cmd = $this->getMock(
+ 'Inspection_CopyPasteDetector_Command',
+ array('_execShellCmd'),
+ array('some/report/file.xml', 5, 50)
+ );
+ }
+
+ public function canTestDataProvider()
+ {
+ return array(
+ 'success' => array(true),
+ 'failure' => array(false),
+ );
+ }
+
+ /**
+ * @dataProvider canTestDataProvider
+ */
+ public function testCanRun($expectedResult)
+ {
+ $this->_cmd
+ ->expects($this->once())
+ ->method('_execShellCmd')
+ ->with($this->stringContains('phpcpd'))
+ ->will($this->returnValue($expectedResult))
+ ;
+ $this->assertEquals($expectedResult, $this->_cmd->canRun());
+ }
+
+ public function getVersionDataProvider()
+ {
+ return array(
+ array('phpcpd 1.3.2 by Sebastian Bergmann.', '1.3.2'),
+ );
+ }
+
+ /**
+ * @dataProvider getVersionDataProvider
+ */
+ public function testGetVersion($versionCmdOutput, $expectedVersion)
+ {
+ $cmdCallback = function ($shellCmd, array &$output = null) use ($versionCmdOutput)
+ {
+ $output = array($versionCmdOutput);
+ return !empty($shellCmd);
+ };
+ $this->_cmd
+ ->expects($this->once())
+ ->method('_execShellCmd')
+ ->with($this->stringContains('phpcpd'))
+ ->will($this->returnCallback($cmdCallback))
+ ;
+ $this->assertEquals($expectedVersion, $this->_cmd->getVersion());
+ }
+
+ public function testRun()
+ {
+ $expectedQuoteChar = substr(escapeshellarg(' '), 0, 1);
+ $expectedCmd = 'phpcpd'
+ . ' --log-pmd "some/report/file.xml"'
+ . ' --min-lines 5'
+ . ' --min-tokens 50'
+ . ' "some/test/dir with space" "some/test/file with space.php"'
+ ;
+ $expectedCmd = str_replace('"', $expectedQuoteChar, $expectedCmd);
+ $this->_cmd
+ ->expects($this->once())
+ ->method('_execShellCmd')
+ ->with($expectedCmd)
+ ;
+ $this->_cmd->run(array('some/test/dir with space', 'some/test/file with space.php'));
+ }
+}
View
115 dev/tests/static/framework/tests/unit/testsuite/Inspection/MessDetector/CommandTest.php
@@ -0,0 +1,115 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Magento
+ * @package Magento
+ * @subpackage static_tests
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+class Inspection_MessDetector_CommandTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @var Inspection_MessDetector_Command|PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $_cmd;
+
+ protected function setUp()
+ {
+ $this->_cmd = $this->getMock(
+ 'Inspection_MessDetector_Command',
+ array('_execShellCmd'),
+ array('some/ruleset/file.xml', 'some/report/file.xml')
+ );
+ }
+
+ public function testGetRulesetFile()
+ {
+ $this->assertEquals('some/ruleset/file.xml', $this->_cmd->getRulesetFile());
+ }
+
+ /**
+ * @dataProvider canTestDataProvider
+ */
+ public function testCanRun($expectedResult)
+ {
+ $this->_cmd
+ ->expects($this->once())
+ ->method('_execShellCmd')
+ ->with($this->stringContains('phpmd'))
+ ->will($this->returnValue($expectedResult))
+ ;
+ $this->assertEquals($expectedResult, $this->_cmd->canRun());
+ }
+
+ public function canTestDataProvider()
+ {
+ return array(
+ 'success' => array(true),
+ 'failure' => array(false),
+ );
+ }
+
+ public function getVersionDataProvider()
+ {
+ return array(
+ array('PHPMD 0.2.8RC1 by Manuel Pichler', '0.2.8RC1'),
+ array('PHPMD 1.1.1 by Manuel Pichler', '1.1.1'),
+ );
+ }
+
+ /**
+ * @dataProvider getVersionDataProvider
+ */
+ public function testGetVersion($versionCmdOutput, $expectedVersion)
+ {
+ $cmdCallback = function ($shellCmd, array &$output = null) use ($versionCmdOutput)
+ {
+ $output = array($versionCmdOutput);
+ return !empty($shellCmd);
+ };
+ $this->_cmd
+ ->expects($this->once())
+ ->method('_execShellCmd')
+ ->with($this->stringContains('phpmd'))
+ ->will($this->returnCallback($cmdCallback))
+ ;
+ $this->assertEquals($expectedVersion, $this->_cmd->getVersion());
+ }
+
+ public function testRun()
+ {
+ $expectedQuoteChar = substr(escapeshellarg(' '), 0, 1);
+ $expectedCmd = 'phpmd'
+ . ' "some/test/dir with space,some/test/file with space.php"'
+ . ' xml'
+ . ' "some/ruleset/file.xml"'
+ . ' --reportfile "some/report/file.xml"'
+ ;
+ $expectedCmd = str_replace('"', $expectedQuoteChar, $expectedCmd);
+ $this->_cmd
+ ->expects($this->once())
+ ->method('_execShellCmd')
+ ->with($expectedCmd)
+ ;
+ $this->_cmd->run(array('some/test/dir with space', 'some/test/file with space.php'));
+ }
+}
View
39 dev/tests/static/phpunit-all.xml.dist
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Run all available test suites
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category tests
+ * @package static
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+ */
+-->
+<phpunit bootstrap="./framework/bootstrap.php">
+ <testsuites>
+ <testsuite name="All Static Code Analysis Tests">
+ <directory>testsuite</directory>
+ </testsuite>
+ </testsuites>
+ <php>
+ <ini name="date.timezone" value="America/Los_Angeles"/>
+ </php>
+</phpunit>
View
42 dev/tests/static/phpunit.xml.dist
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Default test suites declaration: run verification of coding standards and code integrity test suites
+ *
+ * Magento
+ *