Пример #1
0
 public function testGetHomeNotSupported()
 {
     /**
      * @var \OC_User_Backend | \PHPUnit_Framework_MockObject_MockObject $backend
      */
     $backend = $this->getMock('\\Test\\Util\\User\\Dummy');
     $backend->expects($this->never())->method('getHome');
     $backend->expects($this->any())->method('implementsActions')->will($this->returnValue(false));
     $allConfig = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $allConfig->expects($this->any())->method('getUserValue')->will($this->returnValue(true));
     $allConfig->expects($this->any())->method('getSystemValue')->with($this->equalTo('datadirectory'))->will($this->returnValue('arbitrary/path'));
     $user = new \OC\User\User('foo', $backend, null, $allConfig);
     $this->assertEquals('arbitrary/path/foo', $user->getHome());
 }
Пример #2
0
 public function testGetHomeNotSupported()
 {
     /**
      * @var \OC_User_Backend | \PHPUnit_Framework_MockObject_MockObject $backend
      */
     $backend = $this->getMock('\\OC_User_Dummy');
     $backend->expects($this->never())->method('getHome');
     $backend->expects($this->any())->method('implementsActions')->will($this->returnValue(false));
     $allConfig = new AllConfig();
     $user = new \OC\User\User('foo', $backend, null, $allConfig);
     $this->assertEquals(\OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data") . '/foo', $user->getHome());
 }