public function testValidateError(ContentTypeLimitation $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('contentType', $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);
}