Details
-
Bug
-
Resolution: Fixed
-
Medium
-
5.0.0-dev
-
None
Description
I am testing the float type. The field type is "Required" in the content type
In the test I first try to publish a new version of the object where value is
not set ( expecting error )
I then try to set the fieldvalue and publish the draft again.. Then I get an
exception where I really don't understand the message....:
eZ\Publish\Core\Base\Exceptions\ContentValidationException: More than one field
is set for translatable field definition 'flt' on language with code 'eng-GB'
It seems to me that draft is in an unstable state if updateContent() fails due
to validation error.
Steps to reproduce
$contentUpdate->setField( 'flt', null ); try { // Update the content draft $draftVersion2 = $contentService->updateContent( $draftVersion2->getVersionInfo(), $contentUpdate ); $this->assertTrue( false, "Exception should have been thrown when reqired field \"flt\" is not set" ); } catch ( eZ\Publish\Core\Base\Exceptions\ContentValidationException $e ) { $this->assertEquals( $e->getMessage(), 'Required field \'flt\' value is empty', 'Message from exception was not as expected' ); } //Update the “TF6†object with an alphanumeric value //"1A" $contentUpdate->setField( 'flt', '1A' ); try { // Update the content draft $draftVersion2 = $contentService->updateContent( $draftVersion2->getVersionInfo(), $contentUpdate ); // <--------- Exception is thrown here $this->assertTrue( false, "Exception should have been thrown when fieldvalue for \"flt\" is of type string" ); } catch ( eZ\Publish\Core\Base\Exceptions\InvalidArgumentType $e ) { $this->assertEquals( $e->getMessage(), 'Argument \'$inputValue\' is invalid: expected value to be of type \'eZ\Publish\Core\FieldType\Float\Value\', got \'string\'', 'Message from exception was not as expected' ); }