public function testCreateManual()
 {
     $folder = new Folder();
     $folder->setId('/functional/folder');
     $file = new File();
     $file->setId('/functional/folder/file');
     $file->setFileContent(self::FILE_CONTENT);
     $this->dm->persist($folder);
     $this->dm->persist($file);
     $this->dm->flush();
     $this->dm->clear();
     $this->assertFolderAndFile($this->node);
 }
Beispiel #2
0
 public function testCreateManual()
 {
     $folder = new Folder();
     $folder->setId('/functional/folder');
     $file = new File();
     $file->setId('/functional/folder/file');
     $file->setFileContent('Lorem ipsum dolor sit amet');
     $this->dm->persist($folder);
     $this->dm->persist($file);
     $this->dm->flush();
     $this->dm->clear();
     $this->assertTrue($this->node->hasNode('folder'));
     $this->assertTrue($this->node->getNode('folder')->hasNode('file'));
     $this->assertTrue($this->node->getNode('folder')->getNode('file')->hasNode('jcr:content'));
     $this->assertTrue($this->node->getNode('folder')->getNode('file')->getNode('jcr:content')->hasProperty('jcr:data'));
     $binaryStream = $this->node->getNode('folder')->getNode('file')->getNode('jcr:content')->getProperty('jcr:data')->getBinary();
     $this->assertNotNull($binaryStream, 'Ensure that we got a stream from the file');
     $content = stream_get_contents($binaryStream);
     $this->assertEquals('Lorem ipsum dolor sit amet', $content);
 }