eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentContentType::matchContentInfo PHP Method

matchContentInfo() public method

Checks if a ContentInfo object matches.
public matchContentInfo ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo ) : boolean
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
return boolean
    public function matchContentInfo(ContentInfo $contentInfo)
    {
        $location = $this->repository->sudo(function (Repository $repository) use($contentInfo) {
            return $repository->getLocationService()->loadLocation($contentInfo->mainLocationId);
        });
        return $this->matchLocation($location);
    }

Usage Example

 /**
  * @dataProvider matchLocationProvider
  * @covers eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentContentType::matchContentInfo
  * @covers eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::setMatchingConfig
  * @covers \eZ\Publish\Core\MVC\RepositoryAware::setRepository
  *
  * @param int|int[] $matchingConfig
  * @param \eZ\Publish\API\Repository\Repository $repository
  * @param bool $expectedResult
  */
 public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult)
 {
     $this->matcher->setRepository($repository);
     $this->matcher->setMatchingConfig($matchingConfig);
     $this->assertSame($expectedResult, $this->matcher->matchContentInfo($this->getContentInfoMock()));
 }