本文整理匯總了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);
}