diff --git a/app/code/core/Mage/AdminNotification/Model/Feed.php b/app/code/core/Mage/AdminNotification/Model/Feed.php
index 8864e590cb8..32a9175bbf6 100644
--- a/app/code/core/Mage/AdminNotification/Model/Feed.php
+++ b/app/code/core/Mage/AdminNotification/Model/Feed.php
@@ -169,7 +169,7 @@ public function getFeedXml()
$data = $this->getFeedData();
$xml = new SimpleXMLElement($data);
} catch (Exception $e) {
- $xml = new SimpleXMLElement('');
+ $xml = new SimpleXMLElement('');
}
return $xml;
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php
index f620a652684..95924a93ab6 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php
+++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php
@@ -43,6 +43,10 @@ public function getFormHtml(Varien_Object $entity, $entityType = 'quote')
*/
public function getItems()
{
+ if (!$this->isOutputEnabled('Mage_GiftMessage')) {
+ return false;
+ }
+
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
@@ -51,7 +55,7 @@ public function getItems()
foreach ($allItems as $item) {
if ($this->_getGiftmessageSaveModel()->getIsAllowedQuoteItem($item)
- && $helper->getIsMessagesAvailable('item', $item, $this->getStore())
+ && $helper->getIsMessagesAvailable($helper::TYPE_ITEM, $item, $this->getStore())
) {
// if item allowed
$items[] = $item;
@@ -82,6 +86,6 @@ public function canDisplayGiftmessage(): bool
}
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
- return $helper->getIsMessagesAvailable('order', $this->getEntity(), $this->getEntity()->getStoreId());
+ return $helper->getIsMessagesAvailable($helper::TYPE_CONFIG, $this->getQuote(), $this->getStoreId());
}
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php
index 92e2600ccd1..d2892a23240 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php
+++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php
@@ -135,10 +135,10 @@ public function isGiftMessagesAvailable($item = null)
$helper = $this->helper('giftmessage/message');
if (is_null($item)) {
- return $helper->getIsMessagesAvailable('items', $this->getQuote(), $this->getStore());
+ return $helper->getIsMessagesAvailable($helper::TYPE_ITEMS, $this->getQuote(), $this->getStore());
}
- return $helper->getIsMessagesAvailable('item', $item, $this->getStore());
+ return $helper->getIsMessagesAvailable($helper::TYPE_ITEM, $item, $this->getStore());
}
/**
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Giftmessage.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Giftmessage.php
index c4a575568ef..b76c61488ff 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Giftmessage.php
+++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Giftmessage.php
@@ -31,7 +31,7 @@ public function render(Varien_Object $row)
{
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
- if (!$helper->getIsMessagesAvailable('order_item', $row, $this->getColumn()->getGrid()->getStore())) {
+ if (!$helper->getIsMessagesAvailable($helper::TYPE_ORDER_ITEM, $row, $this->getColumn()->getGrid()->getStore())) {
return ' ';
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php
index c0fc03d8a9b..aa559e2743d 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php
+++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php
@@ -284,6 +284,6 @@ public function canDisplayGiftmessage()
}
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
- return $helper->getIsMessagesAvailable('order', $this->getEntity(), $this->getEntity()->getStoreId());
+ return $helper->getIsMessagesAvailable($helper::TYPE_ORDER, $this->getEntity(), $this->getEntity()->getStoreId());
}
}
diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php
index 29cf1404d46..99f61fececf 100644
--- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php
+++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items/Renderer/Default.php
@@ -210,7 +210,7 @@ public function canDisplayGiftmessage()
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
return $helper->getIsMessagesAvailable(
- 'order_item',
+ $helper::TYPE_ORDER_ITEM,
$this->getItem(),
$this->getItem()->getOrder()->getStoreId()
);
diff --git a/app/code/core/Mage/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php b/app/code/core/Mage/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php
index 752ad45c0e5..7bcafdf7c72 100644
--- a/app/code/core/Mage/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php
+++ b/app/code/core/Mage/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php
@@ -24,10 +24,10 @@ class Mage_GiftMessage_Block_Adminhtml_Product_Helper_Form_Config extends Mage_A
/**
* Get config value data
*
- * @return mixed
+ * @return bool
*/
protected function _getValueFromConfig()
{
- return Mage::getStoreConfig(Mage_GiftMessage_Helper_Message::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS);
+ return Mage::getStoreConfigFlag(Mage_GiftMessage_Helper_Message::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS);
}
}
diff --git a/app/code/core/Mage/GiftMessage/Block/Adminhtml/Sales/Order/Create/Form.php b/app/code/core/Mage/GiftMessage/Block/Adminhtml/Sales/Order/Create/Form.php
index da5b2829a61..bb11ad54b76 100644
--- a/app/code/core/Mage/GiftMessage/Block/Adminhtml/Sales/Order/Create/Form.php
+++ b/app/code/core/Mage/GiftMessage/Block/Adminhtml/Sales/Order/Create/Form.php
@@ -31,6 +31,6 @@ public function canDisplayGiftmessageForm()
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
- return $helper->getIsMessagesAvailable('items', $quote, $quote->getStore());
+ return $helper->getIsMessagesAvailable($helper::TYPE_ITEMS, $quote, $quote->getStore());
}
}
diff --git a/app/code/core/Mage/GiftMessage/Block/Adminhtml/Sales/Order/Create/Items.php b/app/code/core/Mage/GiftMessage/Block/Adminhtml/Sales/Order/Create/Items.php
index 0202807afd8..c9a05f4ea2f 100644
--- a/app/code/core/Mage/GiftMessage/Block/Adminhtml/Sales/Order/Create/Items.php
+++ b/app/code/core/Mage/GiftMessage/Block/Adminhtml/Sales/Order/Create/Items.php
@@ -47,7 +47,7 @@ public function canDisplayGiftMessage()
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
return $helper->getIsMessagesAvailable(
- 'item',
+ $helper::TYPE_ITEM,
$item,
$item->getStoreId()
);
diff --git a/app/code/core/Mage/GiftMessage/Block/Message/Inline.php b/app/code/core/Mage/GiftMessage/Block/Message/Inline.php
index 64a5cb44202..66a0c2a7942 100644
--- a/app/code/core/Mage/GiftMessage/Block/Message/Inline.php
+++ b/app/code/core/Mage/GiftMessage/Block/Message/Inline.php
@@ -255,7 +255,9 @@ public function getEscaped($value, $defaultValue = '')
*/
public function isMessagesAvailable()
{
- return Mage::helper('giftmessage/message')->isMessagesAvailable('quote', $this->getEntity());
+ /** @var Mage_GiftMessage_Helper_Message $helper */
+ $helper = $this->helper('giftmessage/message');
+ return $helper->isMessagesAvailable($helper::TYPE_CONFIG, $this->getEntity());
}
/**
diff --git a/app/code/core/Mage/GiftMessage/Helper/Message.php b/app/code/core/Mage/GiftMessage/Helper/Message.php
index a435b9c5163..1011376bfee 100644
--- a/app/code/core/Mage/GiftMessage/Helper/Message.php
+++ b/app/code/core/Mage/GiftMessage/Helper/Message.php
@@ -28,6 +28,13 @@ class Mage_GiftMessage_Helper_Message extends Mage_Core_Helper_Data
public const XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS = 'sales/gift_options/allow_items';
public const XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER = 'sales/gift_options/allow_order';
+ public const TYPE_ADDRESS_ITEM = 'address_item';
+ public const TYPE_CONFIG = 'config';
+ public const TYPE_ITEM = 'item';
+ public const TYPE_ITEMS = 'items';
+ public const TYPE_ORDER = 'order';
+ public const TYPE_ORDER_ITEM = 'order_item';
+
protected $_moduleName = 'Mage_GiftMessage';
/**
@@ -88,74 +95,75 @@ public function getInline($type, Varien_Object $entity, $dontDisplayContainer =
/**
* Check availability of giftmessages for specified entity.
*
- * @param string $type
- * @param Mage_Core_Model_Store|integer $store
- * @return bool|int
+ * @param self::TYPE_* $type $type
+ * @param bool|int|Mage_Core_Model_Store|null|string $store
+ * @return bool
*/
public function isMessagesAvailable($type, Varien_Object $entity, $store = null)
{
- if ($type == 'items') {
- $items = $entity->getAllItems();
- if (!is_array($items) || empty($items)) {
- return Mage::getStoreConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, $store);
- }
- if ($entity instanceof Mage_Sales_Model_Quote) {
- $_type = $entity->getIsMultiShipping() ? 'address_item' : 'item';
- } else {
- $_type = 'order_item';
- }
-
- foreach ($items as $item) {
- if ($item->getParentItem()) {
- continue;
+ switch ($type) {
+ case self::TYPE_ITEMS:
+ $items = $entity->getAllItems();
+ if (!is_array($items) || empty($items)) {
+ return Mage::getStoreConfigFlag(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, $store);
}
- if ($this->isMessagesAvailable($_type, $item, $store)) {
- return true;
+ if ($entity instanceof Mage_Sales_Model_Quote) {
+ $_type = $entity->getIsMultiShipping() ? self::TYPE_ADDRESS_ITEM : self::TYPE_ITEM;
+ } else {
+ $_type = self::TYPE_ORDER_ITEM;
}
- }
- } elseif ($type == 'item') {
- return $this->_getDependenceFromStoreConfig(
- $entity->getProduct()->getGiftMessageAvailable(),
- $store
- );
- } elseif ($type == 'order_item') {
- return $this->_getDependenceFromStoreConfig(
- $entity->getGiftMessageAvailable(),
- $store
- );
- } elseif ($type == 'address_item') {
- $storeId = is_numeric($store) ? $store : Mage::app()->getStore($store)->getId();
- if (!$this->isCached('address_item_' . $entity->getProductId())) {
- $this->setCached(
- 'address_item_' . $entity->getProductId(),
- Mage::getModel('catalog/product')
- ->setStoreId($storeId)
- ->load($entity->getProductId())
- ->getGiftMessageAvailable()
+ foreach ($items as $item) {
+ if ($item->getParentItem()) {
+ continue;
+ }
+ if ($this->isMessagesAvailable($_type, $item, $store)) {
+ return true;
+ }
+ }
+ // no break
+ case self::TYPE_ITEM:
+ return $this->_getDependenceFromStoreConfig(
+ $entity->getProduct()->getGiftMessageAvailable(),
+ $store
);
- }
- return $this->_getDependenceFromStoreConfig(
- $this->getCached('address_item_' . $entity->getProductId()),
- $store
- );
- } else {
- return Mage::getStoreConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, $store);
- }
+ case self::TYPE_ORDER_ITEM:
+ return $this->_getDependenceFromStoreConfig(
+ $entity->getGiftMessageAvailable(),
+ $store
+ );
+ case self::TYPE_ADDRESS_ITEM:
+ $storeId = is_numeric($store) ? $store : Mage::app()->getStore($store)->getId();
+ $cacheId = self::TYPE_ADDRESS_ITEM . '_' . $entity->getProductId();
- return false;
+ if (!$this->isCached($cacheId)) {
+ $this->setCached(
+ $cacheId,
+ Mage::getModel('catalog/product')
+ ->setStoreId($storeId)
+ ->load($entity->getProductId())
+ ->getGiftMessageAvailable()
+ );
+ }
+ return $this->_getDependenceFromStoreConfig(
+ $this->getCached($cacheId),
+ $store
+ );
+ default:
+ return Mage::getStoreConfigFlag(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, $store);
+ }
}
/**
* Check availability of gift messages from store config if flag eq 2.
*
- * @param int $productGiftMessageAllow
- * @param Mage_Core_Model_Store|integer $store
- * @return bool|int
+ * @param bool $productGiftMessageAllow
+ * @param bool|int|Mage_Core_Model_Store|null|string $store
+ * @return bool
*/
protected function _getDependenceFromStoreConfig($productGiftMessageAllow, $store = null)
{
- $result = Mage::getStoreConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, $store);
+ $result = Mage::getStoreConfigFlag(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, $store);
if ($productGiftMessageAllow === '' || is_null($productGiftMessageAllow)) {
return $result;
} else {
@@ -166,9 +174,9 @@ protected function _getDependenceFromStoreConfig($productGiftMessageAllow, $stor
/**
* Alias for isMessagesAvailable(...)
*
- * @param string $type
- * @param Mage_Core_Model_Store|integer $store
- * @return bool|int
+ * @param self::TYPE_* $type
+ * @param bool|int|Mage_Core_Model_Store|null|string $store
+ * @return bool
*/
public function getIsMessagesAvailable($type, Varien_Object $entity, $store = null)
{
diff --git a/app/code/core/Mage/Install/etc/install.xml b/app/code/core/Mage/Install/etc/install.xml
index 99c8debe638..750049ea442 100644
--- a/app/code/core/Mage/Install/etc/install.xml
+++ b/app/code/core/Mage/Install/etc/install.xml
@@ -82,6 +82,7 @@
+
diff --git a/app/code/core/Mage/Sales/Block/Order/Creditmemo.php b/app/code/core/Mage/Sales/Block/Order/Creditmemo.php
index 5be72003dea..a9179d7afd9 100644
--- a/app/code/core/Mage/Sales/Block/Order/Creditmemo.php
+++ b/app/code/core/Mage/Sales/Block/Order/Creditmemo.php
@@ -144,6 +144,6 @@ public function canDisplayGiftmessage(): bool
}
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
- return $helper->getIsMessagesAvailable('order', $this->getOrder());
+ return $helper->getIsMessagesAvailable($helper::TYPE_ORDER, $this->getOrder());
}
}
diff --git a/app/code/core/Mage/Sales/Block/Order/Invoice.php b/app/code/core/Mage/Sales/Block/Order/Invoice.php
index 88a04702f9e..ce172ae5211 100644
--- a/app/code/core/Mage/Sales/Block/Order/Invoice.php
+++ b/app/code/core/Mage/Sales/Block/Order/Invoice.php
@@ -144,6 +144,6 @@ public function canDisplayGiftmessage(): bool
}
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
- return $helper->getIsMessagesAvailable('order', $this->getOrder());
+ return $helper->getIsMessagesAvailable($helper::TYPE_ORDER, $this->getOrder());
}
}
diff --git a/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php b/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php
index 7046555a6ce..024f3038607 100644
--- a/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php
+++ b/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php
@@ -182,7 +182,10 @@ public function canDisplayGiftmessage(): bool
}
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
- return $helper->getIsMessagesAvailable('order_item', $this->getOrderItem()) && $this->getItem()->getGiftMessageId();
+ return $helper->getIsMessagesAvailable(
+ $helper::TYPE_ORDER_ITEM,
+ $this->getOrderItem()
+ ) && $this->getItem()->getGiftMessageId();
}
public function getGiftMessage(): ?Mage_GiftMessage_Model_Message
diff --git a/app/code/core/Mage/Sales/Block/Order/Items.php b/app/code/core/Mage/Sales/Block/Order/Items.php
index af74473f90f..9892c1d51be 100644
--- a/app/code/core/Mage/Sales/Block/Order/Items.php
+++ b/app/code/core/Mage/Sales/Block/Order/Items.php
@@ -38,6 +38,6 @@ public function canDisplayGiftmessage(Mage_Sales_Model_Order_Item $item): bool
}
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
- return $helper->getIsMessagesAvailable('order_item', $item) && $item->getGiftMessageId();
+ return $helper->getIsMessagesAvailable($helper::TYPE_ORDER_ITEM, $item) && $item->getGiftMessageId();
}
}
diff --git a/app/code/core/Mage/Sales/Block/Order/Shipment.php b/app/code/core/Mage/Sales/Block/Order/Shipment.php
index 6a82a447331..73eec7f19da 100644
--- a/app/code/core/Mage/Sales/Block/Order/Shipment.php
+++ b/app/code/core/Mage/Sales/Block/Order/Shipment.php
@@ -144,6 +144,6 @@ public function canDisplayGiftmessage(): bool
}
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
- return $helper->getIsMessagesAvailable('order', $this->getOrder());
+ return $helper->getIsMessagesAvailable($helper::TYPE_ORDER, $this->getOrder());
}
}
diff --git a/app/code/core/Mage/Sales/Block/Order/View.php b/app/code/core/Mage/Sales/Block/Order/View.php
index 4e5add748fe..1948e97a0ee 100644
--- a/app/code/core/Mage/Sales/Block/Order/View.php
+++ b/app/code/core/Mage/Sales/Block/Order/View.php
@@ -126,7 +126,7 @@ public function canDisplayGiftmessageItems(): bool
}
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
- return $helper->getIsMessagesAvailable('items', $this->getOrder());
+ return $helper->getIsMessagesAvailable($helper::TYPE_ITEMS, $this->getOrder());
}
public function canDisplayGiftmessageOrder(): bool
@@ -136,6 +136,9 @@ public function canDisplayGiftmessageOrder(): bool
}
/** @var Mage_GiftMessage_Helper_Message $helper */
$helper = $this->helper('giftmessage/message');
- return $helper->getIsMessagesAvailable('order', $this->getOrder()) && $this->getOrder()->getGiftMessageId();
+ return $helper->getIsMessagesAvailable(
+ $helper::TYPE_ORDER,
+ $this->getOrder()
+ ) && $this->getOrder()->getGiftMessageId();
}
}
diff --git a/composer.json b/composer.json
index bedc06e2a6a..ecfc8eb1fb7 100644
--- a/composer.json
+++ b/composer.json
@@ -20,6 +20,7 @@
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
+ "ext-pdo_mysql": "*",
"ext-simplexml": "*",
"ext-soap": "*",
"ext-zlib": "*",
diff --git a/composer.lock b/composer.lock
index c807efa7521..915321e0cea 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "5c164bfdfd01cced28e1b11221d14509",
+ "content-hash": "d9a600770935f43ce6b2a1a5bf3fbafb",
"packages": [
{
"name": "colinmollenhour/cache-backend-redis",
@@ -7199,7 +7199,7 @@
],
"aliases": [],
"minimum-stability": "dev",
- "stability-flags": [],
+ "stability-flags": {},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
@@ -7216,6 +7216,7 @@
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
+ "ext-pdo_mysql": "*",
"ext-simplexml": "*",
"ext-soap": "*",
"ext-zlib": "*"
diff --git a/tests/unit/Mage/Downloadable/Helper/FileTest.php b/tests/unit/Mage/Downloadable/Helper/FileTest.php
index be2aed43933..d4aa38a2f53 100644
--- a/tests/unit/Mage/Downloadable/Helper/FileTest.php
+++ b/tests/unit/Mage/Downloadable/Helper/FileTest.php
@@ -36,6 +36,7 @@ public function setUp(): void
* @dataProvider provideGetFilePathData
*
* @group Mage_Downloadable
+ * @group Mage_Downloadable_Helper
*/
public function testGetFilePath(string $expectedResult, string $path, ?string $file): void
{
diff --git a/tests/unit/Mage/GiftMessage/Helper/MessageTest.php b/tests/unit/Mage/GiftMessage/Helper/MessageTest.php
new file mode 100644
index 00000000000..67d5c3eee90
--- /dev/null
+++ b/tests/unit/Mage/GiftMessage/Helper/MessageTest.php
@@ -0,0 +1,77 @@
+subject = Mage::helper('giftmessage/message');
+ }
+
+ /**
+ * @dataProvider provideIsMessagesAvailable
+ *
+ * @group Mage_GiftMessage
+ * @group Mage_GiftMessage_Helper
+ */
+ public function testIsMessagesAvailable(string $type, Varien_Object $entity, $store = null): void
+ {
+ $this->assertIsBool($this->subject->isMessagesAvailable($type, $entity, $store));
+ }
+
+ public function provideIsMessagesAvailable(): Generator
+ {
+ $entity = new Varien_Object();
+
+ yield Subject::TYPE_ADDRESS_ITEM => [
+ Subject::TYPE_ADDRESS_ITEM,
+ $entity,
+ ];
+ yield Subject::TYPE_ITEM => [
+ Subject::TYPE_ITEM,
+ $entity->setProduct(new Mage_Catalog_Model_Product()),
+ ];
+ yield Subject::TYPE_ITEMS => [
+ Subject::TYPE_ITEMS,
+ $entity,
+ ];
+ yield Subject::TYPE_ORDER => [
+ Subject::TYPE_ORDER,
+ $entity,
+ ];
+ yield Subject::TYPE_ORDER_ITEM => [
+ Subject::TYPE_ORDER_ITEM,
+ $entity,
+ ];
+ yield 'invalid type' => [
+ 'quote',
+ $entity,
+ ];
+ }
+}