| @@ 411-428 (lines=18) @@ | ||
| 408 | * @covers \eZ\Publish\Core\Repository\URLWildcardService::remove |
|
| 409 | * @expectedException \Exception |
|
| 410 | */ |
|
| 411 | public function testLoadThrowsException() |
|
| 412 | { |
|
| 413 | $mockedService = $this->getPartlyMockedURLWildcardService(); |
|
| 414 | /** @var \PHPUnit_Framework_MockObject_MockObject $handlerMock */ |
|
| 415 | $handlerMock = $this->getPersistenceMock()->urlWildcardHandler(); |
|
| 416 | ||
| 417 | $handlerMock->expects( |
|
| 418 | $this->once() |
|
| 419 | )->method( |
|
| 420 | 'load' |
|
| 421 | )->with( |
|
| 422 | $this->equalTo('Luigi') |
|
| 423 | )->will( |
|
| 424 | $this->throwException(new \Exception()) |
|
| 425 | ); |
|
| 426 | ||
| 427 | $mockedService->load('Luigi'); |
|
| 428 | } |
|
| 429 | ||
| 430 | /** |
|
| 431 | * Test for the load() method. |
|
| @@ 482-500 (lines=19) @@ | ||
| 479 | * @depends testConstructor |
|
| 480 | * @covers \eZ\Publish\Core\Repository\URLWildcardService::loadAll |
|
| 481 | */ |
|
| 482 | public function testLoadAll() |
|
| 483 | { |
|
| 484 | $mockedService = $this->getPartlyMockedURLWildcardService(); |
|
| 485 | /** @var \PHPUnit_Framework_MockObject_MockObject $handlerMock */ |
|
| 486 | $handlerMock = $this->getPersistenceMock()->urlWildcardHandler(); |
|
| 487 | ||
| 488 | $handlerMock->expects( |
|
| 489 | $this->once() |
|
| 490 | )->method( |
|
| 491 | 'loadAll' |
|
| 492 | )->with( |
|
| 493 | $this->equalTo(0), |
|
| 494 | $this->equalTo(-1) |
|
| 495 | )->will( |
|
| 496 | $this->returnValue(array()) |
|
| 497 | ); |
|
| 498 | ||
| 499 | $mockedService->loadAll(); |
|
| 500 | } |
|
| 501 | ||
| 502 | /** |
|
| 503 | * Test for the loadAll() method. |
|
| @@ 602-620 (lines=19) @@ | ||
| 599 | * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException |
|
| 600 | * @dataProvider providerForTestTranslateThrowsNotFoundException |
|
| 601 | */ |
|
| 602 | public function testTranslateThrowsNotFoundException($createArray, $url) |
|
| 603 | { |
|
| 604 | $mockedService = $this->getPartlyMockedURLWildcardService(); |
|
| 605 | /** @var \PHPUnit_Framework_MockObject_MockObject $handlerMock */ |
|
| 606 | $handlerMock = $this->getPersistenceMock()->urlWildcardHandler(); |
|
| 607 | ||
| 608 | $handlerMock->expects( |
|
| 609 | $this->once() |
|
| 610 | )->method( |
|
| 611 | 'loadAll' |
|
| 612 | )->with( |
|
| 613 | $this->equalTo(0), |
|
| 614 | $this->equalTo(-1) |
|
| 615 | )->will( |
|
| 616 | $this->returnValue(array(new SPIURLWildcard($createArray))) |
|
| 617 | ); |
|
| 618 | ||
| 619 | $mockedService->translate($url); |
|
| 620 | } |
|
| 621 | ||
| 622 | /** |
|
| 623 | * @return array |
|