/** * This method returns the ordered list of object states of a group. * * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup * * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectState[] */ public function loadObjectStates(APIObjectStateGroup $objectStateGroup) { $spiObjectStates = $this->objectStateHandler->loadObjectStates($objectStateGroup->id); $objectStates = array(); foreach ($spiObjectStates as $spiObjectState) { $objectStates[] = $this->buildDomainObjectStateObject($spiObjectState, $objectStateGroup); } return $objectStates; }
/** * @covers \eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::loadObjectStates */ public function testLoadObjectStates() { $states = $this->handler->loadObjectStates(2); $this->assertCount(2, $states); $this->assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\ObjectState', $states[0]); $this->assertEquals(1, $states[0]->id); $this->assertEquals(2, $states[0]->groupId); $this->assertEquals('not_locked', $states[0]->identifier); $this->assertEquals('eng-US', $states[0]->defaultLanguage); $this->assertEquals(array('eng-US'), $states[0]->languageCodes); $this->assertEquals(array('eng-US' => 'Not locked'), $states[0]->name); $this->assertEquals(array('eng-US' => ''), $states[0]->description); $this->assertEquals(0, $states[0]->priority); $this->assertInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\ObjectState', $states[1]); $this->assertEquals(2, $states[1]->id); $this->assertEquals(2, $states[1]->groupId); $this->assertEquals('locked', $states[1]->identifier); $this->assertEquals('eng-US', $states[1]->defaultLanguage); $this->assertEquals(array('eng-US'), $states[1]->languageCodes); $this->assertEquals(array('eng-US' => 'Locked'), $states[1]->name); $this->assertEquals(array('eng-US' => ''), $states[1]->description); $this->assertEquals(1, $states[1]->priority); }