/** * @dataProvider dataProviderCopyRename */ public function testCopyKeys($source, $target, $systemWideMountSource, $systemWideMountTarget , $expectedSource, $expectedTarget) { $this->view->expects($this->any()) ->method('file_exists') ->willReturn(true); $this->view->expects($this->any()) ->method('is_dir') ->willReturn(true); $this->view->expects($this->once()) ->method('copy') ->with( $this->equalTo($expectedSource), $this->equalTo($expectedTarget)) ->willReturn(true); $this->util->expects($this->any()) ->method('getUidAndFilename') ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback'))); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { if(strpos($path, 'source.txt') !== false) { return $systemWideMountSource; } return $systemWideMountTarget; }); $this->storage->copyKeys($source, $target); }
/** * @dataProvider dataProviderCopyRename */ public function testCopyKeys($source, $target, $systemWideMount, $expectedSource, $expectedTarget) { $this->view->expects($this->any())->method('file_exists')->willReturn(true); $this->view->expects($this->any())->method('is_dir')->willReturn(true); $this->view->expects($this->once())->method('copy')->with($this->equalTo($expectedSource), $this->equalTo($expectedTarget))->willReturn(true); $this->util->expects($this->any())->method('getUidAndFilename')->will($this->returnCallback(array($this, 'getUidAndFilenameCallback'))); $this->util->expects($this->any())->method('isSystemWideMountPoint')->willReturn($systemWideMount); $this->storage->copyKeys($source, $target); }