Ejemplo n.º 1
0
	/**
	 * @dataProvider dataProviderCopyRename
	 */
	public function testRenameKeys($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('rename')
			->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->renameKeys($source, $target);
	}
Ejemplo n.º 2
0
 /**
  * @dataProvider dataProviderCopyRename
  */
 public function testRenameKeys($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('rename')->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->renameKeys($source, $target);
 }