merge() public method

Merge the collection with the given items.
public merge ( Collection | array $collection ) : Collection
$collection FOF30\Utils\Collection | array
return FOF30\Utils\Collection
Beispiel #1
0
 /**
  * @group           DataModel
  * @group           CollectionMerge
  * @covers          FOF30\Model\DataModel\Collection::merge
  */
 public function testMerge()
 {
     $config = array('idFieldName' => 'foftest_bare_id', 'tableName' => '#__foftest_bares');
     $model = $this->getMock('\\FOF30\\Tests\\Stubs\\Model\\DataModelStub', array('getState'), array(static::$container, $config));
     $collection1 = new Collection($model->getItemsArray(0, 2));
     $collection2 = new Collection($model->getItemsArray(2, 1));
     $merge = $collection1->merge($collection2);
     $this->assertInstanceOf('\\FOF30\\Model\\DataModel\\Collection', $merge, 'Collection::merge Should return an instance of Collection');
     $this->assertCount(3, $merge, 'Collection::merge Failed to merge two arrays');
 }