PageRenderTime 50ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/dev/tests/static/testsuite/Legacy/FilesystemTest.php

https://bitbucket.org/sunil_nextbits/magento2
PHP | 83 lines | 46 code | 5 blank | 32 comment | 3 complexity | 699ea1def291b5cdb897a60415d63c1a MD5 | raw file
  1. <?php
  2. /**
  3. * Backwards-incompatible changes in file system
  4. *
  5. * Magento
  6. *
  7. * NOTICE OF LICENSE
  8. *
  9. * This source file is subject to the Open Software License (OSL 3.0)
  10. * that is bundled with this package in the file LICENSE.txt.
  11. * It is also available through the world-wide-web at this URL:
  12. * http://opensource.org/licenses/osl-3.0.php
  13. * If you did not receive a copy of the license and are unable to
  14. * obtain it through the world-wide-web, please send an email
  15. * to license@magentocommerce.com so we can send you a copy immediately.
  16. *
  17. * DISCLAIMER
  18. *
  19. * Do not edit or add to this file if you wish to upgrade Magento to newer
  20. * versions in the future. If you wish to customize Magento for your
  21. * needs please refer to http://www.magentocommerce.com for more information.
  22. *
  23. * @category tests
  24. * @package static
  25. * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
  26. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  27. */
  28. class Legacy_FilesystemTest extends PHPUnit_Framework_TestCase
  29. {
  30. /**
  31. * Directories may re-appear again during merging, therefore ensure they were properly relocated
  32. *
  33. * @param string $path
  34. * @dataProvider relocationsDataProvider
  35. */
  36. public function testRelocations($path)
  37. {
  38. $this->assertFileNotExists(Utility_Files::init()->getPathToSource() . DIRECTORY_SEPARATOR . $path);
  39. }
  40. public function relocationsDataProvider()
  41. {
  42. return array(
  43. 'Relocated to pub/errors' => array('errors'),
  44. 'Eliminated with Mage_Compiler' => array('includes'),
  45. 'Relocated to pub/lib' => array('js'),
  46. 'Relocated to pub/media' => array('media'),
  47. 'Eliminated as not needed' => array('pkginfo'),
  48. 'Dissolved into themes under app/design ' => array('skin'),
  49. 'Dissolved into different modules\' view/frontend' => array('app/design/frontend/base'),
  50. 'Dissolved into different modules\' view/email/*.html' => array('app/locale/en_US/template'),
  51. );
  52. }
  53. public function testObsoleteDirectories()
  54. {
  55. $area = '*';
  56. $package = '*';
  57. $theme = '*';
  58. $root = Utility_Files::init()->getPathToSource();
  59. $dirs = glob("{$root}/app/design/{$area}/{$package}/{$theme}/template", GLOB_ONLYDIR);
  60. $msg = array();
  61. if ($dirs) {
  62. $msg[] = 'Theme "template" directories are obsolete. Relocate files as follows:';
  63. foreach ($dirs as $dir) {
  64. $msg[] = str_replace($root, '',
  65. "{$dir} => " . realpath($dir . '/..') . '/Namespace_Module/*'
  66. );
  67. }
  68. }
  69. $dirs = glob("{$root}/app/design/{$area}/{$package}/{$theme}/layout", GLOB_ONLYDIR);
  70. if ($dirs) {
  71. $msg[] = 'Theme "layout" directories are obsolete. Relocate layout files into the root of theme directory.';
  72. $msg = array_merge($msg, $dirs);
  73. }
  74. if ($msg) {
  75. $this->fail(implode(PHP_EOL, $msg));
  76. }
  77. }
  78. }