|
@@ 40-62 (lines=23) @@
|
| 37 |
|
$this->loader->loadLocation($contentInfo); |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
public function testLoadLocation() |
| 41 |
|
{ |
| 42 |
|
$contentInfo = new ContentInfo(['mainLocationId' => 42]); |
| 43 |
|
$location = new Location(); |
| 44 |
|
|
| 45 |
|
$this->getRepositoryMock() |
| 46 |
|
->expects($this->any()) |
| 47 |
|
->method('getPermissionResolver') |
| 48 |
|
->will($this->returnValue($this->getPermissionResolverMock())); |
| 49 |
|
|
| 50 |
|
$this->getRepositoryMock() |
| 51 |
|
->expects($this->any()) |
| 52 |
|
->method('getLocationService') |
| 53 |
|
->will($this->returnValue($this->getLocationServiceMock())); |
| 54 |
|
|
| 55 |
|
$this->getLocationServiceMock() |
| 56 |
|
->expects($this->once()) |
| 57 |
|
->method('loadLocation') |
| 58 |
|
->with(42) |
| 59 |
|
->will($this->returnValue($location)); |
| 60 |
|
|
| 61 |
|
$this->assertSame($location, $this->loader->loadLocation($contentInfo)); |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
/** |
| 65 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
|
@@ 67-91 (lines=25) @@
|
| 64 |
|
/** |
| 65 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
| 66 |
|
*/ |
| 67 |
|
public function testLoadLocationError() |
| 68 |
|
{ |
| 69 |
|
$contentInfo = new ContentInfo(['mainLocationId' => 42]); |
| 70 |
|
$location = new Location(); |
| 71 |
|
|
| 72 |
|
$this->getRepositoryMock() |
| 73 |
|
->expects($this->any()) |
| 74 |
|
->method('getPermissionResolver') |
| 75 |
|
->will($this->returnValue($this->getPermissionResolverMock())); |
| 76 |
|
|
| 77 |
|
$this->getRepositoryMock() |
| 78 |
|
->expects($this->any()) |
| 79 |
|
->method('getLocationService') |
| 80 |
|
->will($this->returnValue($this->getLocationServiceMock())); |
| 81 |
|
|
| 82 |
|
$this->getLocationServiceMock() |
| 83 |
|
->expects($this->once()) |
| 84 |
|
->method('loadLocation') |
| 85 |
|
->with(42) |
| 86 |
|
->will( |
| 87 |
|
$this->throwException(new NotFoundException('main location of content', 42)) |
| 88 |
|
); |
| 89 |
|
|
| 90 |
|
$this->assertSame($location, $this->loader->loadLocation($contentInfo)); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
/** |
| 94 |
|
* @return \eZ\Publish\Core\Repository\Repository|\PHPUnit_Framework_MockObject_MockObject |