|
@@ 26-36 (lines=11) @@
|
| 23 |
|
/** |
| 24 |
|
* @covers \eZ\Publish\API\Repository\BookmarkService::isBookmarked |
| 25 |
|
*/ |
| 26 |
|
public function testIsBookmarked() |
| 27 |
|
{ |
| 28 |
|
$repository = $this->getRepository(); |
| 29 |
|
|
| 30 |
|
/* BEGIN: Use Case */ |
| 31 |
|
$location = $repository->getLocationService()->loadLocation($this->generateId('location', self::LOCATION_ID_BOOKMARKED)); |
| 32 |
|
$isBookmarked = $repository->getBookmarkService()->isBookmarked($location); |
| 33 |
|
/* END: Use Case */ |
| 34 |
|
|
| 35 |
|
$this->assertTrue($isBookmarked); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
/** |
| 39 |
|
* @covers \eZ\Publish\API\Repository\BookmarkService::isBookmarked |
|
@@ 41-51 (lines=11) @@
|
| 38 |
|
/** |
| 39 |
|
* @covers \eZ\Publish\API\Repository\BookmarkService::isBookmarked |
| 40 |
|
*/ |
| 41 |
|
public function testIsNotBookmarked() |
| 42 |
|
{ |
| 43 |
|
$repository = $this->getRepository(); |
| 44 |
|
|
| 45 |
|
/* BEGIN: Use Case */ |
| 46 |
|
$location = $repository->getLocationService()->loadLocation($this->generateId('location', self::LOCATION_ID_NOT_BOOKMARKED)); |
| 47 |
|
$isBookmarked = $repository->getBookmarkService()->isBookmarked($location); |
| 48 |
|
/* END: Use Case */ |
| 49 |
|
|
| 50 |
|
$this->assertFalse($isBookmarked); |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
/** |
| 54 |
|
* @covers \eZ\Publish\Core\Repository\BookmarkService::createBookmark |
|
@@ 79-90 (lines=12) @@
|
| 76 |
|
* @depends testCreateBookmark |
| 77 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
| 78 |
|
*/ |
| 79 |
|
public function testCreateBookmarkThrowsInvalidArgumentException() |
| 80 |
|
{ |
| 81 |
|
$repository = $this->getRepository(); |
| 82 |
|
|
| 83 |
|
/* BEGIN: Use Case */ |
| 84 |
|
$bookmarkService = $repository->getBookmarkService(); |
| 85 |
|
$locationService = $repository->getLocationService(); |
| 86 |
|
|
| 87 |
|
$location = $locationService->loadLocation($this->generateId('location', self::LOCATION_ID_BOOKMARKED)); |
| 88 |
|
$bookmarkService->createBookmark($location); |
| 89 |
|
/* END: Use Case */ |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
/** |
| 93 |
|
* @covers \eZ\Publish\Core\Repository\BookmarkService::deleteBookmark |
|
@@ 119-130 (lines=12) @@
|
| 116 |
|
* @depends testDeleteBookmark |
| 117 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
| 118 |
|
*/ |
| 119 |
|
public function testDeleteBookmarkThrowsInvalidArgumentException() |
| 120 |
|
{ |
| 121 |
|
$repository = $this->getRepository(); |
| 122 |
|
|
| 123 |
|
/* BEGIN: Use Case */ |
| 124 |
|
$bookmarkService = $repository->getBookmarkService(); |
| 125 |
|
$locationService = $repository->getLocationService(); |
| 126 |
|
|
| 127 |
|
$location = $locationService->loadLocation($this->generateId('location', self::LOCATION_ID_NOT_BOOKMARKED)); |
| 128 |
|
$bookmarkService->deleteBookmark($location); |
| 129 |
|
/* END: Use Case */ |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
/** |
| 133 |
|
* @covers \eZ\Publish\Core\Repository\BookmarkService::loadBookmarks |