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