|
@@ 2360-2381 (lines=22) @@
|
| 2357 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::createContent |
| 2358 |
|
* @dataProvider providerForTestCreateContentThrowsContentFieldValidationException |
| 2359 |
|
*/ |
| 2360 |
|
public function testCreateContentThrowsContentFieldValidationException($mainLanguageCode, $structFields) |
| 2361 |
|
{ |
| 2362 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class); |
| 2363 |
|
$this->expectExceptionMessage('Content fields did not validate'); |
| 2364 |
|
|
| 2365 |
|
$fieldDefinitions = $this->fixturesForTestCreateContentNonRedundantFieldSetComplex(); |
| 2366 |
|
list($contentCreateStruct, $allFieldErrors) = |
| 2367 |
|
$this->assertForTestCreateContentThrowsContentFieldValidationException( |
| 2368 |
|
$mainLanguageCode, |
| 2369 |
|
$structFields, |
| 2370 |
|
$fieldDefinitions |
| 2371 |
|
); |
| 2372 |
|
|
| 2373 |
|
$mockedService = $this->getPartlyMockedContentService(); |
| 2374 |
|
|
| 2375 |
|
try { |
| 2376 |
|
$mockedService->createContent($contentCreateStruct); |
| 2377 |
|
} catch (ContentFieldValidationException $e) { |
| 2378 |
|
$this->assertEquals($allFieldErrors, $e->getFieldErrors()); |
| 2379 |
|
throw $e; |
| 2380 |
|
} |
| 2381 |
|
} |
| 2382 |
|
|
| 2383 |
|
/** |
| 2384 |
|
* Test for the createContent() method. |
|
@@ 5277-5297 (lines=21) @@
|
| 5274 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::updateContent |
| 5275 |
|
* @dataProvider providerForTestUpdateContentThrowsContentFieldValidationException |
| 5276 |
|
*/ |
| 5277 |
|
public function testUpdateContentThrowsContentFieldValidationException($initialLanguageCode, $structFields, $spiField, $allFieldErrors) |
| 5278 |
|
{ |
| 5279 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class); |
| 5280 |
|
$this->expectExceptionMessage('Content fields did not validate'); |
| 5281 |
|
|
| 5282 |
|
list($existingFields, $fieldDefinitions) = $this->fixturesForTestUpdateContentNonRedundantFieldSetComplex(); |
| 5283 |
|
list($versionInfo, $contentUpdateStruct) = |
| 5284 |
|
$this->assertForTestUpdateContentThrowsContentFieldValidationException( |
| 5285 |
|
$initialLanguageCode, |
| 5286 |
|
$structFields, |
| 5287 |
|
$existingFields, |
| 5288 |
|
$fieldDefinitions |
| 5289 |
|
); |
| 5290 |
|
|
| 5291 |
|
try { |
| 5292 |
|
$this->partlyMockedContentService->updateContent($versionInfo, $contentUpdateStruct); |
| 5293 |
|
} catch (ContentFieldValidationException $e) { |
| 5294 |
|
$this->assertEquals($allFieldErrors, $e->getFieldErrors()); |
| 5295 |
|
throw $e; |
| 5296 |
|
} |
| 5297 |
|
} |
| 5298 |
|
|
| 5299 |
|
/** |
| 5300 |
|
* Test for the updateContent() method. |