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


PHP Handler::expects方法代码示例

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


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

示例1: testVisitWithoutTarget

 /**
  * @covers \Netgen\TagsBundle\Core\Search\Solr\Query\Content\CriterionVisitor\Tags\TagKeyword::visit
  * @covers \Netgen\TagsBundle\Core\Search\Solr\Query\Content\CriterionVisitor\Tags::getTargetFieldNames
  */
 public function testVisitWithoutTarget()
 {
     $criterion = new Criterion\TagKeyword(Operator::IN, array('tag1', 'tag2'));
     $this->contentTypeHandler->expects($this->once())->method('getSearchableFieldMap')->will($this->returnValue(array('news' => array('tags_field' => array('field_type_identifier' => 'eztags')), 'article' => array('tags_field2' => array('field_type_identifier' => 'eztags')))));
     $this->fieldNameResolver->expects($this->at(0))->method('getFieldNames')->with($this->equalTo($criterion), $this->equalTo('tags_field'), 'eztags', 'tag_keywords')->will($this->returnValue(array('news_tags_field_s')));
     $this->fieldNameResolver->expects($this->at(1))->method('getFieldNames')->with($this->equalTo($criterion), $this->equalTo('tags_field2'), 'eztags', 'tag_keywords')->will($this->returnValue(array('article_tags_field2_s')));
     $this->assertEquals('(news_tags_field_s:"tag1" OR article_tags_field2_s:"tag1" OR news_tags_field_s:"tag2" OR article_tags_field2_s:"tag2")', $this->visitor->visit($criterion));
 }
开发者ID:netgen,项目名称:tagsbundle,代码行数:12,代码来源:TagKeywordTest.php

示例2: testValidateError

 /**
  * @dataProvider providerForTestValidateError
  *
  * @param \eZ\Publish\API\Repository\Values\User\Limitation\ParentContentTypeLimitation $limitation
  * @param int $errorCount
  */
 public function testValidateError(ParentContentTypeLimitation $limitation, $errorCount)
 {
     if (!empty($limitation->limitationValues)) {
         $this->getPersistenceMock()->expects($this->any())->method("contentTypeHandler")->will($this->returnValue($this->contentTypeHandlerMock));
         foreach ($limitation->limitationValues as $key => $value) {
             $this->contentTypeHandlerMock->expects($this->at($key))->method("load")->with($value)->will($this->throwException(new NotFoundException('location', $value)));
         }
     } else {
         $this->getPersistenceMock()->expects($this->never())->method($this->anything());
     }
     // Need to create inline instead of depending on testConstruct() to get correct mock instance
     $limitationType = $this->testConstruct();
     $validationErrors = $limitationType->validate($limitation);
     self::assertCount($errorCount, $validationErrors);
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:21,代码来源:ParentContentTypeLimitationTypeTest.php


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