コード例 #1
0
ファイル: storage.php プロジェクト: ninjasilicon/core
	/**
	 * @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);
	}
コード例 #2
0
ファイル: storage.php プロジェクト: adolfo2103/hcloudfilem
 /**
  * @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);
 }