|
@@ 2403-2424 (lines=22) @@
|
| 2400 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::createContent |
| 2401 |
|
* @dataProvider providerForTestCreateContentThrowsContentFieldValidationException |
| 2402 |
|
*/ |
| 2403 |
|
public function testCreateContentThrowsContentFieldValidationException($mainLanguageCode, $structFields) |
| 2404 |
|
{ |
| 2405 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class); |
| 2406 |
|
$this->expectExceptionMessage('Content Fields did not validate'); |
| 2407 |
|
|
| 2408 |
|
$fieldDefinitions = $this->fixturesForTestCreateContentNonRedundantFieldSetComplex(); |
| 2409 |
|
list($contentCreateStruct, $allFieldErrors) = |
| 2410 |
|
$this->assertForTestCreateContentThrowsContentFieldValidationException( |
| 2411 |
|
$mainLanguageCode, |
| 2412 |
|
$structFields, |
| 2413 |
|
$fieldDefinitions |
| 2414 |
|
); |
| 2415 |
|
|
| 2416 |
|
$mockedService = $this->getPartlyMockedContentService(); |
| 2417 |
|
|
| 2418 |
|
try { |
| 2419 |
|
$mockedService->createContent($contentCreateStruct); |
| 2420 |
|
} catch (ContentFieldValidationException $e) { |
| 2421 |
|
$this->assertEquals($allFieldErrors, $e->getFieldErrors()); |
| 2422 |
|
throw $e; |
| 2423 |
|
} |
| 2424 |
|
} |
| 2425 |
|
|
| 2426 |
|
/** |
| 2427 |
|
* Test for the createContent() method. |
|
@@ 5352-5372 (lines=21) @@
|
| 5349 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::updateContent |
| 5350 |
|
* @dataProvider providerForTestUpdateContentThrowsContentFieldValidationException |
| 5351 |
|
*/ |
| 5352 |
|
public function testUpdateContentThrowsContentFieldValidationException($initialLanguageCode, $structFields, $spiField, $allFieldErrors) |
| 5353 |
|
{ |
| 5354 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class); |
| 5355 |
|
$this->expectExceptionMessage('Content Fields did not validate'); |
| 5356 |
|
|
| 5357 |
|
list($existingFields, $fieldDefinitions) = $this->fixturesForTestUpdateContentNonRedundantFieldSetComplex(); |
| 5358 |
|
list($versionInfo, $contentUpdateStruct) = |
| 5359 |
|
$this->assertForTestUpdateContentThrowsContentFieldValidationException( |
| 5360 |
|
$initialLanguageCode, |
| 5361 |
|
$structFields, |
| 5362 |
|
$existingFields, |
| 5363 |
|
$fieldDefinitions |
| 5364 |
|
); |
| 5365 |
|
|
| 5366 |
|
try { |
| 5367 |
|
$this->partlyMockedContentService->updateContent($versionInfo, $contentUpdateStruct); |
| 5368 |
|
} catch (ContentFieldValidationException $e) { |
| 5369 |
|
$this->assertEquals($allFieldErrors, $e->getFieldErrors()); |
| 5370 |
|
throw $e; |
| 5371 |
|
} |
| 5372 |
|
} |
| 5373 |
|
|
| 5374 |
|
/** |
| 5375 |
|
* Test for the updateContent() method. |