|
@@ 2402-2423 (lines=22) @@
|
| 2399 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::createContent |
| 2400 |
|
* @dataProvider providerForTestCreateContentThrowsContentFieldValidationException |
| 2401 |
|
*/ |
| 2402 |
|
public function testCreateContentThrowsContentFieldValidationException($mainLanguageCode, $structFields) |
| 2403 |
|
{ |
| 2404 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class); |
| 2405 |
|
$this->expectExceptionMessage('Content fields did not validate'); |
| 2406 |
|
|
| 2407 |
|
$fieldDefinitions = $this->fixturesForTestCreateContentNonRedundantFieldSetComplex(); |
| 2408 |
|
list($contentCreateStruct, $allFieldErrors) = |
| 2409 |
|
$this->assertForTestCreateContentThrowsContentFieldValidationException( |
| 2410 |
|
$mainLanguageCode, |
| 2411 |
|
$structFields, |
| 2412 |
|
$fieldDefinitions |
| 2413 |
|
); |
| 2414 |
|
|
| 2415 |
|
$mockedService = $this->getPartlyMockedContentService(); |
| 2416 |
|
|
| 2417 |
|
try { |
| 2418 |
|
$mockedService->createContent($contentCreateStruct); |
| 2419 |
|
} catch (ContentFieldValidationException $e) { |
| 2420 |
|
$this->assertEquals($allFieldErrors, $e->getFieldErrors()); |
| 2421 |
|
throw $e; |
| 2422 |
|
} |
| 2423 |
|
} |
| 2424 |
|
|
| 2425 |
|
/** |
| 2426 |
|
* Test for the createContent() method. |
|
@@ 5319-5339 (lines=21) @@
|
| 5316 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::updateContent |
| 5317 |
|
* @dataProvider providerForTestUpdateContentThrowsContentFieldValidationException |
| 5318 |
|
*/ |
| 5319 |
|
public function testUpdateContentThrowsContentFieldValidationException($initialLanguageCode, $structFields, $spiField, $allFieldErrors) |
| 5320 |
|
{ |
| 5321 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class); |
| 5322 |
|
$this->expectExceptionMessage('Content fields did not validate'); |
| 5323 |
|
|
| 5324 |
|
list($existingFields, $fieldDefinitions) = $this->fixturesForTestUpdateContentNonRedundantFieldSetComplex(); |
| 5325 |
|
list($versionInfo, $contentUpdateStruct) = |
| 5326 |
|
$this->assertForTestUpdateContentThrowsContentFieldValidationException( |
| 5327 |
|
$initialLanguageCode, |
| 5328 |
|
$structFields, |
| 5329 |
|
$existingFields, |
| 5330 |
|
$fieldDefinitions |
| 5331 |
|
); |
| 5332 |
|
|
| 5333 |
|
try { |
| 5334 |
|
$this->partlyMockedContentService->updateContent($versionInfo, $contentUpdateStruct); |
| 5335 |
|
} catch (ContentFieldValidationException $e) { |
| 5336 |
|
$this->assertEquals($allFieldErrors, $e->getFieldErrors()); |
| 5337 |
|
throw $e; |
| 5338 |
|
} |
| 5339 |
|
} |
| 5340 |
|
|
| 5341 |
|
/** |
| 5342 |
|
* Test for the updateContent() method. |