| @@ 266-283 (lines=18) @@ | ||
| 263 | $this->createUrlService()->loadById(1); |
|
| 264 | } |
|
| 265 | ||
| 266 | public function testLoadById() |
|
| 267 | { |
|
| 268 | $this->configureUrlViewPermission(true); |
|
| 269 | ||
| 270 | $urlId = 12; |
|
| 271 | ||
| 272 | $this->urlHandler |
|
| 273 | ->expects($this->once()) |
|
| 274 | ->method('loadById') |
|
| 275 | ->with($urlId) |
|
| 276 | ->willReturn(new SpiUrl([ |
|
| 277 | 'id' => $urlId, |
|
| 278 | ])); |
|
| 279 | ||
| 280 | $this->assertEquals(new URL([ |
|
| 281 | 'id' => $urlId, |
|
| 282 | ]), $this->createUrlService()->loadById($urlId)); |
|
| 283 | } |
|
| 284 | ||
| 285 | /** |
|
| 286 | * @expectedException \eZ\Publish\Core\Base\Exceptions\UnauthorizedException |
|
| @@ 295-312 (lines=18) @@ | ||
| 292 | $this->createUrlService()->loadByUrl('http://ez.no'); |
|
| 293 | } |
|
| 294 | ||
| 295 | public function testLoadByUrl() |
|
| 296 | { |
|
| 297 | $this->configureUrlViewPermission(true); |
|
| 298 | ||
| 299 | $url = 'http://ez.no'; |
|
| 300 | ||
| 301 | $this->urlHandler |
|
| 302 | ->expects($this->once()) |
|
| 303 | ->method('loadByUrl') |
|
| 304 | ->with($url) |
|
| 305 | ->willReturn(new SpiUrl([ |
|
| 306 | 'url' => $url, |
|
| 307 | ])); |
|
| 308 | ||
| 309 | $this->assertEquals(new URL([ |
|
| 310 | 'url' => $url, |
|
| 311 | ]), $this->createUrlService()->loadByUrl($url)); |
|
| 312 | } |
|
| 313 | ||
| 314 | /** |
|
| 315 | * @dataProvider dateProviderForFindUsages |
|