当前位置: 首页>>代码示例>>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;未经允许,请勿转载。