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