Ejemplo n.º 1
0
 public function testBasicFolder()
 {
     $folder = $this->root->newFolder('/foo');
     $this->assertTrue($this->root->nodeExists('/foo'));
     $file = $folder->newFile('/bar');
     $this->assertTrue($this->root->nodeExists('/foo/bar'));
     $file->putContent('qwerty');
     $listing = $folder->getDirectoryListing();
     $this->assertEquals(1, count($listing));
     $this->assertEquals($file->getId(), $listing[0]->getId());
     $this->assertEquals($file->getStorage(), $listing[0]->getStorage());
     $rootListing = $this->root->getDirectoryListing();
     $this->assertEquals(2, count($rootListing));
     $folder->move('/asd');
     /**
      * @var \OC\Files\Node\File $file
      */
     $file = $folder->get('/bar');
     $this->assertInstanceOf('\\OC\\Files\\Node\\File', $file);
     $this->assertFalse($this->root->nodeExists('/foo/bar'));
     $this->assertTrue($this->root->nodeExists('/asd/bar'));
     $this->assertEquals('qwerty', $file->getContent());
     $folder->move('/substorage/foo');
     /**
      * @var \OC\Files\Node\File $file
      */
     $file = $folder->get('/bar');
     $this->assertInstanceOf('\\OC\\Files\\Node\\File', $file);
     $this->assertTrue($this->root->nodeExists('/substorage/foo/bar'));
     $this->assertEquals('qwerty', $file->getContent());
 }