public function testMountRepositoryFactory()
 {
     $repo = $this->getMock('Puli\\Repository\\Api\\ResourceRepository');
     $resource = new TestFile('/path/to/resource');
     $resource->attachTo($repo);
     $this->repo->mount('/webmozart', function () use($repo) {
         return $repo;
     });
     $repo->expects($this->once())->method('get')->with('/path/to/resource')->will($this->returnValue($resource));
     $expected = $resource->createReference('/webmozart/path/to/resource');
     $this->assertEquals($expected, $this->repo->get('/webmozart/path/to/resource'));
 }
 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'));
 }