Skip to content

Commit

Permalink
Fluent interface for fillFromFields.
Browse files Browse the repository at this point in the history
  • Loading branch information
JASchilz committed Oct 4, 2016
1 parent e610c20 commit 88272fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/orm-wrapper/PropelObjectWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ protected function addBehaviorConstraintsToFields(array $fields)
* Expects that $fields contains a set of $fieldName => $field pairs.
*
* @param FieldInterface[] $fields
* @return void
* @return ObjectWrapperInterface
*/
public function fillFromFields(array $fields)
{
Expand Down Expand Up @@ -199,6 +199,8 @@ public function fillFromFields(array $fields)
}
}
}

return $this;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion test/PropelObjectWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Athens\Core\Test;

use Athens\Core\ORMWrapper\ObjectWrapperInterface;
use PHPUnit_Framework_TestCase;

use Athens\Propel\ORMWrapper\PropelObjectWrapper;
Expand Down Expand Up @@ -391,9 +392,10 @@ public function testFillFromFields()
$field->setValidatedData($values[$fieldName]);
}

$wrappedTestClass->fillFromFields($fields);
$result = $wrappedTestClass->fillFromFields($fields);

$this->assertEquals($values, $wrappedTestClass->getValues());
$this->assertInstanceOf(ObjectWrapperInterface::class, $result);
}

public function testSave()
Expand Down

0 comments on commit 88272fe

Please sign in to comment.