本文整理汇总了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));
}
示例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);
}