PageRenderTime 47ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/dev/tests/integration/testsuite/Mage/DesignEditor/Model/History/CompactTest.php

https://bitbucket.org/sunil_nextbits/magento2
PHP | 135 lines | 83 code | 6 blank | 46 comment | 0 complexity | bcd149cd44d962b4ccbd2614ff93a352 MD5 | raw file
  1. <?php
  2. /**
  3. * Magento
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@magentocommerce.com so we can send you a copy immediately.
  14. *
  15. * DISCLAIMER
  16. *
  17. * Do not edit or add to this file if you wish to upgrade Magento to newer
  18. * versions in the future. If you wish to customize Magento for your
  19. * needs please refer to http://www.magentocommerce.com for more information.
  20. *
  21. * @category Magento
  22. * @package Mage_DesignEditor
  23. * @subpackage integration_tests
  24. * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
  25. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  26. */
  27. class Mage_DesignEditor_Model_History_CompactTest extends PHPUnit_Framework_TestCase
  28. {
  29. /**
  30. * @var Mage_DesignEditor_Model_History
  31. */
  32. protected $_historyObject;
  33. /**
  34. * Prepare history object
  35. *
  36. * @return Mage_Core_Model_Abstract
  37. */
  38. public function setUp()
  39. {
  40. return $this->_historyObject = Mage::getModel('Mage_DesignEditor_Model_History');
  41. }
  42. /**
  43. * Test compact
  44. *
  45. * @dataProvider getChanges
  46. */
  47. public function testCompact($changes, $compactResult)
  48. {
  49. /** @var $historyCompactModel Mage_DesignEditor_Model_History_Compact */
  50. $historyCompactModel = Mage::getModel('Mage_DesignEditor_Model_History_Compact');
  51. /** @var $collection Mage_DesignEditor_Model_Change_Collection */
  52. $collection = $this->_historyObject->setChanges($changes)->getChanges();
  53. $historyCompactModel->compact($collection);
  54. $this->assertEquals($compactResult, $collection->toArray());
  55. }
  56. /**
  57. * Get changes
  58. *
  59. * @return array
  60. */
  61. public function getChanges()
  62. {
  63. return array(array(
  64. array(
  65. array(
  66. 'handle' => 'catalog_category_view',
  67. 'type' => 'layout',
  68. 'element_name' => 'category.products',
  69. 'action_name' => 'move',
  70. 'destination_container' => 'content',
  71. 'destination_order' => '-',
  72. 'origin_container' => 'top.menu',
  73. 'origin_order' => '-'
  74. ),
  75. array(
  76. 'handle' => 'catalog_category_view',
  77. 'type' => 'layout',
  78. 'element_name' => 'category.products',
  79. 'action_name' => 'move',
  80. 'destination_container' => 'right',
  81. 'destination_order' => '-',
  82. 'origin_container' => 'content',
  83. 'origin_order' => '-'
  84. ),
  85. array(
  86. 'handle' => 'customer_account',
  87. 'type' => 'layout',
  88. 'element_name' => 'customer_account_navigation',
  89. 'action_name' => 'move',
  90. 'destination_container' => 'content',
  91. 'destination_order' => '-',
  92. 'origin_container' => 'right',
  93. 'origin_order' => '-'
  94. ),
  95. array(
  96. 'handle' => 'customer_account',
  97. 'type' => 'layout',
  98. 'element_name' => 'customer_account_navigation',
  99. 'action_name' => 'remove',
  100. ),
  101. array(
  102. 'handle' => 'customer_account',
  103. 'type' => 'layout',
  104. 'element_name' => 'customer_account_navigation',
  105. 'action_name' => 'remove',
  106. ),
  107. ),
  108. /** Expected result for compact */
  109. array(
  110. array(
  111. 'handle' => 'catalog_category_view',
  112. 'type' => 'layout',
  113. 'element_name' => 'category.products',
  114. 'action_name' => 'move',
  115. 'destination_container' => 'right',
  116. 'destination_order' => '-',
  117. 'origin_container' => 'content',
  118. 'origin_order' => '-'
  119. ),
  120. array(
  121. 'handle' => 'customer_account',
  122. 'type' => 'layout',
  123. 'element_name' => 'customer_account_navigation',
  124. 'action_name' => 'remove',
  125. ),
  126. )
  127. ));
  128. }
  129. }