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