Zookal_Mock - Version 1.0.2

Version Notes

1.0.2

- Added Mage_CatalogInventory mocks
- Added Mage_Usa fallback mock model. Errors occur when loading system/config section and files of Mage_Usa have been removed

1.0.1

- Added Mage_Weee mocks
- Added Mage_GiftMessage mocks
Possibility to run mock module in a shell script

1.0.0

- Initial Release

Download this release

Release Info

Developer Cyrill Schumacher
Extension Zookal_Mock
Version 1.0.2
Comparing to
See all releases


Version 1.0.2

Files changed (85) hide show
  1. app/code/community/Zookal/Mock/Block/Payment/Backend.php +82 -0
  2. app/code/community/Zookal/Mock/Block/Payment/Frontend.php +73 -0
  3. app/code/community/Zookal/Mock/Helper/Data.php +90 -0
  4. app/code/community/Zookal/Mock/Model/Config.php +101 -0
  5. app/code/community/Zookal/Mock/Model/Mocks/Abstract.php +157 -0
  6. app/code/community/Zookal/Mock/Model/Mocks/Mage/AdminNotification/Model/Survey.php +32 -0
  7. app/code/community/Zookal/Mock/Model/Mocks/Mage/Adminhtml/Helper/Data.php +26 -0
  8. app/code/community/Zookal/Mock/Model/Mocks/Mage/Block.php +13 -0
  9. app/code/community/Zookal/Mock/Model/Mocks/Mage/CatalogInventory/Model/Stock/Item.php +15 -0
  10. app/code/community/Zookal/Mock/Model/Mocks/Mage/Category.php +13 -0
  11. app/code/community/Zookal/Mock/Model/Mocks/Mage/Category/Collection.php +13 -0
  12. app/code/community/Zookal/Mock/Model/Mocks/Mage/Category/Tree.php +13 -0
  13. app/code/community/Zookal/Mock/Model/Mocks/Mage/Class/Source/Customer.php +13 -0
  14. app/code/community/Zookal/Mock/Model/Mocks/Mage/Customer.php +13 -0
  15. app/code/community/Zookal/Mock/Model/Mocks/Mage/Customer/Collection.php +13 -0
  16. app/code/community/Zookal/Mock/Model/Mocks/Mage/Data.php +23 -0
  17. app/code/community/Zookal/Mock/Model/Mocks/Mage/Giftmessage/Block/Adminhtml/Product/Helper/Form/Config.php +21 -0
  18. app/code/community/Zookal/Mock/Model/Mocks/Mage/Group.php +21 -0
  19. app/code/community/Zookal/Mock/Model/Mocks/Mage/Item.php +13 -0
  20. app/code/community/Zookal/Mock/Model/Mocks/Mage/Log.php +13 -0
  21. app/code/community/Zookal/Mock/Model/Mocks/Mage/Log/Model/Visitor.php +33 -0
  22. app/code/community/Zookal/Mock/Model/Mocks/Mage/Message.php +13 -0
  23. app/code/community/Zookal/Mock/Model/Mocks/Mage/Order/Collection.php +13 -0
  24. app/code/community/Zookal/Mock/Model/Mocks/Mage/Order/Grid/Collection.php +13 -0
  25. app/code/community/Zookal/Mock/Model/Mocks/Mage/Payment.php +68 -0
  26. app/code/community/Zookal/Mock/Model/Mocks/Mage/Product.php +13 -0
  27. app/code/community/Zookal/Mock/Model/Mocks/Mage/Product/Collection.php +13 -0
  28. app/code/community/Zookal/Mock/Model/Mocks/Mage/Profile/Collection.php +13 -0
  29. app/code/community/Zookal/Mock/Model/Mocks/Mage/Queue/Collection.php +13 -0
  30. app/code/community/Zookal/Mock/Model/Mocks/Mage/Quote.php +13 -0
  31. app/code/community/Zookal/Mock/Model/Mocks/Mage/Review.php +13 -0
  32. app/code/community/Zookal/Mock/Model/Mocks/Mage/Sale/Collection.php +13 -0
  33. app/code/community/Zookal/Mock/Model/Mocks/Mage/Session.php +21 -0
  34. app/code/community/Zookal/Mock/Model/Mocks/Mage/Subscriber.php +13 -0
  35. app/code/community/Zookal/Mock/Model/Mocks/Mage/Tag.php +13 -0
  36. app/code/community/Zookal/Mock/Model/Mocks/Mage/Tag/Model/Tag.php +25 -0
  37. app/code/community/Zookal/Mock/Model/Mocks/Mage/Tax/Class.php +13 -0
  38. app/code/community/Zookal/Mock/Model/Mocks/Mage/Usa/Model/Shipping/Carrier/Ups.php +13 -0
  39. app/code/community/Zookal/Mock/Model/Mocks/Mage/Visitor.php +13 -0
  40. app/code/community/Zookal/Mock/Model/Mocks/Mage/Visitor/Online.php +6 -0
  41. app/code/community/Zookal/Mock/Model/Mocks/Mage/Weee/Model/Tax.php +39 -0
  42. app/code/community/Zookal/Mock/Model/Observer.php +265 -0
  43. app/code/community/Zookal/Mock/Test/Config/ConfigTest.php +61 -0
  44. app/code/community/Zookal/Mock/Test/Config/SystemTest.php +54 -0
  45. app/code/community/Zookal/Mock/Test/Helper/DataTest.php +124 -0
  46. app/code/community/Zookal/Mock/Test/Model/ConfigTest.php +751 -0
  47. app/code/community/Zookal/Mock/Test/Model/Mocks/AbstractTest.php +147 -0
  48. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/AbstractPHPUnitTestCase.php +54 -0
  49. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/AdminNotification/Model/SurveyTest.php +36 -0
  50. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Adminhtml/Helper/DataTest.php +21 -0
  51. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/BlockTest.php +13 -0
  52. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Category/CollectionTest.php +13 -0
  53. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Category/TreeTest.php +13 -0
  54. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/CategoryTest.php +13 -0
  55. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Class/Source/CustomerTest.php +13 -0
  56. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Customer/CollectionTest.php +13 -0
  57. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/CustomerTest.php +13 -0
  58. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/DataTest.php +29 -0
  59. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/GroupTest.php +29 -0
  60. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/ItemTest.php +13 -0
  61. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Log/Model/VisitorTest.php +26 -0
  62. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/LogTest.php +13 -0
  63. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Order/CollectionTest.php +13 -0
  64. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Order/Grid/CollectionTest.php +13 -0
  65. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/PaymentTest.php +67 -0
  66. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Product/CollectionTest.php +13 -0
  67. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/ProductTest.php +13 -0
  68. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Profile/CollectionTest.php +13 -0
  69. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Queue/CollectionTest.php +13 -0
  70. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/QuoteTest.php +13 -0
  71. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/ReviewTest.php +13 -0
  72. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Sale/CollectionTest.php +13 -0
  73. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/SessionTest.php +29 -0
  74. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/SubscriberTest.php +13 -0
  75. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Tag/Model/TagTest.php +19 -0
  76. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/TagTest.php +13 -0
  77. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Tax/ClassTest.php +13 -0
  78. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Visitor/OnlineTest.php +6 -0
  79. app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/VisitorTest.php +13 -0
  80. app/code/community/Zookal/Mock/Test/Model/ObserverTest.php +47 -0
  81. app/code/community/Zookal/Mock/etc/config.xml +61 -0
  82. app/code/community/Zookal/Mock/etc/system.xml +29 -0
  83. app/etc/modules/Zookal_Mock.xml +9 -0
  84. app/locale/en_US/Zookal_Mock.csv +2 -0
  85. package.xml +250 -0
app/code/community/Zookal/Mock/Block/Payment/Backend.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Block
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Block_Payment_Backend extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+ /**
13
+ * @var Mage_Sales_Model_Order_Payment
14
+ */
15
+ protected $_payment = null;
16
+
17
+ protected $_html = '<strong>Mock Payment Info:</strong>{{paymentInfo}}';
18
+
19
+ /**
20
+ * @param Mage_Sales_Model_Order_Payment $payment
21
+ *
22
+ * @return $this
23
+ */
24
+ public function setInfo(Mage_Sales_Model_Order_Payment $payment)
25
+ {
26
+ $this->_payment = $payment;
27
+ return $this;
28
+ }
29
+
30
+ /**
31
+ * @return string
32
+ */
33
+ public function toHtml()
34
+ {
35
+ Mage::dispatchEvent('mock_payment_backend_block_to_html_before', array('block' => $this, 'payment' => $this->_payment));
36
+ return strpos($this->_html, '{{paymentInfo}}') === false ? $this->_html : str_replace('{{paymentInfo}}', $this->_getPaymentInfoTable(), $this->_html);
37
+ }
38
+
39
+ /**
40
+ * Moving that into a phtml file could be a little bit complicated and it's only backend ;-)
41
+ * Use the observer to change the content.
42
+ *
43
+ * @return string
44
+ */
45
+ protected function _getPaymentInfoTable()
46
+ {
47
+ $debug = $this->_payment->debug();
48
+
49
+ if (isset($debug['additional_information']) && is_array($debug['additional_information'])) {
50
+ $ai = $debug['additional_information'];
51
+ unset($debug['additional_information']);
52
+ $debug = array_merge($debug, $ai);
53
+ }
54
+
55
+ ksort($debug);
56
+ $data = array('<table>');
57
+ foreach ($debug as $k => $v) {
58
+ if (!empty($v)) {
59
+ // you can translate here the column names into nicer names via the .csv files for the backend users
60
+ $data[] = '<tr><td>' . Mage::helper('zookal_mock')->__($k) . '</td><td>' . $v . '</td></tr>';
61
+ }
62
+ }
63
+ $data[] = '</table>';
64
+ return implode("\n", $data);
65
+ }
66
+
67
+ /**
68
+ * @param string $html
69
+ */
70
+ public function setHtml($html)
71
+ {
72
+ $this->_html = $html;
73
+ }
74
+
75
+ /**
76
+ * @return string
77
+ */
78
+ public function getHtml()
79
+ {
80
+ return $this->_html;
81
+ }
82
+ }
app/code/community/Zookal/Mock/Block/Payment/Frontend.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Block
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+
11
+ /**
12
+ * core/layout checks if a block is an instance of Mage_Core_Block_Abstract otherwise FE rendering fails :-(
13
+ *
14
+ * Class Zookal_Mock_Block_Payment_Frontend
15
+ */
16
+ class Zookal_Mock_Block_Payment_Frontend extends Mage_Core_Block_Abstract
17
+ {
18
+ /**
19
+ * @var Mage_Sales_Model_Order_Payment
20
+ */
21
+ protected $_payment = null;
22
+
23
+ /**
24
+ * @var string
25
+ */
26
+ protected $_html = '{{method}}';
27
+
28
+ /**
29
+ * Please use event core_block_abstract_to_html_before
30
+ *
31
+ * @return string
32
+ */
33
+ protected function _toHtml()
34
+ {
35
+ return strpos($this->_html, '{{method}}') === false ? $this->_html : $this->__(str_replace('{{method}}', $this->getInfo()->getMethod(),
36
+ $this->_html));
37
+ }
38
+
39
+ /**
40
+ * @param Mage_Sales_Model_Order_Payment $payment
41
+ *
42
+ * @return $this
43
+ */
44
+ public function setInfo(Mage_Sales_Model_Order_Payment $payment)
45
+ {
46
+ $this->_payment = $payment;
47
+ return $this;
48
+ }
49
+
50
+ /**
51
+ * @return Mage_Sales_Model_Order_Payment
52
+ */
53
+ public function getInfo()
54
+ {
55
+ return $this->_payment;
56
+ }
57
+
58
+ /**
59
+ * @param string $html
60
+ */
61
+ public function setHtml($html)
62
+ {
63
+ $this->_html = $html;
64
+ }
65
+
66
+ /**
67
+ * @return string
68
+ */
69
+ public function getHtml()
70
+ {
71
+ return $this->_html;
72
+ }
73
+ }
app/code/community/Zookal/Mock/Helper/Data.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Helper
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Helper_Data extends Mage_Core_Helper_Abstract
11
+ {
12
+
13
+ /**
14
+ * @var Mage_Core_Model_Store
15
+ */
16
+ protected $_store = null;
17
+
18
+ /**
19
+ * @var boolean
20
+ */
21
+ private $_includePathSet = null;
22
+
23
+ /**
24
+ * @param Mage_Core_Model_Store $store
25
+ */
26
+ public function __construct(Mage_Core_Model_Store $store = null)
27
+ {
28
+ $this->_store = $store;
29
+ }
30
+
31
+ /**
32
+ * @return Mage_Core_Model_Store
33
+ */
34
+ public function getStore()
35
+ {
36
+ if (null === $this->_store) {
37
+ $this->_store = Mage::app()->getStore();
38
+ }
39
+ return $this->_store;
40
+ }
41
+
42
+ /**
43
+ * @return boolean
44
+ */
45
+ public function isLogMethodEnabled()
46
+ {
47
+ return (int)$this->getStore()->getConfig('system/zookalmock/enable_method_log') === 1;
48
+ }
49
+
50
+ /**
51
+ * Appends a new include path to the current existing one.
52
+ * Appending is for performance reasons mandatory
53
+ *
54
+ * @param array $customFakePath
55
+ * @param boolean $append
56
+ *
57
+ * @return bool
58
+ */
59
+ public function setMockPhpIncludePath(array $customFakePath = null, $append = true)
60
+ {
61
+ if (null === $this->_includePathSet) {
62
+ $currentIncludePath = get_include_path();
63
+
64
+ $customFakePath = null === $customFakePath
65
+ ? array(
66
+ 'app', 'code', 'community', 'Zookal', 'Mock', 'Model', 'Mocks'
67
+ )
68
+ : $customFakePath;
69
+
70
+ $customFakePath = implode(DS, $customFakePath);
71
+ if (strpos($currentIncludePath, $customFakePath) !== false) {
72
+ $this->_includePathSet = false; // has already been set
73
+ return $this->_includePathSet;
74
+ }
75
+
76
+ if (true === $append) {
77
+ $includePath = get_include_path() . PS . BP . DS . $customFakePath;
78
+ } else {
79
+ $includePath = $customFakePath . PS . BP . DS . get_include_path();
80
+ }
81
+
82
+ $this->_includePathSet = set_include_path($includePath) !== false;
83
+ } else {
84
+ // every other call returns false as include path has already been set
85
+ $this->_includePathSet = false;
86
+ }
87
+
88
+ return $this->_includePathSet;
89
+ }
90
+ }
app/code/community/Zookal/Mock/Model/Config.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Zookal_Mock
4
+ * @package Model
5
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
6
+ * @copyright Copyright (c) Zookal Pty Ltd
7
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
8
+ */
9
+
10
+ /**
11
+ * Only usable in index.php:
12
+ * Mage::run($mageRunCode, $mageRunType, array(
13
+ * 'config_model' => 'Zookal_Mock_Model_Config'
14
+ * ));
15
+ *
16
+ * Class Zookal_Mock_Model_Config
17
+ */
18
+ class Zookal_Mock_Model_Config extends Mage_Core_Model_Config
19
+ {
20
+ /**
21
+ * Key = active Module name => values inactive Module names whose dependency can be removed.
22
+ * If you find more please send me a PR.
23
+ * Maybe this config could also reside in a xml file.
24
+ * @var array
25
+ */
26
+ protected $_dependencyLiars = array(
27
+ 'Mage_Reports' => array('Mage_Sales', 'Mage_Customer'),
28
+ 'Mage_Log' => array('Mage_Customer'),
29
+ 'Mage_Tax' => array('Mage_Customer'),
30
+ 'Mage_Poll' => array('Mage_Cms'),
31
+ 'Mage_Newsletter' => array('Mage_Widget'),
32
+ 'Mage_Catalog' => array('Mage_Dataflow', 'Mage_Cms'),
33
+ 'Mage_CatalogRule' => array('Mage_Customer'),
34
+ 'Mage_CatalogIndex' => array('Mage_CatalogRule'),
35
+ 'Mage_Checkout' => array('Mage_CatalogInventory'),
36
+ 'Mage_Customer' => array('Mage_Dataflow'),
37
+ 'Mage_Persistent' => array('Mage_Adminhtml'),
38
+ 'Mage_Captcha' => array('Mage_Adminhtml'),
39
+ 'VinaiKopp_LoginLog' => array('Mage_Adminhtml'),
40
+ );
41
+
42
+ /**
43
+ * Removes the dependencies for some modules configured in $_dependencyLiars
44
+ * e.g. if Mage_Log is active and Mage_Customer is disabled then remove Mage_Customer dependency
45
+ *
46
+ * @param array $modules
47
+ *
48
+ * @return array
49
+ */
50
+ protected function _sortModuleDepends($modules)
51
+ {
52
+ $modules = $this->removeDependencies($modules);
53
+ return parent::_sortModuleDepends($modules);
54
+ }
55
+
56
+ /**
57
+ * @param array $modules
58
+ *
59
+ * @return array
60
+ */
61
+ public function removeDependencies(array $modules)
62
+ {
63
+ $disabledModules = $this->getDisabledModules($modules);
64
+ foreach ($modules as $moduleName => $config) {
65
+ if (false === isset($this->_dependencyLiars[$moduleName]) || false === $config['active']) {
66
+ continue;
67
+ }
68
+ foreach ($this->_dependencyLiars[$moduleName] as $inactiveModule) {
69
+ if (true === isset($disabledModules[$inactiveModule])) { // check if it's really disabled
70
+ unset($modules[$moduleName]['depends'][$inactiveModule]); // remove dependency
71
+ }
72
+ }
73
+ }
74
+ return $modules;
75
+ }
76
+
77
+ /**
78
+ * @param array $modules
79
+ *
80
+ * @return array
81
+ */
82
+ public function getDisabledModules(array $modules)
83
+ {
84
+ $_disabledModules = array();
85
+ foreach ($modules as $moduleName => $node) {
86
+ $isDisabled = $node['active'] !== true;
87
+ if (true === $isDisabled) {
88
+ $_disabledModules[$moduleName] = $moduleName;
89
+ }
90
+ }
91
+ return $_disabledModules;
92
+ }
93
+
94
+ /**
95
+ * @return array
96
+ */
97
+ public function getDependencyLiars()
98
+ {
99
+ return $this->_dependencyLiars;
100
+ }
101
+ }
app/code/community/Zookal/Mock/Model/Mocks/Abstract.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ abstract class Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ /**
14
+ * @var Zookal_Mock_Helper_Data
15
+ */
16
+ protected $_helper = null;
17
+
18
+ protected $_isLogEnabled = false;
19
+
20
+ protected $_mockMethodsReturnThis = array(
21
+ 'add' => 1, // e.g. addCustomerFilter ...
22
+ 'cle' => 1, // e.g. clean() clear() clearasil()
23
+ 'gettotals' => 1, // Special case in Sales_Collection
24
+ 'gro' => 1, // e.g. groupByCustomer
25
+ 'joi' => 1, // e.g. joinCustomerName
26
+ 'loa' => 1, // e.g. load and loadBy....
27
+ 'lim' => 1, // e.g. limit() -> on collection
28
+ 'ord' => 1, // e.g. orderByTotalAmount
29
+ 'pre' => 1, // e.g. prepare()
30
+ 'resetsortorder' => 1,
31
+ 'renewsession' => 1,
32
+ 'set' => 1,
33
+ 'too' => 1, // e.g. toOptionArray, toOptionHash
34
+ 'uns' => 1,
35
+ );
36
+ protected $_mockMethodsReturnNull = array(
37
+ 'count' => 1,
38
+ 'get' => 1,
39
+ 'toh' => 1, // toHtml() on blocks
40
+ );
41
+ protected $_mockMethodsReturnFalse = array(
42
+ 'can' => 1, // canCapture and all other payment related methods
43
+ 'has' => 1,
44
+ 'isa' => 1, // e.g. isAvailable -> Payment
45
+ 'isd' => 1, // e.g. isDiscounted e.g. Weee helper
46
+ 'ise' => 1, // e.g. isEnabled e.g. Weee helper
47
+ 'isg' => 1, // e.g. isGateway -> Payment
48
+ 'isi' => 1, // e.g. isInitializeNeeded -> Payment
49
+ 'ism' => 1, // e.g. isMessagesAvailable -> GiftMessage
50
+ 'iss' => 1, // e.g. isSubscribed
51
+ 'ist' => 1, // e.g. isTaxable in Weee
52
+ 'isv' => 1, // e.g. isValid...
53
+ 'isl' => 1, // e.g. isLoggedIn
54
+ 'use' => 1,
55
+ 'typ' => 1, // Weee Helper->typeofdisplay()
56
+ 'val' => 1, // Weee Helper->validateCatalogPricesAndFptConfiguration()
57
+ );
58
+
59
+ /**
60
+ * @param Zookal_Mock_Helper_Data $helper
61
+ */
62
+ public function __construct($helper = null)
63
+ {
64
+ if (false === empty($helper) && $helper instanceof Zookal_Mock_Helper_Data) { // $helper is sometimes an empty array ...
65
+ $this->_helper = $helper;
66
+ }
67
+
68
+ $this->_isLogEnabled = $this->getHelper()->isLogMethodEnabled();
69
+ }
70
+
71
+ /**
72
+ * Add/Set/Get attribute wrapper
73
+ *
74
+ * @param string $method
75
+ * @param array $args
76
+ *
77
+ * @return $this|bool|null
78
+ * @throws Varien_Exception
79
+ */
80
+ public function __call($method, $args)
81
+ {
82
+ $lowerMethod = strtolower($method);
83
+ $firstThree = substr($lowerMethod, 0, 3);
84
+ $isCollection = strpos($lowerMethod, 'collection') !== false;
85
+ if (true === $isCollection || isset($this->_mockMethodsReturnThis[$lowerMethod]) || isset($this->_mockMethodsReturnThis[$firstThree])) {
86
+ $this->_log($method . ' return this');
87
+ return $this;
88
+ }
89
+ if (isset($this->_mockMethodsReturnNull[$lowerMethod]) || isset($this->_mockMethodsReturnNull[$firstThree])) {
90
+ $this->_log($method . ' return null');
91
+ return null;
92
+ }
93
+ if (isset($this->_mockMethodsReturnFalse[$firstThree]) || isset($this->_mockMethodsReturnFalse[$lowerMethod])) {
94
+ $this->_log($method . ' return false');
95
+ return false;
96
+ }
97
+
98
+ throw new Varien_Exception("Invalid method " . get_class($this) . "::" . $method . ' Cannot print args ...');
99
+ }
100
+
101
+ /**
102
+ * Special case if Mage_Tag is disabled or any other module which rely on initLayoutMessages
103
+ *
104
+ * @return Mage_Core_Model_Message_Collection
105
+ */
106
+ public function getMessages()
107
+ {
108
+ return Mage::getModel('core/message_collection');
109
+ }
110
+
111
+ /**
112
+ * uncomment this in dev env to see what methods are called
113
+ *
114
+ * @param $msg
115
+ */
116
+ protected function _log($msg)
117
+ {
118
+ if (true === $this->_isLogEnabled) {
119
+ Mage::log(get_class($this) . '::' . $msg, null, 'mock.log');
120
+ }
121
+ }
122
+
123
+ /**
124
+ * @return Zookal_Mock_Helper_Data
125
+ */
126
+ public function getHelper()
127
+ {
128
+ if (null === $this->_helper) {
129
+ $this->_helper = Mage::helper('zookal_mock');
130
+ }
131
+ return $this->_helper;
132
+ }
133
+
134
+ /**
135
+ * @return array
136
+ */
137
+ public function getMockMethodsReturnFalse()
138
+ {
139
+ return $this->_mockMethodsReturnFalse;
140
+ }
141
+
142
+ /**
143
+ * @return array
144
+ */
145
+ public function getMockMethodsReturnNull()
146
+ {
147
+ return $this->_mockMethodsReturnNull;
148
+ }
149
+
150
+ /**
151
+ * @return array
152
+ */
153
+ public function getMockMethodsReturnThis()
154
+ {
155
+ return $this->_mockMethodsReturnThis;
156
+ }
157
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/AdminNotification/Model/Survey.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+
11
+ /**
12
+ * Class Mage_AdminNotification_Model_Survey
13
+ * Do not change the class name, as it is needed for the autoloader because this class is somewhere in Magentos source code hardcoded :-(
14
+ * @see Zookal_Mock_Model_Observer::_setMockIncludePath
15
+ */
16
+ class Mage_AdminNotification_Model_Survey extends Zookal_Mock_Model_Mocks_Abstract
17
+ {
18
+ public static function isSurveyViewed()
19
+ {
20
+ return true;
21
+ }
22
+
23
+ public static function isSurveyUrlValid()
24
+ {
25
+ return false;
26
+ }
27
+
28
+ public static function getSurveyUrl()
29
+ {
30
+ return '';
31
+ }
32
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Adminhtml/Helper/Data.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+
11
+ /**
12
+ * Class Mage_Adminhtml_Helper_Data
13
+ * Do not change the class name, as it is needed for the autoloader
14
+ * @see Zookal_Mock_Model_Observer::_setMockIncludePath
15
+ */
16
+ class Mage_Adminhtml_Helper_Data extends Zookal_Mock_Model_Mocks_Abstract
17
+ {
18
+ /**
19
+ * Constants are needed for Magento >= 1.6
20
+ * Check here https://github.com/wlvrn/magento-community for all 72 releases of CE Magento
21
+ */
22
+ const XML_PATH_ADMINHTML_ROUTER_FRONTNAME = 'admin/routers/adminhtml/args/frontName';
23
+ const XML_PATH_USE_CUSTOM_ADMIN_URL = 'default/admin/url/use_custom';
24
+ const XML_PATH_USE_CUSTOM_ADMIN_PATH = 'default/admin/url/use_custom_path';
25
+ const XML_PATH_CUSTOM_ADMIN_PATH = 'default/admin/url/custom_path';
26
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Block.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Block extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/CatalogInventory/Model/Stock/Item.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Mage_CatalogInventory_Model_Stock_Item extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ const XML_PATH_MANAGE_STOCK = 'cataloginventory/item_options/manage_stock';
14
+ const ENTITY = 'cataloginventory_stock_item';
15
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Category.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Category extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Category/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Category_Collection extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Category/Tree.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Category_Tree extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Class/Source/Customer.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Class_Source_Customer extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Customer.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Customer extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Customer/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Customer_Collection extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Data.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Data extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+ /**
13
+ * Fake translator, should be optimized to work like sprintf
14
+ *
15
+ * @param string $text
16
+ *
17
+ * @return string
18
+ */
19
+ public function __($text = '')
20
+ {
21
+ return $text;
22
+ }
23
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Giftmessage/Block/Adminhtml/Product/Helper/Form/Config.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Mage_GiftMessage_Block_Adminhtml_Product_Helper_Form_Config extends Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Config
11
+ {
12
+ /**
13
+ * Return nothing
14
+ *
15
+ * @return string
16
+ */
17
+ public function getElementHtml()
18
+ {
19
+ return '<strong>' . Mage::helper('zookal_mock')->__('Module Disabled!') . '</strong>';
20
+ }
21
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Group.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Group extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+ /**
13
+ * @see table tax_class
14
+ *
15
+ * @return int
16
+ */
17
+ public function getTaxClassId()
18
+ {
19
+ return 1;
20
+ }
21
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Item.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Item extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Log.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Log extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Log/Model/Visitor.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+
11
+ /**
12
+ * Class Mage_Log_Model_Visitor
13
+ * Do not change the class name, as it is needed for the autoloader because this class is somewhere in Magentos source code hardcoded :-(
14
+ * @see Zookal_Mock_Model_Observer::_setMockIncludePath
15
+ */
16
+ class Mage_Log_Model_Visitor extends Zookal_Mock_Model_Mocks_Abstract
17
+ {
18
+ /**
19
+ * Constants are needed for Magento >= 1.1.7
20
+ * Check here https://github.com/wlvrn/magento-community for all 72 releases of CE Magento
21
+ */
22
+ const DEFAULT_ONLINE_MINUTES_INTERVAL = 15;
23
+ const VISITOR_TYPE_CUSTOMER = 'c';
24
+ const VISITOR_TYPE_VISITOR = 'v';
25
+
26
+ /**
27
+ * @return int
28
+ */
29
+ public static function getOnlineMinutesInterval()
30
+ {
31
+ return 0;
32
+ }
33
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Message.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Message extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Order/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Order_Collection extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Order/Grid/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Order_Grid_Collection extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Payment.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Payment extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+ /**
13
+ * @var Mage_Core_Model_Store
14
+ */
15
+ protected $_store = null;
16
+
17
+ public function __construct($helper = null, $store = null)
18
+ {
19
+ parent::__construct($helper);
20
+ if (false === empty($store) && $store instanceof Mage_Core_Model_Store) {
21
+ $this->_store = $store;
22
+ }
23
+ }
24
+
25
+ /**
26
+ * @return Mage_Core_Model_Store
27
+ */
28
+ public function getStore()
29
+ {
30
+ if (null === $this->_store) {
31
+ $this->_store = Mage::app()->getStore();
32
+ }
33
+ return $this->_store;
34
+ }
35
+
36
+ /**
37
+ * @see Mage_Payment_Helper_Data
38
+ * Retrieve block type for display method information
39
+ * Only frontend layout generation checks if a block is an instance of Mage_Core_Block_Abstract therefore we need to separate.
40
+ *
41
+ * @return string
42
+ */
43
+ public function getInfoBlockType()
44
+ {
45
+ return 'zookal_mock/payment_' . ($this->_isAdmin() ? 'backend' : 'frontend');
46
+ }
47
+
48
+ /**
49
+ * @see Mage_Payment_Helper_Data
50
+ *
51
+ * Retreive payment method form html
52
+ *
53
+ * @return Zookal_Mock_Block_Payment_Backend
54
+ */
55
+ public function getMethodFormBlock()
56
+ {
57
+ return new Zookal_Mock_Block_Payment_Backend();
58
+ }
59
+
60
+ /**
61
+ * @see http://stackoverflow.com/questions/9693020/magento-request-frontend-or-backend thanks alan :-)
62
+ * @return bool
63
+ */
64
+ protected function _isAdmin()
65
+ {
66
+ return ($this->getStore()->isAdmin() || Mage::getDesign()->getArea() === 'adminhtml');
67
+ }
68
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Product.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Product extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Product/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Product_Collection extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Profile/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Profile_Collection extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Queue/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Queue_Collection extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Quote.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Quote extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Review.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Review extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Sale/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Sale_Collection extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Session.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Session extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+ /**
13
+ * also used in Mage_Catalog_Model_Resource_Product_Collection::addPriceData
14
+ *
15
+ * @return int
16
+ */
17
+ public function getCustomerGroupId()
18
+ {
19
+ return 0;
20
+ }
21
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Subscriber.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Subscriber extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Tag.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Tag extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Tag/Model/Tag.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+
11
+ /**
12
+ * Class Mage_Tag_Model_Tag
13
+ * Do not change the class name, as it is needed for the autoloader because this class is somewhere in Magentos source code hardcoded :-(
14
+ * @see Zookal_Mock_Model_Observer::_setMockIncludePath
15
+ */
16
+ class Mage_Tag_Model_Tag extends Zookal_Mock_Model_Mocks_Abstract
17
+ {
18
+ /**
19
+ * Constants are needed for Magento >= 1.2.0
20
+ * Check here https://github.com/wlvrn/magento-community for all 72 releases of CE Magento
21
+ */
22
+ const STATUS_DISABLED = -1;
23
+ const STATUS_PENDING = 0;
24
+ const STATUS_APPROVED = 1;
25
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Tax/Class.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Tax_Class extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Usa/Model/Shipping/Carrier/Ups.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Mage_Usa_Model_Shipping_Carrier_Ups extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Visitor.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Mocks_Mage_Visitor extends Zookal_Mock_Model_Mocks_Abstract
11
+ {
12
+
13
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Visitor/Online.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Zookal_Mock_Model_Mocks_Mage_Visitor_Online extends Zookal_Mock_Model_Mocks_Abstract
4
+ {
5
+
6
+ }
app/code/community/Zookal/Mock/Model/Mocks/Mage/Weee/Model/Tax.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+
11
+ /**
12
+ * Class Mage_Tag_Model_Tag
13
+ * Do not change the class name, as it is needed for the autoloader because this class is somewhere in Magentos source code hardcoded :-(
14
+ * @see Zookal_Mock_Model_Observer::_setMockIncludePath
15
+ */
16
+ class Mage_Weee_Model_Tax extends Zookal_Mock_Model_Mocks_Abstract
17
+ {
18
+ /**
19
+ * constants are also used in catalog/product/price.html
20
+ * Constants are needed for Magento >= 1.6.0
21
+ * Check here https://github.com/wlvrn/magento-community for all 72 releases of CE Magento
22
+ */
23
+ /**
24
+ * Including FPT only
25
+ */
26
+ const DISPLAY_INCL = 0;
27
+ /**
28
+ * Including FPT and FPT description
29
+ */
30
+ const DISPLAY_INCL_DESCR = 1;
31
+ /**
32
+ * Excluding FPT, FPT description, final price
33
+ */
34
+ const DISPLAY_EXCL_DESCR_INCL = 2;
35
+ /**
36
+ * Excluding FPT
37
+ */
38
+ const DISPLAY_EXCL = 3;
39
+ }
app/code/community/Zookal/Mock/Model/Observer.php ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Model_Observer
11
+ {
12
+ /**
13
+ * General Container for rewriting nodes entries
14
+ *
15
+ * @var array
16
+ */
17
+ protected $_newConfigNodes = array();
18
+
19
+ /**
20
+ * Only add these modules which are tightly coupled with the core and causes issues once active=>false
21
+ * Module Name => model name
22
+ *
23
+ * @var array
24
+ */
25
+ protected $_mappingModel = array(
26
+ 'Mage_Wishlist' => 'wishlist',
27
+ 'Mage_Weee' => 'weee',
28
+ 'Mage_Tag' => 'tag',
29
+ 'Mage_Tax' => 'tax',
30
+ 'Mage_Sales' => 'sales',
31
+ 'Mage_Review' => 'review',
32
+ 'Mage_Reports' => 'reports',
33
+ 'Mage_Rating' => 'rating',
34
+ 'Mage_ProductAlert' => 'productalert',
35
+ 'Mage_Newsletter' => 'newsletter',
36
+ 'Mage_Log' => 'log',
37
+ 'Mage_GoogleCheckout' => 'googlecheckout',
38
+ 'Mage_GiftMessage' => 'giftmessage',
39
+ 'Mage_Dataflow' => 'dataflow',
40
+ 'Mage_Catalog' => 'catalog',
41
+ 'Mage_Customer' => 'customer',
42
+ 'Mage_Cms' => 'cms',
43
+ 'Mage_Backup' => 'backup',
44
+ 'Mage_Adminhtml' => 'adminhtml',
45
+ );
46
+
47
+ /**
48
+ * These methods will only be executed when that module has been disabled.
49
+ *
50
+ * @var array
51
+ */
52
+ protected $_specialMethods = array(
53
+ 'Mage_Adminhtml' => '_mageMockIncludePath',
54
+ 'Mage_Catalog' => '_mageCatalog',
55
+ 'Mage_Customer' => '_mageCustomer',
56
+ 'Mage_GiftMessage' => '_mageMockHelper',
57
+ 'Mage_GoogleCheckout' => '_mageGoogleCheckout',
58
+ 'Mage_Log' => '_mageMockIncludePath',
59
+ 'Mage_ProductAlert' => '_mageMockHelper',
60
+ 'Mage_Review' => '_mageMockHelper',
61
+ 'Mage_Tag' => '_mageMockIncludePath',
62
+ 'Mage_Tax' => '_mageTaxClass',
63
+ 'Mage_Wishlist' => '_mageMockHelper',
64
+ 'Mage_Weee' => '_mageMockWeee',
65
+ );
66
+
67
+ /**
68
+ * To use this in a shell script call it: Mage::getModel('zookal_mock/observer')->mockDisabledModules();
69
+ * @fire controller_front_init_before
70
+ */
71
+ public function mockDisabledModules()
72
+ {
73
+ $disabledModules = $this->_getDisabledModules();
74
+ $pathPrefix = 'global/models/';
75
+
76
+ foreach ($disabledModules as $moduleName => $module) {
77
+ if (false === isset($this->_mappingModel[$moduleName])) {
78
+ continue;
79
+ }
80
+ $class = 'Zookal_Mock_Model_Mocks_' . $module[0];
81
+ $this->_setConfigNode($pathPrefix . $this->_mappingModel[$moduleName] . '/class', $class);
82
+ $resource = $this->_mappingModel[$moduleName] . '_resource';
83
+ $this->_setConfigNode($pathPrefix . $this->_mappingModel[$moduleName] . '/resourceModel', $resource);
84
+ $this->_setConfigNode($pathPrefix . $resource . '/class', $class);
85
+
86
+ $this->{$this->_getSpecialMethod($moduleName)}($pathPrefix, $moduleName, $resource);
87
+ }
88
+ $this->_processSetNodes();
89
+ }
90
+
91
+ /**
92
+ * Runs a specialMethod if its found otherwise _mageVoid will be executed
93
+ *
94
+ * @param $moduleName
95
+ *
96
+ * @return string
97
+ */
98
+ protected function _getSpecialMethod($moduleName)
99
+ {
100
+ return isset($this->_specialMethods[$moduleName]) ? $this->_specialMethods[$moduleName] : '_mageVoid';
101
+ }
102
+
103
+ /**
104
+ * Special Handling when Mage_Adminhtml/Mage_Log/Mage_Tag is disabled and physically removed
105
+ *
106
+ * @param $pathPrefix
107
+ * @param $moduleName
108
+ * @param $resource
109
+ */
110
+ protected function _mageMockIncludePath($pathPrefix = null, $moduleName = null, $resource = null)
111
+ {
112
+ Mage::helper('zookal_mock')->setMockPhpIncludePath();
113
+ }
114
+
115
+ /**
116
+ * Special Handling when Mage_GoogleCheckout is disabled. It has a dependency in Mage_Sales/etc/config.xml :-(
117
+ *
118
+ * @param $pathPrefix
119
+ * @param $moduleName
120
+ * @param $resource
121
+ */
122
+ protected function _mageGoogleCheckout($pathPrefix, $moduleName, $resource)
123
+ {
124
+ $prefixes = $this->_getAllPathPrefixes();
125
+ foreach ($prefixes as $prefix) {
126
+ $this->_setConfigNode($prefix . '/payment/' . $this->_mappingModel[$moduleName] . '/active', '0');
127
+ $this->_setConfigNode($prefix . '/payment/' . $this->_mappingModel[$moduleName] . '/model', 'zookal_mock/mocks_mage_payment');
128
+ }
129
+ }
130
+
131
+ /**
132
+ * Special Handling when Mage_ProductAlert is disabled, when need to fake a helper
133
+ *
134
+ * @param $pathPrefix
135
+ * @param $moduleName
136
+ * @param $resource
137
+ */
138
+ protected function _mageMockHelper($pathPrefix, $moduleName, $resource)
139
+ {
140
+ $this->_setConfigNode('global/helpers/' . $this->_mappingModel[$moduleName] . '/class', 'zookal_mock/mocks_mage');
141
+ }
142
+
143
+ /**
144
+ * Special Handling when Mage_ProductAlert is disabled, when need to fake a helper
145
+ *
146
+ * @param $pathPrefix
147
+ * @param $moduleName
148
+ * @param $resource
149
+ */
150
+ protected function _mageMockWeee($pathPrefix, $moduleName, $resource)
151
+ {
152
+ $this->_mageMockHelper($pathPrefix, $moduleName, $resource);
153
+ $this->_mageMockIncludePath();
154
+ }
155
+
156
+ /**
157
+ * Special case when Mage_Catalog is disabled and Mage_Widget is enabled
158
+ *
159
+ * @param $pathPrefix
160
+ * @param $moduleName
161
+ * @param $resource
162
+ */
163
+ protected function _mageCatalog($pathPrefix, $moduleName, $resource)
164
+ {
165
+ $prefix = 'global/catalog/product/type/simple/';
166
+ $this->_setConfigNode($prefix . 'label', 'Simple Product');
167
+ $this->_setConfigNode($prefix . 'model', 'zookal_mock/mocks_mage_product');
168
+ $this->_setConfigNode($prefix . 'composite', '0');
169
+ $this->_setConfigNode($prefix . 'index_priority', '10');
170
+ }
171
+
172
+ /**
173
+ * Special case when Mage_CatalogIndex is enabled and Mage_Customer is disabled
174
+ * Mage_Customer needs the tax_class table name for joining
175
+ *
176
+ * @param $pathPrefix
177
+ * @param $moduleName
178
+ * @param $resource
179
+ */
180
+ protected function _mageCustomer($pathPrefix, $moduleName, $resource)
181
+ {
182
+ $this->_setConfigNode($pathPrefix . $resource . '/entities/customer_group/table', 'customer_group');
183
+ }
184
+
185
+ /**
186
+ * Special case when Mage_Tax is disabled and Mage_Customer is enabled
187
+ * Mage_Customer needs the tax_class table name for joining
188
+ *
189
+ * @param $pathPrefix
190
+ * @param $moduleName
191
+ * @param $resource
192
+ */
193
+ protected function _mageTaxClass($pathPrefix, $moduleName, $resource)
194
+ {
195
+ $this->_setConfigNode($pathPrefix . $resource . '/entities/tax_class/table', 'tax_class');
196
+ }
197
+
198
+ /**
199
+ * empty method for fallback
200
+ *
201
+ * @param $pathPrefix
202
+ * @param $moduleName
203
+ * @param $resource
204
+ */
205
+ protected function _mageVoid($pathPrefix, $moduleName, $resource)
206
+ {
207
+ }
208
+
209
+ /**
210
+ * @return array
211
+ */
212
+ protected function _getDisabledModules()
213
+ {
214
+ $_disabledModules = array();
215
+
216
+ $modules = Mage::getConfig()->getNode('modules');
217
+ foreach ($modules->children() as $moduleName => $node) {
218
+ /** @var $node Mage_Core_Model_Config_Element */
219
+ $isDisabled = strtolower($node->active) !== 'true';
220
+ if (true === $isDisabled) {
221
+ $_disabledModules[$moduleName] = explode('_', $moduleName);
222
+ }
223
+ }
224
+ return $_disabledModules;
225
+ }
226
+
227
+ /**
228
+ * @param string $path
229
+ * @param string $value
230
+ */
231
+ protected function _setConfigNode($path, $value)
232
+ {
233
+ $this->_newConfigNodes[$path] = $value;
234
+ }
235
+
236
+ /**
237
+ * runs setNode on getConfig
238
+ */
239
+ protected function _processSetNodes()
240
+ {
241
+ foreach ($this->_newConfigNodes as $path => $value) {
242
+ Mage::getConfig()->setNode($path, $value);
243
+ }
244
+ }
245
+
246
+ /**
247
+ * refactor when used more than once
248
+ *
249
+ * @return array
250
+ */
251
+ protected function _getAllPathPrefixes()
252
+ {
253
+ $prefixes = array(
254
+ 'default' => 'default',
255
+ 'stores/admin' => 'stores/admin',
256
+ );
257
+
258
+ $stores = Mage::app()->getStores();
259
+ foreach ($stores as $store) {
260
+ /** @var $store Mage_Core_Model_Store */
261
+ $prefixes['stores/' . $store->getCode()] = 'stores/' . $store->getCode();
262
+ }
263
+ return $prefixes;
264
+ }
265
+ }
app/code/community/Zookal/Mock/Test/Config/ConfigTest.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Helper
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Config_ConfigTest extends EcomDev_PHPUnit_Test_Case_Config
11
+ {
12
+ /**
13
+ * @test
14
+ */
15
+ public function itShouldHaveASetupResource()
16
+ {
17
+ $this->assertModuleVersionGreaterThanOrEquals('1.0.0');
18
+ }
19
+
20
+ /**
21
+ * @test
22
+ */
23
+ public function itShouldHaveAHelper()
24
+ {
25
+ $this->assertHelperAlias('zookal_mock', 'Zookal_Mock_Helper_Data');
26
+ }
27
+
28
+ /**
29
+ * @test
30
+ */
31
+ public function itShouldHaveAConfigModel()
32
+ {
33
+ $configModel = Mage::getModel('zookal_mock/config');
34
+ $this->assertInstanceOf('Mage_Core_Model_Config', $configModel);
35
+ }
36
+
37
+ /**
38
+ * @test
39
+ */
40
+ public function itShouldHaveAControllerFrontInitBeforeObserver()
41
+ {
42
+ $this->assertEventObserverDefined('global', 'controller_front_init_before', 'zookal_mock/observer', 'mockDisabledModules');
43
+ }
44
+
45
+ /**
46
+ * @test
47
+ */
48
+ public function itShouldHaveABlockAlias()
49
+ {
50
+ $this->assertBlockAlias('zookal_mock/payment_backend', 'Zookal_Mock_Block_Payment_Backend');
51
+ $this->assertBlockAlias('zookal_mock/payment_frontend', 'Zookal_Mock_Block_Payment_Frontend');
52
+ }
53
+
54
+ /**
55
+ * @test
56
+ */
57
+ public function itShouldHaveTheEnableMethodLog()
58
+ {
59
+ $this->assertDefaultConfigValue('system/zookalmock/enable_method_log', 0);
60
+ }
61
+ }
app/code/community/Zookal/Mock/Test/Config/SystemTest.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Helper
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Config_SystemTest extends PHPUnit_Framework_TestCase
11
+ {
12
+ protected function getFile()
13
+ {
14
+ $dir = Mage::getModuleDir('etc', 'Zookal_Mock');
15
+ return "$dir/system.xml";
16
+ }
17
+
18
+ protected function getXml()
19
+ {
20
+ $file = $this->getFile();
21
+ $xml = simplexml_load_file($file);
22
+ return $xml;
23
+ }
24
+
25
+ public function assertFieldDefined($path, $message = '')
26
+ {
27
+ $defaultMessage = '';
28
+ @list($section, $group, $field) = explode('/', $path);
29
+ $nodePath = "sections/$section/groups/$group/fields/$field";
30
+ $result = $this->getXml()->xpath($nodePath);
31
+ if (!$message) {
32
+ $defaultMessage = sprintf("System configuration field \"$path\" not defined");
33
+ }
34
+ if (!$result) {
35
+ $this->fail($message ? : $defaultMessage);
36
+ }
37
+ }
38
+
39
+ /**
40
+ * @test
41
+ */
42
+ public function itShouldHaveASystemXml()
43
+ {
44
+ $this->assertFileExists($this->getFile());
45
+ }
46
+
47
+ /**
48
+ * @test
49
+ */
50
+ public function itShouldHaveAnApiUrlField()
51
+ {
52
+ $this->assertFieldDefined('system/zookalmock/enable_method_log');
53
+ }
54
+ }
app/code/community/Zookal/Mock/Test/Helper/DataTest.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Helper
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Helper_DataTest extends EcomDev_PHPUnit_Test_Case
11
+ {
12
+ protected $class = 'Zookal_Mock_Helper_Data';
13
+
14
+ /**
15
+ * @param int $enabled
16
+ *
17
+ * @return PHPUnit_Framework_MockObject_MockObject
18
+ */
19
+ public function getStoreMock($enabled = 0)
20
+ {
21
+ $stubStore = $this->getMock('Mage_Core_Model_Store');
22
+ $stubStore->expects($this->any())
23
+ ->method('getConfig')
24
+ ->with('system/zookalmock/enable_method_log')
25
+ ->will($this->returnValue($enabled));
26
+ return $stubStore;
27
+ }
28
+
29
+ /**
30
+ * @param PHPUnit_Framework_MockObject_MockObject $mockStore
31
+ *
32
+ * @return Zookal_Mock_Helper_Data
33
+ */
34
+ public function getInstance($mockStore = null)
35
+ {
36
+ if (null === $mockStore) {
37
+ $mockStore = $this->getStoreMock();
38
+ }
39
+ return new $this->class($mockStore);
40
+ }
41
+
42
+ /**
43
+ * @test
44
+ */
45
+ public function itShouldExist()
46
+ {
47
+ $this->assertInstanceOf($this->class, $this->getInstance());
48
+ }
49
+
50
+ /**
51
+ * @test
52
+ */
53
+ public function itShouldExtendTheHelperAbstract()
54
+ {
55
+ $this->assertInstanceOf('Mage_Core_Helper_Abstract', $this->getInstance());
56
+ }
57
+
58
+ /**
59
+ * @test
60
+ */
61
+ public function itShouldHaveAGetStoreMethod()
62
+ {
63
+ $this->assertTrue(is_callable(array($this->class, 'getStore')));
64
+ }
65
+
66
+ /**
67
+ * @test
68
+ * @depends itShouldHaveAGetStoreMethod
69
+ */
70
+ public function itShouldReturnTheInjectedStoreModel()
71
+ {
72
+ $mockStore = $this->getMock('Mage_Core_Model_Store');
73
+ $instance = $this->getInstance($mockStore);
74
+ $this->assertSame($mockStore, $instance->getStore());
75
+ }
76
+
77
+ /**
78
+ * @test
79
+ */
80
+ public function itShouldHaveAMethodIsLogMethodEnabled()
81
+ {
82
+ $this->assertTrue(is_callable(array($this->class, 'isLogMethodEnabled')));
83
+ }
84
+
85
+ /**
86
+ * @test
87
+ * @depends itShouldHaveAMethodIsLogMethodEnabled
88
+ */
89
+ public function itShouldReturnEnabledLog()
90
+ {
91
+ $mockStore = $this->getStoreMock(1);
92
+ $instance = $this->getInstance($mockStore);
93
+ $this->assertTrue($instance->isLogMethodEnabled());
94
+ }
95
+
96
+ /**
97
+ * @test
98
+ * @depends itShouldHaveAMethodIsLogMethodEnabled
99
+ */
100
+ public function itShouldReturnDisabledLog()
101
+ {
102
+ $mockStore = $this->getStoreMock(0);
103
+ $instance = $this->getInstance($mockStore);
104
+ $this->assertFalse($instance->isLogMethodEnabled());
105
+ }
106
+
107
+ /**
108
+ * @test
109
+ */
110
+ public function itShouldHaveAMethodSetMockPhpIncludePath()
111
+ {
112
+ $this->assertTrue(is_callable(array($this->class, 'setMockPhpIncludePath')));
113
+ }
114
+
115
+ /**
116
+ * @test
117
+ */
118
+ public function itShouldNotSetTheMockPhpIncludePathAgain()
119
+ {
120
+ $this->assertFalse($this->getInstance()->setMockPhpIncludePath());
121
+ $newIncludePath = get_include_path();
122
+ $this->assertContains('app/code/community/Zookal/Mock/Model/Mocks', $newIncludePath);
123
+ }
124
+ }
app/code/community/Zookal/Mock/Test/Model/ConfigTest.php ADDED
@@ -0,0 +1,751 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Helper
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_ConfigTest extends EcomDev_PHPUnit_Test_Case
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Config';
13
+
14
+ /**
15
+ * @param string|Varien_Simplexml_Element $sourceData
16
+ *
17
+ * @return Zookal_Mock_Model_Config
18
+ */
19
+ public function getInstance($sourceData = null)
20
+ {
21
+ return new $this->class($sourceData);
22
+ }
23
+
24
+ /**
25
+ * @test
26
+ */
27
+ public function itShouldExist()
28
+ {
29
+ $this->assertTrue(class_exists($this->class), "Failed asserting {$this->class} exists");
30
+ }
31
+
32
+ /**
33
+ * @test
34
+ */
35
+ public function itShouldExtendCoreModelConfig()
36
+ {
37
+ $this->assertInstanceOf('Mage_Core_Model_Config', $this->getInstance());
38
+ }
39
+
40
+ /**
41
+ * @test
42
+ */
43
+ public function itShouldHaveMethods()
44
+ {
45
+ $methods = array(
46
+ 'getDisabledModules',
47
+ 'removeDependencies',
48
+ 'getDependencyLiars',
49
+ );
50
+ //$this->assertTrue(method_exists($this->class, ));
51
+ $classMethods = array_flip(get_class_methods($this->class));
52
+ foreach ($methods as $method) {
53
+ $this->assertArrayHasKey($method, $classMethods);
54
+ }
55
+ }
56
+
57
+ /**
58
+ * @test
59
+ */
60
+ public function itShouldGetTheDisabledModules()
61
+ {
62
+ $disabledModules = $this->getInstance()->getDisabledModules($this->getModuleFixture());
63
+
64
+ $this->assertCount(24, $disabledModules);
65
+ $this->assertArrayHasKey('Mage_Backup', $disabledModules);
66
+ $this->assertArrayHasKey('Phoenix_Moneybookers', $disabledModules);
67
+ }
68
+
69
+ /**
70
+ * @test
71
+ */
72
+ public function itShouldRemoveTheDependencies()
73
+ {
74
+ $instance = $this->getInstance();
75
+ $liars = $instance->getDependencyLiars();
76
+ $modulesNoDependencies = $instance->removeDependencies($this->getModuleFixture());
77
+
78
+ foreach ($modulesNoDependencies as $module => $config) {
79
+ if (isset($liars[$module]) && true === $config['active']) {
80
+ $liarModules = $liars[$module];
81
+ $depends = $config['depends'];
82
+ foreach ($liarModules as $liarModule) {
83
+ if (false === $modulesNoDependencies[$liarModule]['active']) {
84
+ $this->assertArrayNotHasKey($liarModule, $depends, $module . ' -> ' . $liarModule . ' -> ' . var_export($depends, 1));
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+
91
+ /**
92
+ * @return array
93
+ */
94
+ protected function getModuleFixture()
95
+ {
96
+ return array(
97
+ 'Mage_Core' =>
98
+ array(
99
+ 'module' => 'Mage_Core',
100
+ 'depends' =>
101
+ array(),
102
+ 'active' => true,
103
+ ),
104
+ 'Mage_Eav' =>
105
+ array(
106
+ 'module' => 'Mage_Eav',
107
+ 'depends' =>
108
+ array(
109
+ 'Mage_Core' => true,
110
+ ),
111
+ 'active' => true,
112
+ ),
113
+ 'Mage_Page' =>
114
+ array(
115
+ 'module' => 'Mage_Page',
116
+ 'depends' =>
117
+ array(
118
+ 'Mage_Core' => true,
119
+ ),
120
+ 'active' => true,
121
+ ),
122
+ 'Mage_Install' =>
123
+ array(
124
+ 'module' => 'Mage_Install',
125
+ 'depends' =>
126
+ array(
127
+ 'Mage_Core' => true,
128
+ ),
129
+ 'active' => false,
130
+ ),
131
+ 'Mage_Admin' =>
132
+ array(
133
+ 'module' => 'Mage_Admin',
134
+ 'depends' =>
135
+ array(
136
+ 'Mage_Core' => true,
137
+ ),
138
+ 'active' => true,
139
+ ),
140
+ 'Mage_Rule' =>
141
+ array(
142
+ 'module' => 'Mage_Rule',
143
+ 'depends' =>
144
+ array(
145
+ 'Mage_Core' => true,
146
+ ),
147
+ 'active' => true,
148
+ ),
149
+ 'Mage_Adminhtml' =>
150
+ array(
151
+ 'module' => 'Mage_Adminhtml',
152
+ 'depends' =>
153
+ array(
154
+ 'Mage_Admin' => true,
155
+ ),
156
+ 'active' => true,
157
+ ),
158
+ 'Mage_AdminNotification' =>
159
+ array(
160
+ 'module' => 'Mage_AdminNotification',
161
+ 'depends' =>
162
+ array(
163
+ 'Mage_Core' => true,
164
+ 'Mage_Adminhtml' => true,
165
+ ),
166
+ 'active' => false,
167
+ ),
168
+ 'Mage_Cron' =>
169
+ array(
170
+ 'module' => 'Mage_Cron',
171
+ 'depends' =>
172
+ array(
173
+ 'Mage_Core' => true,
174
+ ),
175
+ 'active' => true,
176
+ ),
177
+ 'Mage_Directory' =>
178
+ array(
179
+ 'module' => 'Mage_Directory',
180
+ 'depends' =>
181
+ array(
182
+ 'Mage_Core' => true,
183
+ ),
184
+ 'active' => true,
185
+ ),
186
+ 'Mage_Customer' =>
187
+ array(
188
+ 'module' => 'Mage_Customer',
189
+ 'depends' =>
190
+ array(
191
+ 'Mage_Eav' => true,
192
+ 'Mage_Dataflow' => true,
193
+ 'Mage_Directory' => true,
194
+ ),
195
+ 'active' => true,
196
+ ),
197
+ 'Mage_Catalog' =>
198
+ array(
199
+ 'module' => 'Mage_Catalog',
200
+ 'depends' =>
201
+ array(
202
+ 'Mage_Eav' => true,
203
+ 'Mage_Dataflow' => true,
204
+ 'Mage_Cms' => true,
205
+ 'Mage_Index' => true,
206
+ ),
207
+ 'active' => true,
208
+ ),
209
+ 'Mage_CatalogRule' =>
210
+ array(
211
+ 'module' => 'Mage_CatalogRule',
212
+ 'depends' =>
213
+ array(
214
+ 'Mage_Rule' => true,
215
+ 'Mage_Catalog' => true,
216
+ 'Mage_Customer' => true,
217
+ ),
218
+ 'active' => true,
219
+ ),
220
+ 'Mage_CatalogIndex' =>
221
+ array(
222
+ 'module' => 'Mage_CatalogIndex',
223
+ 'depends' =>
224
+ array(
225
+ 'Mage_Catalog' => true,
226
+ 'Mage_Eav' => true,
227
+ 'Mage_CatalogRule' => true,
228
+ ),
229
+ 'active' => true,
230
+ ),
231
+ 'Mage_CatalogSearch' =>
232
+ array(
233
+ 'module' => 'Mage_CatalogSearch',
234
+ 'depends' =>
235
+ array(
236
+ 'Mage_Catalog' => true,
237
+ ),
238
+ 'active' => true,
239
+ ),
240
+ 'Mage_Sales' =>
241
+ array(
242
+ 'module' => 'Mage_Sales',
243
+ 'depends' =>
244
+ array(
245
+ 'Mage_Rule' => true,
246
+ 'Mage_Catalog' => true,
247
+ 'Mage_Customer' => true,
248
+ 'Mage_Payment' => true,
249
+ ),
250
+ 'active' => true,
251
+ ),
252
+ 'Mage_SalesRule' =>
253
+ array(
254
+ 'module' => 'Mage_SalesRule',
255
+ 'depends' =>
256
+ array(
257
+ 'Mage_Rule' => true,
258
+ 'Mage_Catalog' => true,
259
+ 'Mage_Sales' => true,
260
+ ),
261
+ 'active' => true,
262
+ ),
263
+ 'Mage_Checkout' =>
264
+ array(
265
+ 'module' => 'Mage_Checkout',
266
+ 'depends' =>
267
+ array(
268
+ 'Mage_Sales' => true,
269
+ 'Mage_CatalogInventory' => true,
270
+ ),
271
+ 'active' => true,
272
+ ),
273
+ 'Mage_Shipping' =>
274
+ array(
275
+ 'module' => 'Mage_Shipping',
276
+ 'depends' =>
277
+ array(
278
+ 'Mage_Core' => true,
279
+ 'Mage_Catalog' => true,
280
+ ),
281
+ 'active' => true,
282
+ ),
283
+ 'Mage_Payment' =>
284
+ array(
285
+ 'module' => 'Mage_Payment',
286
+ 'depends' =>
287
+ array(
288
+ 'Mage_Core' => true,
289
+ 'Mage_Catalog' => true,
290
+ ),
291
+ 'active' => true,
292
+ ),
293
+ 'Mage_Usa' =>
294
+ array(
295
+ 'module' => 'Mage_Usa',
296
+ 'depends' =>
297
+ array(
298
+ 'Mage_Sales' => true,
299
+ 'Mage_Shipping' => true,
300
+ ),
301
+ 'active' => false,
302
+ ),
303
+ 'Mage_Paygate' =>
304
+ array(
305
+ 'module' => 'Mage_Paygate',
306
+ 'depends' =>
307
+ array(
308
+ 'Mage_Payment' => true,
309
+ ),
310
+ 'active' => true,
311
+ ),
312
+ 'Mage_Paypal' =>
313
+ array(
314
+ 'module' => 'Mage_Paypal',
315
+ 'depends' =>
316
+ array(
317
+ 'Mage_Paygate' => true,
318
+ 'Mage_Checkout' => true,
319
+ 'Mage_Sales' => true,
320
+ ),
321
+ 'active' => false,
322
+ ),
323
+ 'Mage_PaypalUk' =>
324
+ array(
325
+ 'module' => 'Mage_PaypalUk',
326
+ 'depends' =>
327
+ array(
328
+ 'Mage_Paygate' => true,
329
+ 'Mage_Checkout' => true,
330
+ 'Mage_Sales' => true,
331
+ 'Mage_Paypal' => true,
332
+ ),
333
+ 'active' => false,
334
+ ),
335
+ 'Mage_GoogleCheckout' =>
336
+ array(
337
+ 'module' => 'Mage_GoogleCheckout',
338
+ 'depends' =>
339
+ array(
340
+ 'Mage_Sales' => true,
341
+ 'Mage_Payment' => true,
342
+ 'Mage_Usa' => true,
343
+ ),
344
+ 'active' => false,
345
+ ),
346
+ 'Mage_Log' =>
347
+ array(
348
+ 'module' => 'Mage_Log',
349
+ 'depends' =>
350
+ array(
351
+ 'Mage_Core' => true,
352
+ 'Mage_Customer' => true,
353
+ ),
354
+ 'active' => false,
355
+ ),
356
+ 'Mage_Backup' =>
357
+ array(
358
+ 'module' => 'Mage_Backup',
359
+ 'depends' =>
360
+ array(
361
+ 'Mage_Core' => true,
362
+ ),
363
+ 'active' => false,
364
+ ),
365
+ 'Mage_Poll' =>
366
+ array(
367
+ 'module' => 'Mage_Poll',
368
+ 'depends' =>
369
+ array(
370
+ 'Mage_Core' => true,
371
+ 'Mage_Cms' => true,
372
+ ),
373
+ 'active' => false,
374
+ ),
375
+ 'Mage_Rating' =>
376
+ array(
377
+ 'module' => 'Mage_Rating',
378
+ 'depends' =>
379
+ array(
380
+ 'Mage_Core' => true,
381
+ 'Mage_Review' => true,
382
+ ),
383
+ 'active' => false,
384
+ ),
385
+ 'Mage_Review' =>
386
+ array(
387
+ 'module' => 'Mage_Review',
388
+ 'depends' =>
389
+ array(
390
+ 'Mage_Catalog' => true,
391
+ 'Mage_Core' => true,
392
+ ),
393
+ 'active' => false,
394
+ ),
395
+ 'Mage_Tag' =>
396
+ array(
397
+ 'module' => 'Mage_Tag',
398
+ 'depends' =>
399
+ array(
400
+ 'Mage_Catalog' => true,
401
+ ),
402
+ 'active' => false,
403
+ ),
404
+ 'Mage_Cms' =>
405
+ array(
406
+ 'module' => 'Mage_Cms',
407
+ 'depends' =>
408
+ array(
409
+ 'Mage_Core' => true,
410
+ ),
411
+ 'active' => true,
412
+ ),
413
+ 'Mage_Reports' =>
414
+ array(
415
+ 'module' => 'Mage_Reports',
416
+ 'depends' =>
417
+ array(
418
+ 'Mage_Customer' => true,
419
+ 'Mage_Catalog' => true,
420
+ 'Mage_Sales' => true,
421
+ 'Mage_Cms' => true,
422
+ ),
423
+ 'active' => true,
424
+ ),
425
+ 'Mage_Newsletter' =>
426
+ array(
427
+ 'module' => 'Mage_Newsletter',
428
+ 'depends' =>
429
+ array(
430
+ 'Mage_Core' => true,
431
+ 'Mage_Customer' => true,
432
+ 'Mage_Eav' => true,
433
+ 'Mage_Widget' => true,
434
+ ),
435
+ 'active' => true,
436
+ ),
437
+ 'Mage_Tax' =>
438
+ array(
439
+ 'module' => 'Mage_Tax',
440
+ 'depends' =>
441
+ array(
442
+ 'Mage_Catalog' => true,
443
+ 'Mage_Customer' => true,
444
+ ),
445
+ 'active' => true,
446
+ ),
447
+ 'Mage_Wishlist' =>
448
+ array(
449
+ 'module' => 'Mage_Wishlist',
450
+ 'depends' =>
451
+ array(
452
+ 'Mage_Customer' => true,
453
+ 'Mage_Catalog' => true,
454
+ ),
455
+ 'active' => false,
456
+ ),
457
+ 'Mage_GoogleAnalytics' =>
458
+ array(
459
+ 'module' => 'Mage_GoogleAnalytics',
460
+ 'depends' =>
461
+ array(
462
+ 'Mage_Core' => true,
463
+ ),
464
+ 'active' => true,
465
+ ),
466
+ 'Mage_CatalogInventory' =>
467
+ array(
468
+ 'module' => 'Mage_CatalogInventory',
469
+ 'depends' =>
470
+ array(
471
+ 'Mage_Catalog' => true,
472
+ ),
473
+ 'active' => true,
474
+ ),
475
+ 'Mage_GiftMessage' =>
476
+ array(
477
+ 'module' => 'Mage_GiftMessage',
478
+ 'depends' =>
479
+ array(
480
+ 'Mage_Catalog' => true,
481
+ 'Mage_Sales' => true,
482
+ ),
483
+ 'active' => true,
484
+ ),
485
+ 'Mage_Sendfriend' =>
486
+ array(
487
+ 'module' => 'Mage_Sendfriend',
488
+ 'depends' =>
489
+ array(
490
+ 'Mage_Catalog' => true,
491
+ ),
492
+ 'active' => false,
493
+ ),
494
+ 'Mage_Media' =>
495
+ array(
496
+ 'module' => 'Mage_Media',
497
+ 'depends' =>
498
+ array(
499
+ 'Mage_Core' => true,
500
+ ),
501
+ 'active' => true,
502
+ ),
503
+ 'Mage_Sitemap' =>
504
+ array(
505
+ 'module' => 'Mage_Sitemap',
506
+ 'depends' =>
507
+ array(
508
+ 'Mage_Catalog' => true,
509
+ ),
510
+ 'active' => true,
511
+ ),
512
+ 'Mage_Contacts' =>
513
+ array(
514
+ 'module' => 'Mage_Contacts',
515
+ 'depends' =>
516
+ array(
517
+ 'Mage_Core' => true,
518
+ ),
519
+ 'active' => true,
520
+ ),
521
+ 'Mage_Dataflow' =>
522
+ array(
523
+ 'module' => 'Mage_Dataflow',
524
+ 'depends' =>
525
+ array(
526
+ 'Mage_Core' => true,
527
+ ),
528
+ 'active' => false,
529
+ ),
530
+ 'Mage_Rss' =>
531
+ array(
532
+ 'module' => 'Mage_Rss',
533
+ 'depends' =>
534
+ array(
535
+ 'Mage_Catalog' => true,
536
+ 'Mage_CatalogInventory' => true,
537
+ 'Mage_Sales' => true,
538
+ 'Mage_SalesRule' => true,
539
+ 'Mage_Wishlist' => true,
540
+ ),
541
+ 'active' => false,
542
+ ),
543
+ 'Mage_ProductAlert' =>
544
+ array(
545
+ 'module' => 'Mage_ProductAlert',
546
+ 'depends' =>
547
+ array(
548
+ 'Mage_Catalog' => true,
549
+ 'Mage_Customer' => true,
550
+ ),
551
+ 'active' => false,
552
+ ),
553
+ 'Mage_Index' =>
554
+ array(
555
+ 'module' => 'Mage_Index',
556
+ 'depends' =>
557
+ array(
558
+ 'Mage_Core' => true,
559
+ ),
560
+ 'active' => true,
561
+ ),
562
+ 'Mage_Api' =>
563
+ array(
564
+ 'module' => 'Mage_Api',
565
+ 'depends' =>
566
+ array(
567
+ 'Mage_Core' => true,
568
+ ),
569
+ 'active' => true,
570
+ ),
571
+ 'Mage_Api2' =>
572
+ array(
573
+ 'module' => 'Mage_Api2',
574
+ 'depends' =>
575
+ array(
576
+ 'Mage_Core' => true,
577
+ 'Mage_Oauth' => true,
578
+ ),
579
+ 'active' => true,
580
+ ),
581
+ 'Mage_Authorizenet' =>
582
+ array(
583
+ 'module' => 'Mage_Authorizenet',
584
+ 'depends' =>
585
+ array(
586
+ 'Mage_Paygate' => true,
587
+ 'Mage_Sales' => true,
588
+ 'Mage_Checkout' => true,
589
+ ),
590
+ 'active' => false,
591
+ ),
592
+ 'Mage_Bundle' =>
593
+ array(
594
+ 'module' => 'Mage_Bundle',
595
+ 'depends' =>
596
+ array(
597
+ 'Mage_Catalog' => true,
598
+ ),
599
+ 'active' => true,
600
+ ),
601
+ 'Mage_Captcha' =>
602
+ array(
603
+ 'module' => 'Mage_Captcha',
604
+ 'depends' =>
605
+ array(
606
+ 'Mage_Customer' => true,
607
+ 'Mage_Adminhtml' => true,
608
+ ),
609
+ 'active' => false,
610
+ ),
611
+ 'Mage_Centinel' =>
612
+ array(
613
+ 'module' => 'Mage_Centinel',
614
+ 'depends' =>
615
+ array(
616
+ 'Mage_Payment' => true,
617
+ 'Mage_Checkout' => true,
618
+ ),
619
+ 'active' => true,
620
+ ),
621
+ 'Mage_Compiler' =>
622
+ array(
623
+ 'module' => 'Mage_Compiler',
624
+ 'depends' =>
625
+ array(
626
+ 'Mage_Core' => true,
627
+ ),
628
+ 'active' => false,
629
+ ),
630
+ 'Mage_Connect' =>
631
+ array(
632
+ 'module' => 'Mage_Connect',
633
+ 'depends' =>
634
+ array(),
635
+ 'active' => false,
636
+ ),
637
+ 'Mage_CurrencySymbol' =>
638
+ array(
639
+ 'module' => 'Mage_CurrencySymbol',
640
+ 'depends' =>
641
+ array(
642
+ 'Mage_Widget' => true,
643
+ ),
644
+ 'active' => true,
645
+ ),
646
+ 'Mage_Downloadable' =>
647
+ array(
648
+ 'module' => 'Mage_Downloadable',
649
+ 'depends' =>
650
+ array(
651
+ 'Mage_Catalog' => true,
652
+ ),
653
+ 'active' => true,
654
+ ),
655
+ 'Mage_ImportExport' =>
656
+ array(
657
+ 'module' => 'Mage_ImportExport',
658
+ 'depends' =>
659
+ array(
660
+ 'Mage_Catalog' => true,
661
+ ),
662
+ 'active' => true,
663
+ ),
664
+ 'Mage_Oauth' =>
665
+ array(
666
+ 'module' => 'Mage_Oauth',
667
+ 'depends' =>
668
+ array(
669
+ 'Mage_Core' => true,
670
+ ),
671
+ 'active' => true,
672
+ ),
673
+ 'Mage_PageCache' =>
674
+ array(
675
+ 'module' => 'Mage_PageCache',
676
+ 'depends' =>
677
+ array(
678
+ 'Mage_Core' => true,
679
+ ),
680
+ 'active' => true,
681
+ ),
682
+ 'Mage_Persistent' =>
683
+ array(
684
+ 'module' => 'Mage_Persistent',
685
+ 'depends' =>
686
+ array(
687
+ 'Mage_Adminhtml' => true,
688
+ 'Mage_Checkout' => true,
689
+ ),
690
+ 'active' => true,
691
+ ),
692
+ 'Mage_Weee' =>
693
+ array(
694
+ 'module' => 'Mage_Weee',
695
+ 'depends' =>
696
+ array(
697
+ 'Mage_Catalog' => true,
698
+ 'Mage_Tax' => true,
699
+ 'Mage_Sales' => true,
700
+ ),
701
+ 'active' => true,
702
+ ),
703
+ 'Mage_Widget' =>
704
+ array(
705
+ 'module' => 'Mage_Widget',
706
+ 'depends' =>
707
+ array(
708
+ 'Mage_Cms' => true,
709
+ ),
710
+ 'active' => true,
711
+ ),
712
+ 'Mage_XmlConnect' =>
713
+ array(
714
+ 'module' => 'Mage_XmlConnect',
715
+ 'depends' =>
716
+ array(
717
+ 'Mage_Checkout' => true,
718
+ 'Mage_Paypal' => true,
719
+ 'Mage_Usa' => true,
720
+ 'Mage_Tax' => true,
721
+ 'Mage_Weee' => true,
722
+ 'Mage_Catalog' => true,
723
+ 'Mage_CatalogSearch' => true,
724
+ 'Mage_CatalogInventory' => true,
725
+ 'Mage_Bundle' => true,
726
+ 'Mage_Wishlist' => true,
727
+ 'Mage_Rating' => true,
728
+ 'Mage_Review' => true,
729
+ ),
730
+ 'active' => false,
731
+ ),
732
+
733
+ 'Phoenix_Moneybookers' =>
734
+ array(
735
+ 'module' => 'Phoenix_Moneybookers',
736
+ 'depends' =>
737
+ array(),
738
+ 'active' => false,
739
+ ),
740
+
741
+ 'Mage_GoogleBase' =>
742
+ array(
743
+ 'module' => 'Mage_GoogleBase',
744
+ 'depends' =>
745
+ array(),
746
+ 'active' => false,
747
+ ),
748
+
749
+ );
750
+ }
751
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/AbstractTest.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Helper
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_AbstractTest extends EcomDev_PHPUnit_Test_Case
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Abstract';
13
+
14
+ /**
15
+ * @return Zookal_Mock_Model_Mocks_Abstract
16
+ */
17
+ public function getInstance()
18
+ {
19
+ return $this->getMockForAbstractClass($this->class);
20
+ }
21
+
22
+ /**
23
+ * @test
24
+ */
25
+ public function itShouldExist()
26
+ {
27
+ $this->assertTrue(class_exists($this->class), "Failed asserting {$this->class} exists");
28
+ }
29
+
30
+ /**
31
+ * @test
32
+ */
33
+ public function itShouldBeAnInstanceOfMocksAbstract()
34
+ {
35
+ $this->assertInstanceOf($this->class, $this->getInstance());
36
+ }
37
+
38
+ /**
39
+ * @test
40
+ */
41
+ public function itShouldHaveAMethod__Call()
42
+ {
43
+ $this->assertTrue(method_exists($this->class, '__call'));
44
+ }
45
+
46
+ /**
47
+ * @test
48
+ */
49
+ public function itShouldHaveAMethodGetMessages()
50
+ {
51
+ $this->assertTrue(method_exists($this->class, 'getMessages'));
52
+ }
53
+
54
+ /**
55
+ * @test
56
+ */
57
+ public function itShouldHaveAMethodGetMockMethodsReturnThis()
58
+ {
59
+ $this->assertTrue(method_exists($this->class, 'getMockMethodsReturnThis'));
60
+ }
61
+
62
+ /**
63
+ * @test
64
+ */
65
+ public function itShouldHaveAMethodgetMockMethodsReturnNull()
66
+ {
67
+ $this->assertTrue(method_exists($this->class, 'getMockMethodsReturnNull'));
68
+ }
69
+
70
+ /**
71
+ * @test
72
+ */
73
+ public function itShouldHaveAMethodgetMockMethodsReturnFalse()
74
+ {
75
+ $this->assertTrue(method_exists($this->class, 'getMockMethodsReturnFalse'));
76
+ }
77
+
78
+ /**
79
+ * @test
80
+ */
81
+ public function itShouldReturnAMessageCollectionWhenCallingGetMessagesMethod()
82
+ {
83
+ $this->assertInstanceOf('Mage_Core_Model_Message_Collection', $this->getInstance()->getMessages());
84
+ }
85
+
86
+ /**
87
+ * @test
88
+ */
89
+ public function itShouldReturnTheMocksHelper()
90
+ {
91
+ $this->assertInstanceOf('Zookal_Mock_Helper_Data', $this->getInstance()->getHelper());
92
+ }
93
+
94
+ /**
95
+ * @test
96
+ */
97
+ public function itShouldReturnThis()
98
+ {
99
+ $instance = $this->getInstance();
100
+ $thisMethods = $instance->getMockMethodsReturnThis();
101
+ foreach ($thisMethods as $method => $int) {
102
+ $this->assertInstanceOf($this->class, $instance->$method());
103
+ }
104
+ }
105
+
106
+ /**
107
+ * @test
108
+ */
109
+ public function itShouldReturnThisWhenCallingACollection()
110
+ {
111
+ $instance = $this->getInstance();
112
+ $this->assertInstanceOf($this->class, $instance->getWildCatsCollection());
113
+ }
114
+
115
+ /**
116
+ * @test
117
+ */
118
+ public function itShouldReturnNull()
119
+ {
120
+ $instance = $this->getInstance();
121
+ $thisMethods = $instance->getMockMethodsReturnNull();
122
+ foreach ($thisMethods as $method => $int) {
123
+ $this->assertNull($instance->$method());
124
+ }
125
+ }
126
+
127
+ /**
128
+ * @test
129
+ */
130
+ public function itShouldReturnFalse()
131
+ {
132
+ $instance = $this->getInstance();
133
+ $thisMethods = $instance->getMockMethodsReturnFalse();
134
+ foreach ($thisMethods as $method => $int) {
135
+ $this->assertFalse($instance->$method());
136
+ }
137
+ }
138
+
139
+ /**
140
+ * @test
141
+ * @expectedException Varien_Exception
142
+ */
143
+ public function itShouldThrowAnExceptionWhenCallingUnknownMethod()
144
+ {
145
+ $this->getInstance()->zzz();
146
+ }
147
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/AbstractPHPUnitTestCase.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ abstract class Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase extends EcomDev_PHPUnit_Test_Case
11
+ {
12
+ protected $class = null;
13
+
14
+ public function getInstance()
15
+ {
16
+ return new $this->class;
17
+ }
18
+
19
+ /**
20
+ * @test
21
+ */
22
+ public function itShouldExist()
23
+ {
24
+ $this->assertTrue(class_exists($this->class), "Failed asserting {$this->class} exists");
25
+ }
26
+
27
+ /**
28
+ * @test
29
+ */
30
+ public function itShouldBeAnInstanceOfMocksAbstract()
31
+ {
32
+ $this->assertInstanceOf('Zookal_Mock_Model_Mocks_Abstract', $this->getInstance());
33
+ }
34
+
35
+ /**
36
+ * @return string
37
+ */
38
+ protected function _trickAutoloader()
39
+ {
40
+ // move our path to the beginning to trick auto loader
41
+ $path = array('app', 'code', 'community', 'Zookal', 'Mock', 'Model', 'Mocks');
42
+ $path = implode(DS, $path);
43
+
44
+ $pathParts = explode(PS, get_include_path());
45
+ $mockPath = '';
46
+ foreach ($pathParts as $k => $v) {
47
+ if (false !== strpos($v, $path)) {
48
+ $mockPath = $v;
49
+ unset($pathParts[$k]);
50
+ }
51
+ }
52
+ return set_include_path($mockPath . PS . implode(PS, $pathParts));
53
+ }
54
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/AdminNotification/Model/SurveyTest.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+
11
+ /**
12
+ * Class Mage_AdminNotification_Model_Survey
13
+ * Do not change the class name, as it is needed for the autoloader because this class is somewhere in Magentos source code hardcoded :-(
14
+ * @see Zookal_Mock_Model_Observer::_setMockIncludePath
15
+ */
16
+ class Zookal_Mock_Test_Model_Mocks_Mage_AdminNotification_Model_SurveyTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
17
+ {
18
+ //protected $class = 'Mage_AdminNotification_Model_Survey';
19
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Block'; // dummy for passing the test
20
+ // @todo implement test but change the model path and getIncludePath PHP in the config so that the mock class Mage_Tag_Model_Tag will get loaded
21
+
22
+ // public static function isSurveyViewed()
23
+ // {
24
+ // return true;
25
+ // }
26
+ //
27
+ // public static function isSurveyUrlValid()
28
+ // {
29
+ // return false;
30
+ // }
31
+ //
32
+ // public static function getSurveyUrl()
33
+ // {
34
+ // return '';
35
+ // }
36
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Adminhtml/Helper/DataTest.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+
11
+ /**
12
+ * Class Mage_Adminhtml_Helper_Data
13
+ * Do not change the class name, as it is needed for the autoloader
14
+ * @see Zookal_Mock_Model_Observer::_setMockIncludePath
15
+ */
16
+ class Zookal_Mock_Test_Model_Mocks_Mage_Adminhtml_Helper_DataTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
17
+ {
18
+ //protected $class = 'Mage_Adminhtml_Helper_Data';
19
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Block'; // dummy for passing the test
20
+ // @todo implement test but change the model path and getIncludePath PHP in the config so that the mock class Mage_Tag_Model_Tag will get loaded
21
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/BlockTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_BlockTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Block';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Category/CollectionTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Category_CollectionTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Category_Collection';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Category/TreeTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Category_TreeTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Category_Tree';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/CategoryTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_CategoryTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Category';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Class/Source/CustomerTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Class_Source_CustomerTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Class_Source_Customer';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Customer/CollectionTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Customer_CollectionTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Customer_Collection';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/CustomerTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_CustomerTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Customer';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/DataTest.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_DataTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Data';
13
+
14
+ /**
15
+ * @test
16
+ */
17
+ public function itShouldHaveA__Method()
18
+ {
19
+ $this->assertTrue(method_exists($this->class, '__'));
20
+ }
21
+
22
+ /**
23
+ * @test
24
+ */
25
+ public function itShouldReturnTheInputWhenCalling__()
26
+ {
27
+ $this->assertEquals('A dog barks', $this->getInstance()->__('A dog barks'));
28
+ }
29
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/GroupTest.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_GroupTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Group';
13
+
14
+ /**
15
+ * @test
16
+ */
17
+ public function itShouldHaveAGetTaxClassIdMethod()
18
+ {
19
+ $this->assertTrue(method_exists($this->class, 'getTaxClassId'));
20
+ }
21
+
22
+ /**
23
+ * @test
24
+ */
25
+ public function itShouldReturnOne()
26
+ {
27
+ $this->assertEquals(1, $this->getInstance()->getTaxClassId());
28
+ }
29
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/ItemTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_ItemTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Item';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Log/Model/VisitorTest.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+
11
+ /**
12
+ * Class Mage_Log_Model_Visitor
13
+ * Do not change the class name, as it is needed for the autoloader because this class is somewhere in Magentos source code hardcoded :-(
14
+ * @see Zookal_Mock_Model_Observer::_setMockIncludePath
15
+ */
16
+ class Zookal_Mock_Test_Model_Mocks_Mage_Log_Model_VisitorTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
17
+ {
18
+ protected function setUp()
19
+ {
20
+ parent::setUp();
21
+ $this->_trickAutoloader();
22
+ }
23
+
24
+ protected $class = 'Mage_Log_Model_Visitor';
25
+
26
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/LogTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_LogTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Log';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Order/CollectionTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Order_CollectionTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Order_Collection';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Order/Grid/CollectionTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Order_Grid_CollectionTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Order_Grid_Collection';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/PaymentTest.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_PaymentTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Payment';
13
+
14
+ /**
15
+ * @param boolean $isAdmin
16
+ *
17
+ * @return mixed
18
+ */
19
+ public function getInstance($isAdmin = false)
20
+ {
21
+ $stubStore = $this->getMock('Mage_Core_Model_Store');
22
+ $stubStore->expects($this->any())
23
+ ->method('isAdmin')
24
+ ->will($this->returnValue($isAdmin));
25
+ return new $this->class(null, $stubStore);
26
+ }
27
+
28
+ /**
29
+ * @test
30
+ */
31
+ public function itShouldHaveAGetInfoBlockType()
32
+ {
33
+ $this->assertTrue(method_exists($this->class, 'getInfoBlockType'));
34
+ }
35
+
36
+ /**
37
+ * @test
38
+ */
39
+ public function itShouldHaveAGetMethodFormBlock()
40
+ {
41
+ $this->assertTrue(method_exists($this->class, 'getMethodFormBlock'));
42
+ }
43
+
44
+ /**
45
+ * @test
46
+ */
47
+ public function itShouldReturnTheInfoBlockTypeFrontend()
48
+ {
49
+ $this->assertEquals('zookal_mock/payment_frontend', $this->getInstance(false)->getInfoBlockType());
50
+ }
51
+
52
+ /**
53
+ * @test
54
+ */
55
+ public function itShouldReturnTheInfoBlockTypeBackend()
56
+ {
57
+ $this->assertEquals('zookal_mock/payment_backend', $this->getInstance(true)->getInfoBlockType());
58
+ }
59
+
60
+ /**
61
+ * @test
62
+ */
63
+ public function itShouldReturnThePaymentBlockBackend()
64
+ {
65
+ $this->assertInstanceOf('Zookal_Mock_Block_Payment_Backend', $this->getInstance()->getMethodFormBlock());
66
+ }
67
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Product/CollectionTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Product_CollectionTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Product_Collection';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/ProductTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_ProductTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Product';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Profile/CollectionTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Profile_CollectionTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Profile_Collection';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Queue/CollectionTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Queue_CollectionTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Queue_Collection';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/QuoteTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_QuoteTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Quote';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/ReviewTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_ReviewTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Review';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Sale/CollectionTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Sale_CollectionTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Sale_Collection';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/SessionTest.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_SessionTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Session';
13
+
14
+ /**
15
+ * @test
16
+ */
17
+ public function itShouldHaveMethodGetCustomerGroupId()
18
+ {
19
+ $this->assertTrue(method_exists($this->class, 'getCustomerGroupId'));
20
+ }
21
+
22
+ /**
23
+ * @test
24
+ */
25
+ public function itShouldReturnZero()
26
+ {
27
+ $this->assertEquals(0, $this->getInstance()->getCustomerGroupId());
28
+ }
29
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/SubscriberTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_SubscriberTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Subscriber';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Tag/Model/TagTest.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Model
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Tag_Model_TagTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Mage_Tag_Model_Tag';
13
+
14
+ protected function setUp()
15
+ {
16
+ parent::setUp();
17
+ $this->_trickAutoloader();
18
+ }
19
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/TagTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_TagTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Tag';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Tax/ClassTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_Tax_ClassTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Tax_Class';
13
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/Visitor/OnlineTest.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Zookal_Mock_Test_Model_Mocks_Mage_Visitor_OnlineTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
4
+ {
5
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Visitor_Online';
6
+ }
app/code/community/Zookal/Mock/Test/Model/Mocks/Mage/VisitorTest.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Test
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_Mocks_Mage_VisitorTest extends Zookal_Mock_Test_Model_Mocks_Mage_AbstractPHPUnitTestCase
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Mocks_Mage_Visitor';
13
+ }
app/code/community/Zookal/Mock/Test/Model/ObserverTest.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Zookal_Mock
5
+ * @package Helper
6
+ * @author Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
+ * @copyright Copyright (c) Zookal Pty Ltd
8
+ * @license OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
+ */
10
+ class Zookal_Mock_Test_Model_ObserverTest extends EcomDev_PHPUnit_Test_Case
11
+ {
12
+ protected $class = 'Zookal_Mock_Model_Observer';
13
+
14
+ /**
15
+ * @return Zookal_Mock_Model_Observer
16
+ */
17
+ public function getInstance()
18
+ {
19
+ $instance = new $this->class;
20
+
21
+ return $instance;
22
+ }
23
+
24
+ /**
25
+ * @test
26
+ */
27
+ public function itShouldExist()
28
+ {
29
+ $this->assertTrue(class_exists($this->class), "Failed asserting {$this->class} exists");
30
+ }
31
+
32
+ /**
33
+ * @test
34
+ */
35
+ public function itShouldHaveAMethodMockDisabledModules()
36
+ {
37
+ $this->assertTrue(is_callable(array($this->class, 'mockDisabledModules')));
38
+ }
39
+
40
+ /**
41
+ * @test
42
+ */
43
+ public function itShouldMockDisabledModules()
44
+ {
45
+ $this->assertTrue(true); // @todo
46
+ }
47
+ }
app/code/community/Zookal/Mock/etc/config.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Zookal_Mock>
5
+ <version>1.0.0</version>
6
+ </Zookal_Mock>
7
+ </modules>
8
+
9
+ <global>
10
+ <helpers>
11
+ <zookal_mock>
12
+ <class>Zookal_Mock_Helper</class>
13
+ </zookal_mock>
14
+ </helpers>
15
+ <models>
16
+ <zookal_mock>
17
+ <class>Zookal_Mock_Model</class>
18
+ </zookal_mock>
19
+ </models>
20
+ <blocks>
21
+ <zookal_mock>
22
+ <class>Zookal_Mock_Block</class>
23
+ </zookal_mock>
24
+ </blocks>
25
+ <events>
26
+ <controller_front_init_before>
27
+ <observers>
28
+ <zookal_mock_create_mock>
29
+ <class>zookal_mock/observer</class>
30
+ <method>mockDisabledModules</method>
31
+ </zookal_mock_create_mock>
32
+ </observers>
33
+ </controller_front_init_before>
34
+ </events>
35
+ </global>
36
+ <adminhtml>
37
+ <translate>
38
+ <modules>
39
+ <Mage_Cms>
40
+ <files>
41
+ <default>Zookal_Mock.csv</default>
42
+ </files>
43
+ </Mage_Cms>
44
+ </modules>
45
+ </translate>
46
+ </adminhtml>
47
+ <default>
48
+ <system>
49
+ <zookalmock>
50
+ <enable_method_log>0</enable_method_log>
51
+ </zookalmock>
52
+ </system>
53
+ </default>
54
+ <phpunit>
55
+ <suite>
56
+ <modules>
57
+ <Zookal_Mock/>
58
+ </modules>
59
+ </suite>
60
+ </phpunit>
61
+ </config>
app/code/community/Zookal/Mock/etc/system.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <system>
5
+ <groups>
6
+ <zookalmock translate="label">
7
+ <label>Object Mock [Zookal_Mock Module]</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>301</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <enable_method_log>
15
+ <label>Enable logging of used methods</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ <comment>Please use only during development!</comment>
23
+ </enable_method_log>
24
+ </fields>
25
+ </zookalmock>
26
+ </groups>
27
+ </system>
28
+ </sections>
29
+ </config>
app/etc/modules/Zookal_Mock.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Zookal_Mock>
5
+ <codePool>community</codePool>
6
+ <active>true</active>
7
+ </Zookal_Mock>
8
+ </modules>
9
+ </config>
app/locale/en_US/Zookal_Mock.csv ADDED
@@ -0,0 +1,2 @@
 
 
1
+ "method","Payment Method"
2
+ "Module Disabled!","Module Disabled!"
package.xml ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Zookal_Mock</name>
4
+ <version>1.0.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://github.com/Zookal/magento-mock">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Transparent auto detecting of disabled core modules &amp; exten. Providing mock objects for not breaking Magento.</summary>
10
+ <description>&lt;h1&gt;&#xD;
11
+ Mock Objects&lt;/h1&gt;&#xD;
12
+ &#xD;
13
+ &lt;h5&gt;&#xD;
14
+ TL;DR: Transparent autodetecting of disabled core modules and extensions and providing mock objects for not&#xD;
15
+ breaking Magento. Nothing to configure. No class rewrites. Only one observer. Works out of the box.&lt;/h5&gt;&#xD;
16
+ &#xD;
17
+ &lt;p&gt;If you try to disable e.g. Mage_Newsletter or Mage_Wishlist or ... and you call certain parts of the backend or some rare parts of the frontend you will get&#xD;
18
+ errors that Magento cannot find the class XYZ. Best examples are the two previoulsy mentioned. If you have disabled them and you open in the backend a&#xD;
19
+ customer entry to edit it, the page will generate an error. Mage_Customer Edit has many dependencies with other modules. So the &lt;strong&gt;Zookal Mock&#xD;
20
+ Module&lt;/strong&gt; will provide you mock objects which catches all method calls to disabled classes of that modules without breaking anything.&lt;/p&gt;&#xD;
21
+ &#xD;
22
+ &lt;p&gt;&lt;strong&gt;Uninstalling payment modules&lt;/strong&gt;: If you try to remove a payment module (&lt;em&gt;which has already been used by customers in the checkout&lt;/em&gt;) you&#xD;
23
+ cannot open anymore all orders associated with that module. The reason is that the tables &lt;code&gt;sales_flat_*_payment&lt;/code&gt; contains in the column &lt;code&gt;method&lt;/code&gt;&#xD;
24
+ the method which referers to the model for loading payment relevant informations. Please see below how to uninstall your payment module without touching&#xD;
25
+ database tables.&lt;/p&gt;&#xD;
26
+ &#xD;
27
+ &lt;h2&gt;Which modules or extensions causes challenges?&lt;/h2&gt;&#xD;
28
+ &#xD;
29
+ &lt;p&gt;If one or all of the following modules (until now) are disabled they will then break the rest of the core:&lt;/p&gt;&#xD;
30
+ &#xD;
31
+ &lt;ul&gt;&#xD;
32
+ &lt;li&gt;Mage_Wishlist&lt;/li&gt;&#xD;
33
+ &lt;li&gt;Mage_Weee&lt;/li&gt;&#xD;
34
+ &lt;li&gt;Mage_Review&lt;/li&gt;&#xD;
35
+ &lt;li&gt;Mage_Rating&lt;/li&gt;&#xD;
36
+ &lt;li&gt;Mage_Tag&lt;/li&gt;&#xD;
37
+ &lt;li&gt;Mage_Tax&lt;/li&gt;&#xD;
38
+ &lt;li&gt;Mage_Log&lt;/li&gt;&#xD;
39
+ &lt;li&gt;Mage_Backup&lt;/li&gt;&#xD;
40
+ &lt;li&gt;Mage_Customer&lt;/li&gt;&#xD;
41
+ &lt;li&gt;Mage_Checkout&lt;/li&gt;&#xD;
42
+ &lt;li&gt;Mage_Sales&lt;/li&gt;&#xD;
43
+ &lt;li&gt;Mage_Cms&lt;/li&gt;&#xD;
44
+ &lt;li&gt;Mage_Catalog&lt;/li&gt;&#xD;
45
+ &lt;li&gt;Mage_Adminhtml&lt;/li&gt;&#xD;
46
+ &lt;li&gt;Mage_GiftMessages&lt;/li&gt;&#xD;
47
+ &lt;li&gt;Mage_GoogleCheckout&lt;/li&gt;&#xD;
48
+ &lt;li&gt;All payment modules&lt;/li&gt;&#xD;
49
+ &lt;li&gt;and some more ... test it :-)&lt;/li&gt;&#xD;
50
+ &lt;/ul&gt;&#xD;
51
+ &lt;p&gt;Also we can't delete the database tables from some disabled modules as e.g. CatalogIndex relies von customer_group tables&#xD;
52
+ or Customer relies on some tax tables when tax is disabled.&lt;/p&gt;&#xD;
53
+ &#xD;
54
+ &lt;p&gt;At Zookal we have the following modules disabled: Mage_AdminNotification, Mage_Authorizenet, Mage_Backup, Mage_Captcha, Mage_Compiler, Mage_Connect,&#xD;
55
+ Mage_GoogleCheckout, Mage_GoogleBase, Mage_Install, Mage_Log, Mage_Paypal, Mage_PaypalUk, Mage_Poll, Mage_ProductAlert, Mage_Review, Mage_Rating,&#xD;
56
+ Mage_Rss, Mage_Sendfriend, Mage_Tag, Mage_Usa, Mage_Wishlist, Mage_XmlConnect, Phoenix_Moneybookers.&lt;/p&gt;&#xD;
57
+ &#xD;
58
+ &lt;h2&gt;&#xD;
59
+ How do I&#xD;
60
+ disable a module?&lt;/h2&gt;&#xD;
61
+ &#xD;
62
+ &lt;p&gt;Add in your custom app/etc/modules/Vendor_NameSpace.xml&lt;/p&gt;&#xD;
63
+ &#xD;
64
+ &lt;div class="highlight highlight-xml"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;config&amp;gt;&lt;/span&gt;&#xD;
65
+ &lt;span class="nt"&gt;&amp;lt;modules&amp;gt;&lt;/span&gt;&#xD;
66
+ &lt;span class="nt"&gt;&amp;lt;Mage_ModuleName&amp;gt;&lt;/span&gt;&#xD;
67
+ &lt;span class="nt"&gt;&amp;lt;active&amp;gt;&lt;/span&gt;false&lt;span class="nt"&gt;&amp;lt;/active&amp;gt;&lt;/span&gt;&#xD;
68
+ &lt;span class="nt"&gt;&amp;lt;/Mage_ModuleName&amp;gt;&lt;/span&gt;&#xD;
69
+ &lt;span class="nt"&gt;&amp;lt;/modules&amp;gt;&lt;/span&gt;&#xD;
70
+ &lt;span class="nt"&gt;&amp;lt;/config&amp;gt;&lt;/span&gt;&#xD;
71
+ &lt;/pre&gt;&#xD;
72
+ &lt;/div&gt;&#xD;
73
+ &#xD;
74
+ &lt;h2&gt;&#xD;
75
+ How do I uninstall a payment module?&lt;/h2&gt;&#xD;
76
+ &#xD;
77
+ &lt;p&gt;An example would be if you switch from one Stripe payment module to another or changing the credit card payment provider.&lt;/p&gt;&#xD;
78
+ &#xD;
79
+ &lt;p&gt;Simply delete/uninstall all module relevant files.&lt;/p&gt;&#xD;
80
+ &#xD;
81
+ &lt;p&gt;In one of your local modules add the following "backup" entry into the config.xml:&lt;/p&gt;&#xD;
82
+ &#xD;
83
+ &lt;div class="highlight highlight-xml"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;config&amp;gt;&lt;/span&gt;&#xD;
84
+ &lt;span class="nt"&gt;&amp;lt;default&amp;gt;&lt;/span&gt;&#xD;
85
+ &lt;span class="nt"&gt;&amp;lt;payment&amp;gt;&lt;/span&gt;&#xD;
86
+ &lt;span class="nt"&gt;&amp;lt;paypal_standard&amp;gt;&lt;/span&gt;&#xD;
87
+ &lt;span class="nt"&gt;&amp;lt;model&amp;gt;&lt;/span&gt;zookal_mock/mocks_mage_payment&lt;span class="nt"&gt;&amp;lt;/model&amp;gt;&lt;/span&gt;&#xD;
88
+ &lt;span class="nt"&gt;&amp;lt;/paypal_standard&amp;gt;&lt;/span&gt;&#xD;
89
+ &lt;span class="nt"&gt;&amp;lt;another_payment_method&amp;gt;&lt;/span&gt;&#xD;
90
+ &lt;span class="nt"&gt;&amp;lt;model&amp;gt;&lt;/span&gt;zookal_mock/mocks_mage_payment&lt;span class="nt"&gt;&amp;lt;/model&amp;gt;&lt;/span&gt;&#xD;
91
+ &lt;span class="nt"&gt;&amp;lt;/another_payment_method&amp;gt;&lt;/span&gt;&#xD;
92
+ &lt;span class="nt"&gt;&amp;lt;/payment&amp;gt;&lt;/span&gt;&#xD;
93
+ &lt;span class="nt"&gt;&amp;lt;/default&amp;gt;&lt;/span&gt;&#xD;
94
+ &lt;span class="nt"&gt;&amp;lt;/config&amp;gt;&lt;/span&gt;&#xD;
95
+ &lt;/pre&gt;&#xD;
96
+ &lt;/div&gt;&#xD;
97
+ &#xD;
98
+ &lt;p&gt;The above xml contains the section where Mage_Paypal module has been disabled and previously used in orders.&lt;/p&gt;&#xD;
99
+ &#xD;
100
+ &lt;p&gt;No other database updates are required. Clear the caches and check in the backend some orders related to that payment method. You will now see a key/value&#xD;
101
+ list of the payment details.&lt;/p&gt;&#xD;
102
+ &#xD;
103
+ &lt;p&gt;The backend mock payment block has an integrated event &lt;code&gt;mock_payment_backend_block_to_html_before&lt;/code&gt; with which you can modify the output.&lt;/p&gt;&#xD;
104
+ &#xD;
105
+ &lt;p&gt;The frontend mock payment block uses the default block &lt;code&gt;Mage_Core_Block_Abstract&lt;/code&gt; which allows you the usual modifications.&lt;/p&gt;&#xD;
106
+ &#xD;
107
+ &lt;h2&gt;&#xD;
108
+ I've disabled and removed Mage_Adminhtml&lt;/h2&gt;&#xD;
109
+ &#xD;
110
+ &lt;p&gt;You rock!&lt;/p&gt;&#xD;
111
+ &#xD;
112
+ &lt;p&gt;Did you remove every Adminhtml area via &lt;code&gt;$ find . -iname "adminhtml" -type d -exec rm -Rf {} +&lt;/code&gt; ?&lt;/p&gt;&#xD;
113
+ &#xD;
114
+ &lt;p&gt;Running a backend-less version of Magento saves you processor time, space, speeds up your store and improves security. All missing required adminhtml files&#xD;
115
+ will be transparently mocked. Nothing to configure!&lt;/p&gt;&#xD;
116
+ &#xD;
117
+ &lt;h4&gt;&#xD;
118
+ But how do I maintain a backend-less store?&lt;/h4&gt;&#xD;
119
+ &#xD;
120
+ &lt;p&gt;You have two solutions:&lt;/p&gt;&#xD;
121
+ &#xD;
122
+ &lt;ol&gt;&#xD;
123
+ &lt;li&gt;Install your backend on a different server (or different path with different domain) and share the same database with the frontend. Security Warning&#xD;
124
+ (1).&#xD;
125
+ &lt;/li&gt;&#xD;
126
+ &lt;li&gt;Use on the command line the awesome tool &lt;a href="http://magerun.net"&gt;n98-magerun&lt;/a&gt; (2).&lt;/li&gt;&#xD;
127
+ &lt;/ol&gt;&#xD;
128
+ &lt;p&gt;(1) If having multiple servers: Make sure that you connect only via SSL encryption to your MySQL server. Someone is spying :-(``&lt;/p&gt;&#xD;
129
+ &#xD;
130
+ &lt;p&gt;(2) There is currently a feature missing in n98-magerun &lt;a href="https://github.com/netz98/n98-magerun/issues/309"&gt;https://github.com/netz98/n98-magerun/issues/309&lt;/a&gt;&#xD;
131
+ that you cannot configure &lt;code&gt;Mage:run()&lt;/code&gt; to use a custom configuration model as explained below.&lt;/p&gt;&#xD;
132
+ &#xD;
133
+ &lt;h2&gt;&#xD;
134
+ I've disabled module&#xD;
135
+ FooBar but still getting errors regarding dependency?&lt;/h2&gt;&#xD;
136
+ &#xD;
137
+ &lt;p&gt;Let's say you disabled Mage_Dataflow but enabled Mage_Catalog and the system is presenting you:&lt;/p&gt;&#xD;
138
+ &#xD;
139
+ &lt;pre&gt;&lt;code&gt;"Mage_Catalog" requires module "Mage_Dataflow"&#xD;
140
+ &lt;/code&gt;&lt;/pre&gt;&#xD;
141
+ &#xD;
142
+ &lt;p&gt;You have two possibilities:&lt;/p&gt;&#xD;
143
+ &#xD;
144
+ &lt;ol&gt;&#xD;
145
+ &lt;li&gt;Edit app/etc/modules/Mage_*.xml and remove the appropriate dependencies.&lt;/li&gt;&#xD;
146
+ &lt;li&gt;Edit your main index.php file and add this custom config model to &lt;code&gt;Mage::run()&lt;/code&gt;&#xD;
147
+ &lt;/li&gt;&#xD;
148
+ &lt;/ol&gt;&#xD;
149
+ &lt;div class="highlight highlight-php"&gt;&lt;pre&gt;&lt;span class="nx"&gt;Mage&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span&#xD;
150
+ class="nv"&gt;$mageRunCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$mageRunType&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span&#xD;
151
+ class="p"&gt;(&lt;/span&gt;&#xD;
152
+ &lt;span class="s1"&gt;'config_model'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Zookal_Mock_Model_Config'&lt;/span&gt;&#xD;
153
+ &lt;span class="p"&gt;));&lt;/span&gt;&#xD;
154
+ &lt;/pre&gt;&#xD;
155
+ &lt;/div&gt;&#xD;
156
+ &#xD;
157
+ &lt;p&gt;The config model &lt;code&gt;Zookal_Mock_Model_Config&lt;/code&gt; will automatically resolve invalid dependencies for disabled modules. But some dependency really make&#xD;
158
+ sense ;-)&lt;/p&gt;&#xD;
159
+ &#xD;
160
+ &lt;h2&gt;I've disabled&#xD;
161
+ Mage_[Bundle|Rating|Review|Wishlist|Usa] but getting a weird error!&lt;/h2&gt;&#xD;
162
+ &#xD;
163
+ &lt;p&gt;The error is: &lt;code&gt;Notice: Trying to get property of non-object in app/code/core/Mage/Core/Model/Config.php on line 1239&lt;/code&gt;.&lt;/p&gt;&#xD;
164
+ &#xD;
165
+ &lt;p&gt;Digging deeper Mage_Core_Model_Config would like to access &lt;code&gt;Mage::helper('core')-&amp;gt;__()&lt;/code&gt; to display you the error message that&#xD;
166
+ Mage_[Bundle|Rating|Review|Wishlist|Usa] requires the module Mage_XmlConnect. The notice message appears because the core helper is not yet initialized.&lt;/p&gt;&#xD;
167
+ &#xD;
168
+ &lt;p&gt;So deactivating Mage_XmlConnect works out as the solution. It has many dependencies. Btw: Only if you have the Magento own mobile app you'll need the&#xD;
169
+ XmlConnect module. I'll disable it every time.&lt;/p&gt;&#xD;
170
+ &#xD;
171
+ &lt;h2&gt;&#xD;
172
+ I've disabled&#xD;
173
+ Mage_Cms!&lt;/h2&gt;&#xD;
174
+ &#xD;
175
+ &lt;p&gt;The catalog system and other routes will still work but you cannot access the root page (/) because that route is provided by Mage_Cms. You only have two&#xD;
176
+ solutions:&lt;/p&gt;&#xD;
177
+ &#xD;
178
+ &lt;ol&gt;&#xD;
179
+ &lt;li&gt;Customize your theme in that way that no one can access (/).&lt;/li&gt;&#xD;
180
+ &lt;li&gt;Create your own front router by adding an observer to the event &lt;code&gt;controller_front_init_routers&lt;/code&gt;.&lt;/li&gt;&#xD;
181
+ &lt;/ol&gt;&#xD;
182
+ &lt;p&gt;Blocks are also gone.&lt;/p&gt;&#xD;
183
+ &#xD;
184
+ &lt;h2&gt;&#xD;
185
+ Can I remove the files of the disabled modules?&lt;/h2&gt;&#xD;
186
+ &#xD;
187
+ &lt;p&gt;Yes you can! And you can even remove&lt;/p&gt;&#xD;
188
+ &#xD;
189
+ &lt;ul&gt;&#xD;
190
+ &lt;li&gt;Mage_AdminNotification&lt;/li&gt;&#xD;
191
+ &lt;li&gt;Mage_Adminhtml&lt;/li&gt;&#xD;
192
+ &lt;li&gt;Mage_Log&lt;/li&gt;&#xD;
193
+ &lt;li&gt;Mage_Tag&lt;/li&gt;&#xD;
194
+ &lt;/ul&gt;&#xD;
195
+ &lt;p&gt;which have hardcoded dependencies through the whole Mage_Adminhtml code (if adminhtml has not been removed).&lt;/p&gt;&#xD;
196
+ &#xD;
197
+ &lt;p&gt;The missing models will also be mocked via the PHP set_include_path() method. Fully compatible from Magento 1.1.x&lt;/p&gt;&#xD;
198
+ &#xD;
199
+ &lt;h2&gt;&#xD;
200
+ Will there be a performance increase?&lt;/h2&gt;&#xD;
201
+ &#xD;
202
+ &lt;p&gt;Yes there will be a performance increase due to less loading of classes and xml files.&lt;/p&gt;&#xD;
203
+ &#xD;
204
+ &#xD;
205
+ &lt;h2&gt;&#xD;
206
+ About&lt;/h2&gt;&#xD;
207
+ &#xD;
208
+ &lt;ul&gt;&#xD;
209
+ &lt;li&gt;Extension Key: Zookal_Mock&lt;/li&gt;&#xD;
210
+ &lt;li&gt;It's unit tested! :-)&lt;/li&gt;&#xD;
211
+ &lt;li&gt;It runs on production!&lt;/li&gt;&#xD;
212
+ &lt;/ul&gt;&#xD;
213
+ &#xD;
214
+ &#xD;
215
+ &lt;h2&gt;&#xD;
216
+ License&lt;/h2&gt;&#xD;
217
+ &#xD;
218
+ &lt;p&gt;&lt;a href="http://opensource.org/licenses/osl-3.0.php"&gt;OSL - Open Software Licence 3.0&lt;/a&gt;&lt;/p&gt;&#xD;
219
+ &#xD;
220
+ &lt;h2&gt; Copyright&lt;/h2&gt;&#xD;
221
+ &#xD;
222
+ &lt;p&gt;Copyright (c) Zookal Pty Ltd, Sydney Australia&lt;/p&gt;&#xD;
223
+ &#xD;
224
+ &lt;h2&gt; Author&lt;/h2&gt;&#xD;
225
+ &#xD;
226
+ &lt;p&gt;&lt;a href="https://github.com/SchumacherFM"&gt;Cyrill Schumacher&lt;/a&gt; - &lt;a href="http://www.schumacher.fm/cyrill.asc"&gt;My pgp public key&lt;/a&gt;&lt;/p&gt;&#xD;
227
+ &#xD;
228
+ &lt;p&gt;Made in Sydney, Australia :-)&lt;/p&gt;&#xD;
229
+ </description>
230
+ <notes>1.0.2&#xD;
231
+ &#xD;
232
+ - Added Mage_CatalogInventory mocks&#xD;
233
+ - Added Mage_Usa fallback mock model. Errors occur when loading system/config section and files of Mage_Usa have been removed&#xD;
234
+ &#xD;
235
+ 1.0.1&#xD;
236
+ &#xD;
237
+ - Added Mage_Weee mocks&#xD;
238
+ - Added Mage_GiftMessage mocks&#xD;
239
+ Possibility to run mock module in a shell script&#xD;
240
+ &#xD;
241
+ 1.0.0&#xD;
242
+ &#xD;
243
+ - Initial Release</notes>
244
+ <authors><author><name>Cyrill Schumacher</name><user>cyrills</user><email>cyrill@schumacher.fm</email></author></authors>
245
+ <date>2014-04-24</date>
246
+ <time>07:49:09</time>
247
+ <contents><target name="magecommunity"><dir name="Zookal"><dir name="Mock"><dir><dir name="Block"><dir name="Payment"><file name="Backend.php" hash="b9229921a72e19f692cb9d6924221564"/><file name="Frontend.php" hash="833bd12a2d8c3b8ed489e283189ed122"/></dir></dir><dir name="Helper"><file name="Data.php" hash="e27f9f31e653126f207b985b0b3eb324"/></dir><dir name="Model"><file name="Config.php" hash="afbeb63c5a19a6911ab508477586f5e3"/><dir name="Mocks"><file name="Abstract.php" hash="beebca37228efabb0a38c29de4dd52ad"/><dir name="Mage"><dir name="AdminNotification"><dir name="Model"><file name="Survey.php" hash="6321f6d417c4c2f414f7b29de62f4cc4"/></dir></dir><dir name="Adminhtml"><dir name="Helper"><file name="Data.php" hash="7ccc6666f4ef1421a88319510d782f43"/></dir></dir><file name="Block.php" hash="7a2adb47711b912fa320b60e0c3eb3d4"/><dir name="CatalogInventory"><dir name="Model"><dir name="Stock"><file name="Item.php" hash="356a4ec59f91478130a18c75a8794cee"/></dir></dir></dir><dir name="Category"><file name="Collection.php" hash="6c9ac375135ca5269a5f888f022f6399"/><file name="Tree.php" hash="a37ecbc65cd3780ed191ee913509ef06"/></dir><file name="Category.php" hash="3c09f3eea7c89678670d4adeb0c4f708"/><dir name="Class"><dir name="Source"><file name="Customer.php" hash="5567855c827e3c8e925a0716de21dd70"/></dir></dir><dir name="Customer"><file name="Collection.php" hash="0322cd4a4b062a8fecf6a72cd6d7cbbc"/></dir><file name="Customer.php" hash="18e4ea855de44b6b6b7faabd684fc080"/><file name="Data.php" hash="0ab93919414ae9ecf8ed72f2bf038878"/><dir name="Giftmessage"><dir name="Block"><dir name="Adminhtml"><dir name="Product"><dir name="Helper"><dir name="Form"><file name="Config.php" hash="bbb81782c68fe9fe25cb5e6cb90a8642"/></dir></dir></dir></dir></dir></dir><file name="Group.php" hash="fcf85c8c3b24affbd8f2f82456ac3907"/><file name="Item.php" hash="f692effa3010262bfea29b18359d3549"/><dir name="Log"><dir name="Model"><file name="Visitor.php" hash="b8a8343c57f79abd38780594581e9dde"/></dir></dir><file name="Log.php" hash="8371873b2365c863c07c0c0227326b34"/><file name="Message.php" hash="4c812d8f56122fb5290162d6304bd524"/><dir name="Order"><file name="Collection.php" hash="3e8262c4cdda6f710c9e3a40e2b76a94"/><dir name="Grid"><file name="Collection.php" hash="97371286529c7b2ced399a5a51fe9b72"/></dir></dir><file name="Payment.php" hash="9a873df5da7d716854ea52258209928e"/><dir name="Product"><file name="Collection.php" hash="8ab40ba5191188eed78bcab7dd76f558"/></dir><file name="Product.php" hash="f038a1450c4a18059df3239262084e0f"/><dir name="Profile"><file name="Collection.php" hash="931080d96e85927a77f77143b49dadf6"/></dir><dir name="Queue"><file name="Collection.php" hash="c4d7dd95a1a1918a99993484f82d9b3d"/></dir><file name="Quote.php" hash="de3724f95154de0707f47d40ff9a08a8"/><file name="Review.php" hash="efd1a3f7dcf45e33f95fe2e76bdfbb5b"/><dir name="Sale"><file name="Collection.php" hash="aa228d612ae734749e9adc382e806cd4"/></dir><file name="Session.php" hash="e6f976be6bd82b367854842f385d1a4a"/><file name="Subscriber.php" hash="908e105fa12c88e0f0a312b42bef35d3"/><dir name="Tag"><dir name="Model"><file name="Tag.php" hash="38a200df605197975e5e294081cf0663"/></dir></dir><file name="Tag.php" hash="bb059453e0978b12350581978b1931af"/><dir name="Tax"><file name="Class.php" hash="cb7a52951105cb7aa0bb9f2c566570a7"/></dir><dir name="Usa"><dir name="Model"><dir name="Shipping"><dir name="Carrier"><file name="Ups.php" hash="7debdce0931fc61d8eeef92876a6a73c"/></dir></dir></dir></dir><dir name="Visitor"><file name="Online.php" hash="774df1f34ae162fa52db376afc415823"/></dir><file name="Visitor.php" hash="4c4eb14327dc35144203e28a646ad579"/><dir name="Weee"><dir name="Model"><file name="Tax.php" hash="8c57836668f3c9a3ce4632621ce4533a"/></dir></dir></dir></dir><file name="Observer.php" hash="9c454e91735a6aeadd4a4aa84b0094b4"/></dir><dir name="Test"><dir name="Config"><file name="ConfigTest.php" hash="9801ef844555a09a2189cb4e1916cf95"/><file name="SystemTest.php" hash="b72edbb351b923ccbc2543dc79d859ee"/></dir><dir name="Helper"><file name="DataTest.php" hash="57a4b15ca7d916d295fb95d1f621d6bd"/></dir><dir name="Model"><file name="ConfigTest.php" hash="6db11147c31fdf5ee8456610439e12cd"/><dir name="Mocks"><file name="AbstractTest.php" hash="84cb9162b6f5ee2b755c134ec7b5d765"/><dir name="Mage"><file name="AbstractPHPUnitTestCase.php" hash="a55c209378c6ff4e0785b38e2d61063c"/><dir name="AdminNotification"><dir name="Model"><file name="SurveyTest.php" hash="b96def6058ac4fe111b441791a7776cd"/></dir></dir><dir name="Adminhtml"><dir name="Helper"><file name="DataTest.php" hash="5b3979a82ed70277a1f9bd380628804c"/></dir></dir><file name="BlockTest.php" hash="7df2890ad281722b028b277ffe9f5aec"/><dir name="Category"><file name="CollectionTest.php" hash="30e4d976b5fdb4b4bd3ac27508ddc77f"/><file name="TreeTest.php" hash="5eea6b1f1eb7627b8be2467e9fc44715"/></dir><file name="CategoryTest.php" hash="8bb8f394ac0a6dec4c2c2927e897aa40"/><dir name="Class"><dir name="Source"><file name="CustomerTest.php" hash="9a4efa200d3a3a77517dd94c75b125ed"/></dir></dir><dir name="Customer"><file name="CollectionTest.php" hash="bedff17927077c41ebc2fdea25a9459f"/></dir><file name="CustomerTest.php" hash="6955de25f84e8ea0858b76a9ac84f4bc"/><file name="DataTest.php" hash="2084e46e1c693387e96f5ce5e563f67f"/><file name="GroupTest.php" hash="16dc75c4a737f286f03caab1deb3f539"/><file name="ItemTest.php" hash="6c6241a7c37dac90b6668558822bcfcd"/><dir name="Log"><dir name="Model"><file name="VisitorTest.php" hash="30a29b7af8019f104ce4f6f3184d5326"/></dir></dir><file name="LogTest.php" hash="1392e2f20815b47213e65b6992f85200"/><dir name="Order"><file name="CollectionTest.php" hash="be6ed09849c0ef7fc8d540b8c52de95b"/><dir name="Grid"><file name="CollectionTest.php" hash="f85cae1021ec016a74d6fe466a09db90"/></dir></dir><file name="PaymentTest.php" hash="0b699aaf2e0d93b5221d34269419c9dc"/><dir name="Product"><file name="CollectionTest.php" hash="290019047b0fa844037610b356adaea0"/></dir><file name="ProductTest.php" hash="fd63d2113ab9812d7df8c637961a4460"/><dir name="Profile"><file name="CollectionTest.php" hash="233e2ad2aa2e0dd3da750a827000433f"/></dir><dir name="Queue"><file name="CollectionTest.php" hash="b35aa9892b13e843a35129e004dc3bdb"/></dir><file name="QuoteTest.php" hash="751422cc0c634a2f0ed83029e2d4af03"/><file name="ReviewTest.php" hash="cad6eb2f598adcaba9531af5f2149701"/><dir name="Sale"><file name="CollectionTest.php" hash="0290b5ae630b013cb17f20bed56d856c"/></dir><file name="SessionTest.php" hash="68473113f4b839e57077dc8ec72454ea"/><file name="SubscriberTest.php" hash="c95eff8172514488f80be33e7a78819b"/><dir name="Tag"><dir name="Model"><file name="TagTest.php" hash="02ecb2c555704320e6172abf3aa8875a"/></dir></dir><file name="TagTest.php" hash="fcf844c4e6fa7cd943c5ed9ffcb24a09"/><dir name="Tax"><file name="ClassTest.php" hash="924eed52fe3d58d13acff30c2bfe62c4"/></dir><dir name="Visitor"><file name="OnlineTest.php" hash="467f0b0aa51e1fdd3e840438582a1c44"/></dir><file name="VisitorTest.php" hash="2168aa02549634a9fe1a1f6284fe7c6d"/></dir></dir><file name="ObserverTest.php" hash="3e2ad2bd8eda3e3a6a473ed70cc28b5d"/></dir></dir><dir name="etc"><file name="config.xml" hash="732e4aaf47d277eb7e91512aea0afd9a"/><file name="system.xml" hash="6f7e4c053196f05bc21e047d7a8c00ca"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Zookal_Mock.xml" hash="4cd2a39bb78e3b877df0e1a6758a2b56"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Zookal_Mock.csv" hash="68b173d35123933bedae6743039dc81d"/></dir></dir></target></contents>
248
+ <compatible/>
249
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
250
+ </package>