Skip to content

Commit

Permalink
always load TransformTo extension
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis84 committed Feb 17, 2015
1 parent 78e99fe commit eed675f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/Extension/TransformTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class TransformTo implements ExtensionInterface
{
/**
* Transforms the data to given class via setter and getter methods.
* Important: If you pass the `object` param as string, then the class must
* be initializable without constructor arguments.
*
* @param Mapping $mapping The mapping object
* @param string|object $object The class name or an object
Expand Down
1 change: 1 addition & 0 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function __construct(array $extensions = [])
{
$this->extensions = array_merge([
new \Mapped\Extension\Transform,
new \Mapped\Extension\TransformTo,
new \Mapped\Extension\Validation,
new \Mapped\Extension\Multiple,
new \Mapped\Extension\Optional,
Expand Down
10 changes: 5 additions & 5 deletions tests/Extension/TransformToTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TransformToTest extends \PHPUnit_Framework_TestCase
{
public function testA()
{
$factory = new Factory([new \Mapped\Extension\TransformTo]);
$factory = new Factory;

$mapping = $factory->mapping([
'title' => $factory->string(),
Expand All @@ -33,7 +33,7 @@ public function testA()

public function testB()
{
$factory = new Factory([new \Mapped\Extension\TransformTo]);
$factory = new Factory;

$mapping = $factory->mapping([
'title' => $factory->string(),
Expand All @@ -49,9 +49,9 @@ public function testB()

public function testC()
{
$factory = new Factory([new \Mapped\Extension\TransformTo]);

$factory = new Factory;
$book = new Book;

$mapping = $factory->mapping([
'title' => $factory->string(),
'author' => $factory->string(),
Expand All @@ -68,7 +68,7 @@ public function testC()

public function testD()
{
$factory = new Factory([new \Mapped\Extension\TransformTo]);
$factory = new Factory;
$user = new User('a', 'b');

$mapping = $factory->mapping([
Expand Down

0 comments on commit eed675f

Please sign in to comment.