当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::assertElements方法代码示例

本文整理汇总了PHP中Shopware\Tests\Mink\Helper::assertElements方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::assertElements方法的具体用法?PHP Helper::assertElements怎么用?PHP Helper::assertElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shopware\Tests\Mink\Helper的用法示例。


在下文中一共展示了Helper::assertElements方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkComments

 /**
  * Checks the evaluations of the current article
  * @param BlogComment $blogComments
  * @param $average
  * @param array $comments
  * @throws \Exception
  */
 public function checkComments(BlogComment $blogComments, $average, array $comments)
 {
     $this->checkRating($blogComments, $average);
     $comments = Helper::floatArray($comments, ['stars']);
     $result = Helper::assertElements($comments, $blogComments);
     if ($result === true) {
         return;
     }
     $messages = array('The following comments are wrong:');
     foreach ($result as $evaluation) {
         $messages[] = sprintf('%s - Bewertung: %s (%s is "%s", should be "%s")', $evaluation['properties']['author'], $evaluation['properties']['stars'], $evaluation['result']['key'], $evaluation['result']['value'], $evaluation['result']['value2']);
     }
     Helper::throwException($messages);
 }
开发者ID:BucherStoerzbachGbR,项目名称:shopware,代码行数:21,代码来源:Blog.php

示例2: checkCartProducts

 /**
  * Checks the cart positions
  * Available properties are: number (required), name (required), quantity, itemPrice, sum
  * @param CartPosition $cartPositions
  * @param array $items
  */
 public function checkCartProducts(CartPosition $cartPositions, array $items)
 {
     Helper::assertElementCount($cartPositions, count($items));
     $items = Helper::floatArray($items, ['quantity', 'itemPrice', 'sum']);
     $result = Helper::assertElements($items, $cartPositions);
     if ($result !== true) {
         $messages = ['The following articles are wrong:'];
         foreach ($result as $product) {
             $messages[] = sprintf('%s - %s (%s is "%s", should be "%s")', $product['properties']['number'], $product['properties']['name'], $product['result']['key'], $product['result']['value'], $product['result']['value2']);
         }
         Helper::throwException($messages);
     }
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:19,代码来源:CheckoutCart.php


注:本文中的Shopware\Tests\Mink\Helper::assertElements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。