|
@@ 91-106 (lines=16) @@
|
| 88 |
|
* |
| 89 |
|
* @expectedException \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException |
| 90 |
|
*/ |
| 91 |
|
public function testSetUserPreferenceThrowsInvalidArgumentExceptionOnInvalidValue() |
| 92 |
|
{ |
| 93 |
|
$repository = $this->getRepository(); |
| 94 |
|
|
| 95 |
|
/* BEGIN: Use Case */ |
| 96 |
|
$userPreferenceService = $repository->getUserPreferenceService(); |
| 97 |
|
|
| 98 |
|
$setStruct = new UserPreferenceSetStruct([ |
| 99 |
|
'name' => 'setting', |
| 100 |
|
'value' => new \stdClass(), |
| 101 |
|
]); |
| 102 |
|
|
| 103 |
|
// This call will fail because value is not specified |
| 104 |
|
$userPreferenceService->setUserPreference([$setStruct]); |
| 105 |
|
/* END: Use Case */ |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
/** |
| 109 |
|
* @covers \eZ\Publish\API\Repository\UserPreferenceService::setUserPreference() |
|
@@ 113-127 (lines=15) @@
|
| 110 |
|
* @depends testSetUserPreference |
| 111 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
| 112 |
|
*/ |
| 113 |
|
public function testSetUserPreferenceThrowsInvalidArgumentExceptionOnEmptyName() |
| 114 |
|
{ |
| 115 |
|
$repository = $this->getRepository(); |
| 116 |
|
|
| 117 |
|
/* BEGIN: Use Case */ |
| 118 |
|
$userPreferenceService = $repository->getUserPreferenceService(); |
| 119 |
|
|
| 120 |
|
$setStruct = new UserPreferenceSetStruct([ |
| 121 |
|
'value' => 'value', |
| 122 |
|
]); |
| 123 |
|
|
| 124 |
|
// This call will fail because value is not specified |
| 125 |
|
$userPreferenceService->setUserPreference([$setStruct]); |
| 126 |
|
/* END: Use Case */ |
| 127 |
|
} |
| 128 |
|
|
| 129 |
|
/** |
| 130 |
|
* @covers \eZ\Publish\API\Repository\UserPreferenceService::getUserPreferenceCount() |