/**
* @test
*/
public function shouldReturnObjectsUniqueByNestedField()
{
//given
$category = new Category(array('name' => 'cat1'));
$product1 = new Product(array('name' => 'bob'));
$product1->category = $category;
$product2 = new Product(array('name' => 'john'));
$product2->category = $category;
$array = array($product1, $product2);
//when
$uniqueByName = Arrays::uniqueBy($array, 'category->name');
//then
Assert::thatArray($uniqueByName)->hasSize(1);
}