public function testStringifiedModelForValue() { $form = new StaticUserWorkflowEmailMessageRecipientForm('WorkflowModelTestItem', Workflow::TYPE_ON_SAVE); $form->userId = Yii::app()->user->userModel->id; $this->assertEquals('Clark Kent', $form->stringifiedModelForValue); //Now switch userId, and the stringifiedModelForValue should clear out. $bobby = User::getByUsername('bobby'); $form->userId = $bobby->id; $this->assertEquals('bobby bobbyson', $form->stringifiedModelForValue); //test setting via setAttributes, it should ignore it. $form->setAttributes(array('stringifiedModelForValue' => 'should not set')); $this->assertEquals('bobby bobbyson', $form->stringifiedModelForValue); }
public function testSettingAttributesForStaticUserWorkflowEmailMessageRecipientForm() { $form = new StaticUserWorkflowEmailMessageRecipientForm('WorkflowModelTestItem', Workflow::TYPE_ON_SAVE); $this->assertNull($form->userId); $form->setAttributes(array('userId' => 5)); $this->assertEquals(5, $form->userId); }