Merge pull request #314 from aygee/mutate-related-models

Mutating form attributes in related models
This commit is contained in:
Matt Lantz authored and GitHub committed 2017-05-14 18:07:43 -04:00
commit 321be7acf0
2 files changed
+33 -4

No files matched your search

+11
View File
@@ -46,6 +46,17 @@ class FormAccessibleTest extends PHPUnit_Framework_TestCase
$this->assertEquals($model->getFormValue('created_at'), $this->now->timestamp);
}
public function testItCanMutateRelatedValuesForForms()
{
$model = new ModelThatUsesForms($this->modelData);
$relatedModel = new ModelThatUsesForms($this->modelData);
$model->setRelation('related', $relatedModel);
$this->formBuilder->setModel($model);
$this->assertEquals($this->formBuilder->getValueAttribute('related[string]'), 'ponmlkjihgfedcba');
$this->assertEquals($this->formBuilder->getValueAttribute('related[created_at]'), $this->now->timestamp);
}
public function testItCanGetRelatedValueForForms()
{
$model = new ModelThatUsesForms($this->modelData);