Skip to content
Permalink
Browse files

Added test for fieldList in Marshaller::many()

  • Loading branch information...
lorenzo committed Jul 11, 2014
1 parent 00b9d09 commit 818f92472c3059f353a3d439788d2037e1e65861
Showing with 19 additions and 0 deletions.
  1. +19 −0 tests/TestCase/ORM/MarshallerTest.php
@@ -1032,4 +1032,23 @@ public function testMergeWithFieldList() {
$this->assertFalse($entity->accessible('*'));
}
/**
* Test that many() also receives a fieldList option
*
* @return void
*/
public function testManyFieldList() {
$data = [
['comment' => 'First post', 'user_id' => 2, 'foo' => 'bar'],
['comment' => 'Second post', 'user_id' => 2, 'foo' => 'bar'],
];
$marshall = new Marshaller($this->comments);
$result = $marshall->many($data, ['fieldList' => ['comment', 'user_id']]);
$this->assertCount(2, $result);
unset($data[0]['foo'], $data[1]['foo']);
$this->assertEquals($data[0], $result[0]->toArray());
$this->assertEquals($data[1], $result[1]->toArray());
}
}

0 comments on commit 818f924

Please sign in to comment.
You can’t perform that action at this time.