| @@ 134-160 (lines=27) @@ | ||
| 131 | * |
|
| 132 | * @return \PHPUnit_Framework_MockObject_MockObject |
|
| 133 | */ |
|
| 134 | private function generateRepositoryMockForDepth($depth) |
|
| 135 | { |
|
| 136 | $locationServiceMock = $this |
|
| 137 | ->getMockBuilder('eZ\\Publish\\API\\Repository\\LocationService') |
|
| 138 | ->disableOriginalConstructor() |
|
| 139 | ->getMock(); |
|
| 140 | $locationServiceMock->expects($this->once()) |
|
| 141 | ->method('loadLocation') |
|
| 142 | ->with(42) |
|
| 143 | ->will( |
|
| 144 | $this->returnValue( |
|
| 145 | $this->getLocationMock(array('depth' => $depth)) |
|
| 146 | ) |
|
| 147 | ); |
|
| 148 | ||
| 149 | $repository = $this->getRepositoryMock(); |
|
| 150 | $repository |
|
| 151 | ->expects($this->once()) |
|
| 152 | ->method('getLocationService') |
|
| 153 | ->will($this->returnValue($locationServiceMock)); |
|
| 154 | $repository |
|
| 155 | ->expects($this->once()) |
|
| 156 | ->method('getPermissionResolver') |
|
| 157 | ->will($this->returnValue($this->getPermissionResolverMock())); |
|
| 158 | ||
| 159 | return $repository; |
|
| 160 | } |
|
| 161 | } |
|
| 162 | ||
| @@ 125-151 (lines=27) @@ | ||
| 122 | * |
|
| 123 | * @return \PHPUnit_Framework_MockObject_MockObject |
|
| 124 | */ |
|
| 125 | private function generateRepositoryMockForParentLocationId($parentLocationId) |
|
| 126 | { |
|
| 127 | $locationServiceMock = $this |
|
| 128 | ->getMockBuilder('eZ\\Publish\\API\\Repository\\LocationService') |
|
| 129 | ->disableOriginalConstructor() |
|
| 130 | ->getMock(); |
|
| 131 | $locationServiceMock->expects($this->once()) |
|
| 132 | ->method('loadLocation') |
|
| 133 | ->with(42) |
|
| 134 | ->will( |
|
| 135 | $this->returnValue( |
|
| 136 | $this->getLocationMock(array('parentLocationId' => $parentLocationId)) |
|
| 137 | ) |
|
| 138 | ); |
|
| 139 | ||
| 140 | $repository = $this->getRepositoryMock(); |
|
| 141 | $repository |
|
| 142 | ->expects($this->once()) |
|
| 143 | ->method('getLocationService') |
|
| 144 | ->will($this->returnValue($locationServiceMock)); |
|
| 145 | $repository |
|
| 146 | ->expects($this->any()) |
|
| 147 | ->method('getPermissionResolver') |
|
| 148 | ->will($this->returnValue($this->getPermissionResolverMock())); |
|
| 149 | ||
| 150 | return $repository; |
|
| 151 | } |
|
| 152 | } |
|
| 153 | ||
| @@ 37-69 (lines=33) @@ | ||
| 34 | * |
|
| 35 | * @return \PHPUnit_Framework_MockObject_MockObject |
|
| 36 | */ |
|
| 37 | private function generateRepositoryMockForSectionIdentifier($sectionIdentifier) |
|
| 38 | { |
|
| 39 | $sectionServiceMock = $this |
|
| 40 | ->getMockBuilder('eZ\\Publish\\API\\Repository\\SectionService') |
|
| 41 | ->disableOriginalConstructor() |
|
| 42 | ->getMock(); |
|
| 43 | $sectionServiceMock->expects($this->once()) |
|
| 44 | ->method('loadSection') |
|
| 45 | ->will( |
|
| 46 | $this->returnValue( |
|
| 47 | $this |
|
| 48 | ->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\Content\\Section') |
|
| 49 | ->setConstructorArgs( |
|
| 50 | array( |
|
| 51 | array('identifier' => $sectionIdentifier), |
|
| 52 | ) |
|
| 53 | ) |
|
| 54 | ->getMockForAbstractClass() |
|
| 55 | ) |
|
| 56 | ); |
|
| 57 | ||
| 58 | $repository = $this->getRepositoryMock(); |
|
| 59 | $repository |
|
| 60 | ->expects($this->once()) |
|
| 61 | ->method('getSectionService') |
|
| 62 | ->will($this->returnValue($sectionServiceMock)); |
|
| 63 | $repository |
|
| 64 | ->expects($this->any()) |
|
| 65 | ->method('getPermissionResolver') |
|
| 66 | ->will($this->returnValue($this->getPermissionResolverMock())); |
|
| 67 | ||
| 68 | return $repository; |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * @dataProvider matchSectionProvider |
|