/** * @dataProvider contentTypeProvider */ public function testValidator($contentType, $expected) { $validator = new ContentTypeValidator($contentType); $this->assertEquals($expected, $validator->isValid()); }
/** * @param int $contentId * @param string $contentType * @return array|bool|float|int|string * @throws InvalidContentTypeException * @throws ItemDoesNotExistsException * @throws UnsatisfactoryResponseCodeException */ public function searchByInstance($contentId, $contentType) { $contentTypeValidator = new ContentTypeValidator($contentType); if (!$contentTypeValidator->isValid()) { throw new InvalidContentTypeException(sprintf('Content Type "%s" is not allowed', $contentType)); } $response = $this->apiGet(sprintf('/publication/{publicationId}/searchContents/instance?contentId=%d&contentType=%s', $contentId, $contentType)); return $response->json(); }