public function testAddCollectionClonesChildrenAttachedToAnotherRepository()
{
$otherRepo = $this->getMock('Puli\\Repository\\Api\\ResourceRepository');
$file1 = new TestFile('/file1');
$file2 = new TestFile('/file2');
$file2->attachTo($otherRepo);
$this->repo->add('/webmozart/puli', new ArrayResourceCollection(array($file1, $file2)));
$this->assertSame($file1, $this->repo->get('/webmozart/puli/file1'));
$this->assertNotSame($file2, $this->repo->get('/webmozart/puli/file2'));
$this->assertSame('/file2', $file2->getPath());
$clone = clone $file2;
$clone->attachTo($this->repo, '/webmozart/puli/file2');
$this->assertEquals($clone, $this->repo->get('/webmozart/puli/file2'));
}