| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * File contains: eZ\Publish\Core\Repository\Tests\Service\Integration\ObjectStateBase class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @copyright Copyright (C) eZ Systems AS. All rights reserved. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license For full copyright and license information view LICENSE file distributed with this source code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | namespace eZ\Publish\Core\Repository\Tests\Service\Integration; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use eZ\Publish\Core\Repository\Tests\Service\Integration\Base as BaseServiceTest; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use eZ\Publish\Core\Repository\Values\ObjectState\ObjectState; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use eZ\Publish\Core\Repository\Values\ObjectState\ObjectStateGroup; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException as PropertyNotFound; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use eZ\Publish\API\Repository\Exceptions\PropertyReadOnlyException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use eZ\Publish\API\Repository\Exceptions\NotFoundException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use eZ\Publish\API\Repository\Tests\BaseTest as APIBaseTest; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * Test case for object state Service. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | abstract class ObjectStateBase extends BaseServiceTest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      * Test a new class and default values on properties. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      * @covers \eZ\Publish\API\Repository\Values\ObjectState\ObjectState::__construct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * @covers \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup::__construct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     public function testNewClass() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         $objectState = new ObjectState(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |                 'id' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |                 'identifier' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |                 'priority' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |                 'defaultLanguageCode' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |                 'languageCodes' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |                 'names' => array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |                 'descriptions' => array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |             $objectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         $objectStateGroup = new ObjectStateGroup(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |                 'id' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |                 'identifier' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |                 'defaultLanguageCode' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |                 'languageCodes' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |                 'names' => array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |                 'descriptions' => array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |             $objectStateGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      * Test retrieving missing property. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |      * @covers \eZ\Publish\API\Repository\Values\ObjectState\ObjectState::__get | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |      * @covers \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup::__get | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 68 |  | View Code Duplication |     public function testMissingProperty() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |             $objectState = new ObjectState(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |             $value = $objectState->notDefined; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |             $this->fail('Succeeded getting non existing property'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         } catch (PropertyNotFound $e) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |             $objectStateGroup = new ObjectStateGroup(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |             $value = $objectStateGroup->notDefined; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |             $this->fail('Succeeded getting non existing property'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |         } catch (PropertyNotFound $e) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |      * Test setting read only property. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      * @covers \eZ\Publish\API\Repository\Values\ObjectState\ObjectState::__set | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |      * @covers \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup::__set | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 91 |  | View Code Duplication |     public function testReadOnlyProperty() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |             $objectState = new ObjectState(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |             $objectState->id = 42; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             $this->fail('Succeeded setting read only property'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         } catch (PropertyReadOnlyException $e) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |             $objectStateGroup = new ObjectStateGroup(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |             $objectStateGroup->id = 42; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |             $this->fail('Succeeded setting read only property'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         } catch (PropertyReadOnlyException $e) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |      * Test if property exists. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |      * @covers \eZ\Publish\API\Repository\Values\ObjectState\ObjectState::__isset | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |      * @covers \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup::__isset | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |     public function testIsPropertySet() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |         $objectState = new ObjectState(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |         $value = isset($objectState->notDefined); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         $this->assertFalse($value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |         $value = isset($objectState->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |         $this->assertTrue($value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |         $objectStateGroup = new ObjectStateGroup(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |         $value = isset($objectStateGroup->notDefined); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         $this->assertFalse($value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         $value = isset($objectStateGroup->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |         $this->assertTrue($value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |      * Test unsetting a property. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |      * @covers \eZ\Publish\API\Repository\Values\ObjectState\ObjectState::__unset | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * @covers \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup::__unset | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |     public function testUnsetProperty() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |         $objectState = new ObjectState(array('id' => 2)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |             unset($objectState->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |             $this->fail('Unsetting read-only property succeeded'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |         } catch (PropertyReadOnlyException $e) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |         $objectStateGroup = new ObjectStateGroup(array('id' => 2)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |             unset($objectStateGroup->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |             $this->fail('Unsetting read-only property succeeded'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |         } catch (PropertyReadOnlyException $e) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |      * Test service method for creating object state group. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::createObjectStateGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |     public function testCreateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |         $groupCreateStruct = $objectStateService->newObjectStateGroupCreateStruct('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |         $groupCreateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |         $groupCreateStruct->names = array('eng-GB' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |         $groupCreateStruct->descriptions = array('eng-GB' => 'Test description'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |         $createdGroup = $objectStateService->createObjectStateGroup($groupCreateStruct); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |             $createdGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |                 'id' => 3, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |                 'identifier' => 'test', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |                 'defaultLanguageCode' => 'eng-GB', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |                 'languageCodes' => array('eng-GB'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |                 'names' => array('eng-GB' => 'Test'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |                 'descriptions' => array('eng-GB' => 'Test description'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |             $createdGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |      * Test service method for creating object state group throwing InvalidArgumentException. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::createObjectStateGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     public function testCreateGroupThrowsInvalidArgumentException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |         $groupCreateStruct = $objectStateService->newObjectStateGroupCreateStruct('ez_lock'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         $groupCreateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |         $groupCreateStruct->names = array('eng-GB' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |         $groupCreateStruct->descriptions = array('eng-GB' => 'Test description'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |         $objectStateService->createObjectStateGroup($groupCreateStruct); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |      * Test service method for loading object state group. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::loadObjectStateGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |     public function testLoadObjectStateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |         $group = $this->repository->getObjectStateService()->loadObjectStateGroup(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |             $group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |                 'id' => 2, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |                 'identifier' => 'ez_lock', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |                 'defaultLanguageCode' => 'eng-US', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |                 'languageCodes' => array('eng-US'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |                 'names' => array('eng-US' => 'Lock'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |                 'descriptions' => array('eng-US' => ''), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |             $group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |      * Test service method for loading object state group throwing NotFoundException. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::loadObjectStateGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |     public function testLoadObjectStateGroupThrowsNotFoundException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |         $this->repository->getObjectStateService()->loadObjectStateGroup(APIBaseTest::DB_INT_MAX); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |      * Test service method for loading object state groups. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::loadObjectStateGroups | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |     public function testLoadObjectStateGroups() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |         $groups = $this->repository->getObjectStateService()->loadObjectStateGroups(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |         $this->assertInternalType('array', $groups); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |         $this->assertCount(1, $groups); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |         foreach ($groups as $group) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |             $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |                 '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |                 $group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |      * Test service method for loading object states within a group. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::loadObjectStates | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |     public function testLoadObjectStates() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |         $group = $objectStateService->loadObjectStateGroup(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |         $states = $this->repository->getObjectStateService()->loadObjectStates($group); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |         $this->assertInternalType('array', $states); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |         $this->assertCount(2, $states); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |         $priority = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |         foreach ($states as $state) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |             $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |                 '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |                 $state | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |             $this->assertEquals($group->id, $state->getObjectStateGroup()->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |             $this->assertEquals($priority, $state->priority); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |             ++$priority; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |      * Test service method for updating object state group. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::updateObjectStateGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |     public function testUpdateObjectStateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |         $groupUpdateStruct = $objectStateService->newObjectStateGroupUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |         $groupUpdateStruct->identifier = 'test'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |         $groupUpdateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |         $groupUpdateStruct->names = array('eng-GB' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |         $groupUpdateStruct->descriptions = array('eng-GB' => 'Test description'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |         $group = $objectStateService->loadObjectStateGroup(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |         $updatedGroup = $objectStateService->updateObjectStateGroup($group, $groupUpdateStruct); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |             $updatedGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |                 'id' => 2, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |                 'identifier' => 'test', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |                 'defaultLanguageCode' => 'eng-GB', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |                 'languageCodes' => array('eng-GB'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |                 'names' => array('eng-GB' => 'Test'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |                 'descriptions' => array('eng-GB' => 'Test description'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |             $updatedGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |      * Test service method for partially updating object state group. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::updateObjectStateGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |     public function testPartiallyUpdateObjectStateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |         $groupUpdateStruct = $objectStateService->newObjectStateGroupUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |         $groupUpdateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |         $groupUpdateStruct->names = array('eng-GB' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |         $group = $objectStateService->loadObjectStateGroup(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |         $updatedGroup = $objectStateService->updateObjectStateGroup($group, $groupUpdateStruct); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |             $updatedGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |                 'id' => 2, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |                 'identifier' => 'ez_lock', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |                 'defaultLanguageCode' => 'eng-GB', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |                 'languageCodes' => array('eng-GB'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |                 'names' => array('eng-GB' => 'Test'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |                 // descriptions array should have an empty value for eng-GB | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |                 // without the original descriptions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |                 // since the descriptions were not in the update struct and we're changing default language | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |                 'descriptions' => array('eng-GB' => ''), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |             $updatedGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |      * Test service method for updating object state group throwing InvalidArgumentException. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::updateObjectStateGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 372 |  | View Code Duplication |     public function testUpdateObjectStateGroupThrowsInvalidArgumentException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |         $groupCreateStruct = $objectStateService->newObjectStateGroupCreateStruct('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |         $groupCreateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |         $groupCreateStruct->names = array('eng-GB' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |         $groupCreateStruct->descriptions = array('eng-GB' => 'Test description'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |         $createdGroup = $objectStateService->createObjectStateGroup($groupCreateStruct); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |         $groupUpdateStruct = $objectStateService->newObjectStateGroupUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |         $groupUpdateStruct->identifier = 'ez_lock'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |         $objectStateService->updateObjectStateGroup($createdGroup, $groupUpdateStruct); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |      * Test service method for deleting object state group. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::deleteObjectStateGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |     public function testDeleteObjectStateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |         $group = $objectStateService->loadObjectStateGroup(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |         $objectStateService->deleteObjectStateGroup($group); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |             $objectStateService->loadObjectStateGroup(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |             $this->fail('Successfully loaded object state group after deleting it'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |         } catch (NotFoundException $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |             // Do nothing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |             $objectStateService->loadObjectState(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |             $this->fail('Successfully loaded object state from deleted group'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |         } catch (NotFoundException $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |             // Do nothing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |             $objectStateService->loadObjectState(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |             $this->fail('Successfully loaded object state from deleted group'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |         } catch (NotFoundException $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |             // Do nothing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |      * Test service method for creating object state. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::createObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 429 |  | View Code Duplication |     public function testCreateObjectState() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |         $group = $objectStateService->loadObjectStateGroup(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |         $stateCreateStruct = $objectStateService->newObjectStateCreateStruct('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |         $stateCreateStruct->priority = 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |         $stateCreateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |         $stateCreateStruct->names = array('eng-GB' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |         $stateCreateStruct->descriptions = array('eng-GB' => 'Test description'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |         $createdState = $objectStateService->createObjectState( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |             $group, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |             $stateCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |             $createdState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |                 'id' => 3, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |                 'identifier' => 'test', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |                 'priority' => 2, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |                 'defaultLanguageCode' => 'eng-GB', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |                 'languageCodes' => array('eng-GB'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |                 'names' => array('eng-GB' => 'Test'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |                 'descriptions' => array('eng-GB' => 'Test description'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |             $createdState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |             $createdState->getObjectStateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |         $this->assertEquals($group->id, $createdState->getObjectStateGroup()->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |      * Test service method for creating object state in empty group. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::createObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |     public function testCreateObjectStateInEmptyGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |         $groupCreateStruct = $objectStateService->newObjectStateGroupCreateStruct('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |         $groupCreateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |         $groupCreateStruct->names = array('eng-GB' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |         $groupCreateStruct->descriptions = array('eng-GB' => 'Test description'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |         $createdGroup = $objectStateService->createObjectStateGroup($groupCreateStruct); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |         $stateCreateStruct = $objectStateService->newObjectStateCreateStruct('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |         $stateCreateStruct->priority = 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |         $stateCreateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |         $stateCreateStruct->names = array('eng-GB' => 'Test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |         $stateCreateStruct->descriptions = array('eng-GB' => 'Test description'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |         $createdState = $objectStateService->createObjectState( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |             $createdGroup, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |             $stateCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |             $createdState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |         $this->assertNotNull($createdState->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |                 'identifier' => 'test', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |                 'priority' => 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |                 'defaultLanguageCode' => 'eng-GB', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |                 'languageCodes' => array('eng-GB'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |                 'names' => array('eng-GB' => 'Test'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |                 'descriptions' => array('eng-GB' => 'Test description'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |             $createdState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |             $createdState->getObjectStateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |         $this->assertEquals($createdGroup->id, $createdState->getObjectStateGroup()->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |         $this->assertGreaterThan(0, $objectStateService->getContentCount($createdState)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |      * Test service method for creating object state throwing InvalidArgumentException. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::createObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |     public function testCreateObjectStateThrowsInvalidArgumentException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |         $group = $objectStateService->loadObjectStateGroup(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |         $stateCreateStruct = $objectStateService->newObjectStateCreateStruct('not_locked'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |         $stateCreateStruct->priority = 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |         $stateCreateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |         $stateCreateStruct->names = array('eng-GB' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |         $stateCreateStruct->descriptions = array('eng-GB' => 'Test description'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |         $objectStateService->createObjectState( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |             $group, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |             $stateCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |      * Test service method for loading object state. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::loadObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |     public function testLoadObjectState() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |         $state = $this->repository->getObjectStateService()->loadObjectState(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |             $state | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |                 'id' => 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |                 'identifier' => 'not_locked', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |                 'priority' => 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |                 'defaultLanguageCode' => 'eng-US', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |                 'languageCodes' => array('eng-US'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |                 'names' => array('eng-US' => 'Not locked'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |                 'descriptions' => array('eng-US' => ''), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |             $state | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |             $state->getObjectStateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |         $this->assertEquals(2, $state->getObjectStateGroup()->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |      * Test service method for loading object state throwing NotFoundException. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::loadObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |     public function testLoadObjectStateThrowsNotFoundException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |         $this->repository->getObjectStateService()->loadObjectState(APIBaseTest::DB_INT_MAX); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |      * Test service method for updating object state. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::updateObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 601 |  | View Code Duplication |     public function testUpdateObjectState() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |         $stateUpdateStruct = $objectStateService->newObjectStateUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |         $stateUpdateStruct->identifier = 'test'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |         $stateUpdateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |         $stateUpdateStruct->names = array('eng-GB' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |         $stateUpdateStruct->descriptions = array('eng-GB' => 'Test description'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |         $state = $objectStateService->loadObjectState(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |         $updatedState = $objectStateService->updateObjectState($state, $stateUpdateStruct); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |             $updatedState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  |                 'id' => 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |                 'identifier' => 'test', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |                 'priority' => 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |                 'defaultLanguageCode' => 'eng-GB', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |                 'languageCodes' => array('eng-GB'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |                 'names' => array('eng-GB' => 'Test'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |                 'descriptions' => array('eng-GB' => 'Test description'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |             $updatedState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  |             $updatedState->getObjectStateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  |         $this->assertEquals($state->getObjectStateGroup()->id, $updatedState->getObjectStateGroup()->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  |      * Test service method for partially updating object state. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::updateObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  |     public function testPartiallyUpdateObjectState() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 |  |  |         $stateUpdateStruct = $objectStateService->newObjectStateUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 |  |  |         $stateUpdateStruct->identifier = 'test'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  |         $stateUpdateStruct->names = array('eng-US' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 |  |  |         $state = $objectStateService->loadObjectState(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  |         $updatedState = $objectStateService->updateObjectState($state, $stateUpdateStruct); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  |             $updatedState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  |                 'id' => 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 |  |  |                 'identifier' => 'test', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  |                 'priority' => 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  |                 'defaultLanguageCode' => 'eng-US', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |                 'languageCodes' => array('eng-US'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 |  |  |                 'names' => array('eng-US' => 'Test'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  |                 // Original value of empty description for eng-US should be kept | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  |                 'descriptions' => array('eng-US' => ''), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  |             $updatedState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  |             $updatedState->getObjectStateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  |         $this->assertEquals($state->getObjectStateGroup()->id, $updatedState->getObjectStateGroup()->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 |  |  |      * Test service method for updating object state throwing InvalidArgumentException. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::updateObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 |  |  |     public function testUpdateObjectStateThrowsInvalidArgumentException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  |         $stateUpdateStruct = $objectStateService->newObjectStateUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 696 |  |  |         $stateUpdateStruct->identifier = 'locked'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 697 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 698 |  |  |         $state = $objectStateService->loadObjectState(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 699 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 700 |  |  |         $objectStateService->updateObjectState($state, $stateUpdateStruct); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 701 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 702 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 703 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 704 |  |  |      * Test service method for setting the priority of object state. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 705 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 706 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::setPriorityOfObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 707 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 708 |  |  |     public function testSetPriorityOfObjectState() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 709 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 710 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 711 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 712 |  |  |         $state = $objectStateService->loadObjectState(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 713 |  |  |         $objectStateService->setPriorityOfObjectState($state, 0); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 714 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 715 |  |  |         $firstState = $objectStateService->loadObjectState(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 716 |  |  |         $this->assertEquals(1, $firstState->priority); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 717 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 718 |  |  |         $secondState = $objectStateService->loadObjectState(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 719 |  |  |         $this->assertEquals(0, $secondState->priority); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 720 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 721 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 722 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 723 |  |  |      * Test service method for deleting object state. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 724 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 725 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::deleteObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 726 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 727 |  |  |     public function testDeleteObjectState() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 728 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 729 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 730 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 731 |  |  |         $state = $objectStateService->loadObjectState(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 732 |  |  |         $objectStateService->deleteObjectState($state); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 733 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 734 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 735 |  |  |             $objectStateService->loadObjectState(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 736 |  |  |             $this->fail('Successfully loaded object state after deleting it'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 737 |  |  |         } catch (NotFoundException $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 738 |  |  |             // Do nothing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 739 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 740 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 741 |  |  |         $this->assertEquals(0, $objectStateService->getContentCount($state)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 742 |  |  |         $this->assertGreaterThan( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 743 |  |  |             0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 744 |  |  |             $objectStateService->getContentCount( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 745 |  |  |                 $objectStateService->loadObjectState(2) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 746 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 747 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 748 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 749 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 750 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 751 |  |  |      * Test service method for setting the object state to content. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 752 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 753 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::setContentState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 754 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 755 |  |  |     public function testSetContentState() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 756 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 757 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 758 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 759 |  |  |         $state = $objectStateService->loadObjectState(2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 760 |  |  |         $group = $state->getObjectStateGroup(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 761 |  |  |         $contentInfo = $this->repository->getContentService()->loadContentInfo(4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 762 |  |  |         $objectStateService->setContentState( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 763 |  |  |             $contentInfo, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 764 |  |  |             $group, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 765 |  |  |             $state | 
            
                                                                                                            
                            
            
                                    
            
            
                | 766 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 767 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 768 |  |  |         $newObjectState = $objectStateService->getContentState($contentInfo, $group); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 769 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 770 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 771 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 772 |  |  |             $newObjectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 773 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 774 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 775 |  |  |         $this->assertEquals(2, $newObjectState->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 776 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 777 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 778 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 779 |  |  |      * Test service method for setting the object state to content throwing InvalidArgumentException. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 780 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 781 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::setContentState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 782 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 783 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 784 |  |  |     public function testSetContentStateThrowsInvalidArgumentException() | 
            
                                                                        
                            
            
                                    
            
            
                | 785 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 786 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                        
                            
            
                                    
            
            
                | 787 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 788 |  |  |         $groupCreateStruct = $objectStateService->newObjectStateGroupCreateStruct('test'); | 
            
                                                                        
                            
            
                                    
            
            
                | 789 |  |  |         $groupCreateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                        
                            
            
                                    
            
            
                | 790 |  |  |         $groupCreateStruct->names = array('eng-GB' => 'Test'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 791 |  |  |         $groupCreateStruct->descriptions = array('eng-GB' => 'Test description'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 792 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 793 |  |  |         $createdGroup = $objectStateService->createObjectStateGroup($groupCreateStruct); | 
            
                                                                        
                            
            
                                    
            
            
                | 794 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 795 |  |  |         $stateCreateStruct = $objectStateService->newObjectStateCreateStruct('test'); | 
            
                                                                        
                            
            
                                    
            
            
                | 796 |  |  |         $stateCreateStruct->priority = 2; | 
            
                                                                        
                            
            
                                    
            
            
                | 797 |  |  |         $stateCreateStruct->defaultLanguageCode = 'eng-GB'; | 
            
                                                                        
                            
            
                                    
            
            
                | 798 |  |  |         $stateCreateStruct->names = array('eng-GB' => 'Test'); | 
            
                                                                        
                            
            
                                    
            
            
                | 799 |  |  |         $stateCreateStruct->descriptions = array('eng-GB' => 'Test description'); | 
            
                                                                        
                            
            
                                    
            
            
                | 800 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 801 |  |  |         $createdState = $objectStateService->createObjectState( | 
            
                                                                        
                            
            
                                    
            
            
                | 802 |  |  |             $createdGroup, | 
            
                                                                        
                            
            
                                    
            
            
                | 803 |  |  |             $stateCreateStruct | 
            
                                                                        
                            
            
                                    
            
            
                | 804 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 805 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 806 |  |  |         $objectStateService->setContentState( | 
            
                                                                        
                            
            
                                    
            
            
                | 807 |  |  |             $this->repository->getContentService()->loadContentInfo(4), | 
            
                                                                        
                            
            
                                    
            
            
                | 808 |  |  |             $objectStateService->loadObjectStateGroup(2), | 
            
                                                                        
                            
            
                                    
            
            
                | 809 |  |  |             $createdState | 
            
                                                                        
                            
            
                                    
            
            
                | 810 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 811 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 812 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 813 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 814 |  |  |      * Test service method for getting the object state of content. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 815 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 816 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::getContentState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 817 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 818 |  |  |     public function testGetContentState() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 819 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 820 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 821 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 822 |  |  |         $objectState = $objectStateService->getContentState( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 823 |  |  |             $this->repository->getContentService()->loadContentInfo(4), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 824 |  |  |             $objectStateService->loadObjectStateGroup(2) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 825 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 826 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 827 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 828 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectState', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 829 |  |  |             $objectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 830 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 831 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 832 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 833 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 834 |  |  |                 'id' => 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 835 |  |  |                 'identifier' => 'not_locked', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 836 |  |  |                 'priority' => 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 837 |  |  |                 'defaultLanguageCode' => 'eng-US', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 838 |  |  |                 'languageCodes' => array('eng-US'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 839 |  |  |                 'names' => array('eng-US' => 'Not locked'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 840 |  |  |                 'descriptions' => array('eng-US' => ''), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 841 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 842 |  |  |             $objectState | 
            
                                                                                                            
                            
            
                                    
            
            
                | 843 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 844 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 845 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 846 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 847 |  |  |             $objectState->getObjectStateGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 848 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 849 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 850 |  |  |         $this->assertEquals(2, $objectState->getObjectStateGroup()->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 851 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 852 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 853 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 854 |  |  |      * Test service method for getting the count of content assigned to object state. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 855 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 856 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::getContentCount | 
            
                                                                                                            
                            
            
                                    
            
            
                | 857 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 858 |  |  |     public function testGetContentCount() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 859 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 860 |  |  |         $objectStateService = $this->repository->getObjectStateService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 861 |  |  |         $state = $objectStateService->loadObjectState(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 862 |  |  |         $count = $objectStateService->getContentCount($state); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 863 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 864 |  |  |         $this->assertGreaterThan(0, $count); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 865 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 866 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 867 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 868 |  |  |      * Test service method for creating a new object state create struct object. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 869 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 870 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::newObjectStateCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 871 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 872 |  | View Code Duplication |     public function testNewObjectStateCreateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 873 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 874 |  |  |         $objectStateCreateStruct = $this->repository->getObjectStateService()->newObjectStateCreateStruct('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 875 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 876 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 877 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateCreateStruct', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 878 |  |  |             $objectStateCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 879 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 880 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 881 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 882 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 883 |  |  |                 'identifier' => 'test', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 884 |  |  |                 'priority' => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 885 |  |  |                 'defaultLanguageCode' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 886 |  |  |                 'names' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 887 |  |  |                 'descriptions' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 888 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 889 |  |  |             $objectStateCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 890 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 891 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 892 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 893 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 894 |  |  |      * Test service method for creating a new object state update struct object. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 895 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 896 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::newObjectStateUpdateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 897 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 898 |  |  |     public function testNewObjectStateUpdateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 899 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 900 |  |  |         $objectStateUpdateStruct = $this->repository->getObjectStateService()->newObjectStateUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 901 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 902 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 903 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateUpdateStruct', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 904 |  |  |             $objectStateUpdateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 905 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 906 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 907 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 908 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 909 |  |  |                 'identifier' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 910 |  |  |                 'defaultLanguageCode' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 911 |  |  |                 'names' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 912 |  |  |                 'descriptions' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 913 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 914 |  |  |             $objectStateUpdateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 915 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 916 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 917 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 918 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 919 |  |  |      * Test service method for creating a new object state group create struct object. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 920 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 921 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::newObjectStateGroupCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 922 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 923 |  | View Code Duplication |     public function testNewObjectStateGroupCreateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 924 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 925 |  |  |         $objectStateGroupCreateStruct = $this->repository->getObjectStateService()->newObjectStateGroupCreateStruct('test'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 926 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 927 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 928 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroupCreateStruct', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 929 |  |  |             $objectStateGroupCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 930 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 931 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 932 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 933 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 934 |  |  |                 'identifier' => 'test', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 935 |  |  |                 'defaultLanguageCode' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 936 |  |  |                 'names' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 937 |  |  |                 'descriptions' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 938 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 939 |  |  |             $objectStateGroupCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 940 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 941 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 942 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 943 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 944 |  |  |      * Test service method for creating a new object state group update struct object. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 945 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 946 |  |  |      * @covers \eZ\Publish\API\Repository\ObjectStateService::newObjectStateGroupUpdateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 947 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 948 |  |  |     public function testNewObjectStateGroupUpdateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 949 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 950 |  |  |         $objectStateGroupUpdateStruct = $this->repository->getObjectStateService()->newObjectStateGroupUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 951 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 952 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 953 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ObjectState\\ObjectStateGroupUpdateStruct', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 954 |  |  |             $objectStateGroupUpdateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 955 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 956 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 957 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 958 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 959 |  |  |                 'identifier' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 960 |  |  |                 'defaultLanguageCode' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 961 |  |  |                 'names' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 962 |  |  |                 'descriptions' => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 963 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 964 |  |  |             $objectStateGroupUpdateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 965 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 966 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 967 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 968 |  |  |  | 
            
                        
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.