Skip to content

Commit

Permalink
Add some more unit tests
Browse files Browse the repository at this point in the history
Summary:
Added some more unit tests to get
a test coverage of 100%!

Reviewers: claus.due

Reviewed By: claus.due

Differential Revision: https://phabricator.dkd.de/D910
  • Loading branch information
Sascha Egerer committed Feb 26, 2015
1 parent 43d6559 commit 6334587
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Unit/PopulateTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,36 @@ public function testPopulateWithArrayAccessWithoutIterator()
$this->assertEquals(array('property1' => 'test'), $subject->exportGettableProperties(array('property1'), true));
}

/*
* @return void
*/
public function testPopulateWithObjectThatImplementsPopulateInterface()
{
$source = new PopulateDummy();
$source->setProperty1('foo');
$source->setProperty2('bar');

$target = new PopulateDummy();
$target->populate($source);
$this->assertEquals($source, $target);
}

/*
* @return void
*/
public function testPopulateIgnoresMappedPropertyIfItDoesNotExistInSourceArray()
{
$source = array('property1' => 'foo');

$target = new PopulateDummy();
$target->populate($source, array('property1', 'nonExistingProperty'), true);

$expected = new PopulateDummy();
$expected->setProperty1('foo');

$this->assertEquals($expected, $target);
}

/**
* @dataProvider getTestValues
* @param mixed $sourceData
Expand Down

0 comments on commit 6334587

Please sign in to comment.