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