Ejemplo n.º 1
0
	public function testGetName() {
		$manager = $this->getMock('\OC\Files\Mount\Manager');
		/**
		 * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
		 */
		$view = $this->getMock('\OC\Files\View');
		$root = $this->getMock('\OC\Files\Node\Root', array(), array($manager, $view, $this->user));
		$root->expects($this->any())
			->method('getUser')
			->will($this->returnValue($this->user));

		$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
		$this->assertEquals('foo', $node->getName());
	}
Ejemplo n.º 2
0
Archivo: file.php Proyecto: evanjt/core
 /**
  * @expectedException \OCP\Files\NotPermittedException
  */
 public function testMoveParentIsFile()
 {
     /**
      * @var \OC\Files\Mount\Manager $manager
      */
     $manager = $this->getMock('\\OC\\Files\\Mount\\Manager');
     /**
      * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
      */
     $view = $this->getMock('\\OC\\Files\\View');
     $root = $this->getMock('\\OC\\Files\\Node\\Root', array(), array($manager, $view, $this->user));
     $view->expects($this->never())->method('rename');
     $node = new \OC\Files\Node\File($root, $view, '/bar/foo');
     $parentNode = new \OC\Files\Node\File($root, $view, '/bar');
     $root->expects($this->once())->method('get')->with('/bar')->will($this->returnValue($parentNode));
     $node->move('/bar/asd');
 }