當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZProductCollectionItem::attribute方法代碼示例

本文整理匯總了PHP中eZProductCollectionItem::attribute方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZProductCollectionItem::attribute方法的具體用法?PHP eZProductCollectionItem::attribute怎麽用?PHP eZProductCollectionItem::attribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZProductCollectionItem的用法示例。


在下文中一共展示了eZProductCollectionItem::attribute方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCleanupList

 /**
  * Unit test for eZProductCollectionItem::cleanupList()
  *
  * Outline:
  * 1) Create 40 eZProductCollectionItem objects with a product_collection_id
  *    from 1 to 4
  * 2) Call cleanupList with (1, 2) as a parameter
  * 4) Check that the 20 matching items have been removed
  * 5) Check that the 20 other, non-matching items haven't been removed
  **/
 public function testCleanupList()
 {
     // Create a few collections
     $row = array('product_collection_id' => 0, 'contentobject_id' => 1, 'item_count' => 1, 'price' => 50, 'is_vat_inc' => 1, 'vat_value' => 19.6, 'discount' => 0, 'name' => __FUNCTION__);
     $deleteIDArray = $keepIDArray = array();
     for ($i = 1; $i < 40; $i++) {
         $row['productcollection_id'] = ceil($i / 10);
         $row['name'] = __FUNCTION__ . ":" . $row['productcollection_id'] . "-{$i}";
         $item = new eZProductCollectionItem($row);
         $item->store();
         if ($row['productcollection_id'] <= 2) {
             $deleteIDArray[] = $item->attribute('id');
         } else {
             $keepIDArray[] = $item->attribute('id');
         }
     }
     eZProductCollectionItem::cleanupList(array(1, 2));
     // Check that each item of deleteIDArray has been removed
     foreach ($deleteIDArray as $id) {
         $this->assertNull(eZProductCollectionItem::fetch($id));
     }
     // And check that each item of remainingIDArray hasn't been deleted
     foreach ($keepIDArray as $id) {
         $this->assertType('eZProductCollectionItem', eZProductCollectionItem::fetch($id));
     }
 }
開發者ID:runelangseid,項目名稱:ezpublish,代碼行數:36,代碼來源:ezproductcollectionitem_test.php


注:本文中的eZProductCollectionItem::attribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。