public function testConstruct() { $state = new State(); $this->assertNotNull($state->getUid()); $this->assertNull($state->getCode()); $this->assertNull($state->getLabel()); $state = new State('test_state', ['code' => 123, 'label' => 'random label']); $this->assertSame('test_state', $state->getUid()); $this->assertSame(123, $state->getCode()); $this->assertSame('random label', $state->getLabel()); }
/** * Returns the code of the workflow state. * * @return integer * * @Serializer\VirtualProperty * @Serializer\Type("string") */ public function getStateCode() { $code = $this->isOnline(true) ? '1' : '0'; $code .= null !== $this->_workflow_state ? '_' . $this->_workflow_state->getCode() : ''; return $code; }