| @@ 2308-2343 (lines=36) @@ | ||
| 2305 | $allFieldErrors = array(); |
|
| 2306 | $validateCount = 0; |
|
| 2307 | $emptyValue = self::EMPTY_FIELD_VALUE; |
|
| 2308 | foreach ($contentType->getFieldDefinitions() as $fieldDefinition) { |
|
| 2309 | foreach ($fieldValues[$fieldDefinition->identifier] as $languageCode => $value) { |
|
| 2310 | $fieldTypeMock->expects($this->at($validateCount++)) |
|
| 2311 | ->method('acceptValue') |
|
| 2312 | ->will( |
|
| 2313 | $this->returnCallback( |
|
| 2314 | function ($valueString) { |
|
| 2315 | return new ValueStub($valueString); |
|
| 2316 | } |
|
| 2317 | ) |
|
| 2318 | ); |
|
| 2319 | ||
| 2320 | $fieldTypeMock->expects($this->at($validateCount++)) |
|
| 2321 | ->method('isEmptyValue') |
|
| 2322 | ->will( |
|
| 2323 | $this->returnCallback( |
|
| 2324 | function (ValueStub $value) use ($emptyValue) { |
|
| 2325 | return $emptyValue === (string)$value; |
|
| 2326 | } |
|
| 2327 | ) |
|
| 2328 | ); |
|
| 2329 | ||
| 2330 | if (self::EMPTY_FIELD_VALUE === (string)$value) { |
|
| 2331 | continue; |
|
| 2332 | } |
|
| 2333 | ||
| 2334 | $fieldTypeMock->expects($this->at($validateCount++)) |
|
| 2335 | ->method('validate') |
|
| 2336 | ->with( |
|
| 2337 | $this->equalTo($fieldDefinition), |
|
| 2338 | $this->equalTo($value) |
|
| 2339 | )->will($this->returnArgument(1)); |
|
| 2340 | ||
| 2341 | $allFieldErrors[$fieldDefinition->id][$languageCode] = $value; |
|
| 2342 | } |
|
| 2343 | } |
|
| 2344 | ||
| 2345 | return array($contentCreateStruct, $allFieldErrors); |
|
| 2346 | } |
|
| @@ 5088-5123 (lines=36) @@ | ||
| 5085 | $allFieldErrors = array(); |
|
| 5086 | $validateCount = 0; |
|
| 5087 | $emptyValue = self::EMPTY_FIELD_VALUE; |
|
| 5088 | foreach ($contentType->getFieldDefinitions() as $fieldDefinition) { |
|
| 5089 | foreach ($fieldValues[$fieldDefinition->identifier] as $languageCode => $value) { |
|
| 5090 | $fieldTypeMock->expects($this->at($validateCount++)) |
|
| 5091 | ->method('acceptValue') |
|
| 5092 | ->will( |
|
| 5093 | $this->returnCallback( |
|
| 5094 | function ($valueString) { |
|
| 5095 | return new ValueStub($valueString); |
|
| 5096 | } |
|
| 5097 | ) |
|
| 5098 | ); |
|
| 5099 | ||
| 5100 | $fieldTypeMock->expects($this->at($validateCount++)) |
|
| 5101 | ->method('isEmptyValue') |
|
| 5102 | ->will( |
|
| 5103 | $this->returnCallback( |
|
| 5104 | function (ValueStub $value) use ($emptyValue) { |
|
| 5105 | return $emptyValue === (string)$value; |
|
| 5106 | } |
|
| 5107 | ) |
|
| 5108 | ); |
|
| 5109 | ||
| 5110 | if (self::EMPTY_FIELD_VALUE === (string)$value) { |
|
| 5111 | continue; |
|
| 5112 | } |
|
| 5113 | ||
| 5114 | $fieldTypeMock->expects($this->at($validateCount++)) |
|
| 5115 | ->method('validate') |
|
| 5116 | ->with( |
|
| 5117 | $this->equalTo($fieldDefinition), |
|
| 5118 | $this->equalTo($value) |
|
| 5119 | )->will($this->returnArgument(1)); |
|
| 5120 | ||
| 5121 | $allFieldErrors[$fieldDefinition->id][$languageCode] = $value; |
|
| 5122 | } |
|
| 5123 | } |
|
| 5124 | ||
| 5125 | $this->getFieldTypeRegistryMock()->expects($this->any()) |
|
| 5126 | ->method('getFieldType') |
|