| @@ 233-252 (lines=20) @@ | ||
| 230 | * |
|
| 231 | * @return \eZ\Publish\API\Repository\ContentTypeService |
|
| 232 | */ |
|
| 233 | protected function getContentTypeServiceMock() |
|
| 234 | { |
|
| 235 | $contentTypeServiceMock = $this->createMock(ContentTypeService::class); |
|
| 236 | ||
| 237 | $contentTypeServiceMock->expects($this->any()) |
|
| 238 | ->method('newFieldDefinitionCreateStruct') |
|
| 239 | ->with($this->equalTo('title'), $this->equalTo('ezstring')) |
|
| 240 | ->will( |
|
| 241 | $this->returnValue( |
|
| 242 | new FieldDefinitionCreateStruct( |
|
| 243 | array( |
|
| 244 | 'identifier' => 'title', |
|
| 245 | 'fieldTypeIdentifier' => 'ezstring', |
|
| 246 | ) |
|
| 247 | ) |
|
| 248 | ) |
|
| 249 | ); |
|
| 250 | ||
| 251 | return $contentTypeServiceMock; |
|
| 252 | } |
|
| 253 | ||
| 254 | /** |
|
| 255 | * Returns the array under test. |
|
| @@ 252-274 (lines=23) @@ | ||
| 249 | * |
|
| 250 | * @return \eZ\Publish\API\Repository\RoleService |
|
| 251 | */ |
|
| 252 | protected function getRoleServiceMock() |
|
| 253 | { |
|
| 254 | $roleServiceMock = $this->createMock(RoleService::class); |
|
| 255 | ||
| 256 | $roleServiceMock->expects($this->any()) |
|
| 257 | ->method('newPolicyCreateStruct') |
|
| 258 | ->with( |
|
| 259 | $this->equalTo('content'), |
|
| 260 | $this->equalTo('delete') |
|
| 261 | ) |
|
| 262 | ->will( |
|
| 263 | $this->returnValue( |
|
| 264 | new PolicyCreateStruct( |
|
| 265 | array( |
|
| 266 | 'module' => 'content', |
|
| 267 | 'function' => 'delete', |
|
| 268 | ) |
|
| 269 | ) |
|
| 270 | ) |
|
| 271 | ); |
|
| 272 | ||
| 273 | return $roleServiceMock; |
|
| 274 | } |
|
| 275 | } |
|
| 276 | ||
| @@ 267-289 (lines=23) @@ | ||
| 264 | * |
|
| 265 | * @return \eZ\Publish\API\Repository\LocationService |
|
| 266 | */ |
|
| 267 | protected function getLocationServiceMock() |
|
| 268 | { |
|
| 269 | $userServiceMock = $this->createMock(LocationService::class); |
|
| 270 | ||
| 271 | $userServiceMock->expects($this->any()) |
|
| 272 | ->method('loadLocation') |
|
| 273 | ->with($this->equalTo(5)) |
|
| 274 | ->will( |
|
| 275 | $this->returnValue( |
|
| 276 | new Location( |
|
| 277 | array( |
|
| 278 | 'contentInfo' => new ContentInfo( |
|
| 279 | array( |
|
| 280 | 'id' => 4, |
|
| 281 | ) |
|
| 282 | ), |
|
| 283 | ) |
|
| 284 | ) |
|
| 285 | ) |
|
| 286 | ); |
|
| 287 | ||
| 288 | return $userServiceMock; |
|
| 289 | } |
|
| 290 | ||
| 291 | /** |
|
| 292 | * Get the content service mock object. |
|