/**
* @group BelongsToMany
* @group BelongsToManySetDataFromCollection
* @covers FOF30\Model\DataModel\Relation\BelongsToMany::setDataFromCollection
* @dataProvider BelongsToManyDataprovider::getTestSetDataFromCollection
*/
public function testSetDataFromCollection($test, $check)
{
$msg = 'BelongsToMany::setDataFromCollection %s - Case: ' . $check['case'];
$parts = new Parts(static::$container);
$model = new Groups(static::$container);
$model->find(2);
$relation = new BelongsToMany($model, 'Parts');
$items[0] = clone $parts;
$items[0]->find(1);
$items[1] = clone $parts;
$items[1]->find(2);
$items[2] = clone $parts;
$items[2]->find(3);
$data = new Collection($items);
$relation->setDataFromCollection($data, $test['keymap']);
$this->assertCount($check['count'], ReflectionHelper::getValue($relation, 'data'), sprintf($msg, ''));
}