コード例 #1
0
 public function testCreateCascade()
 {
     $folder = new Folder();
     $folder->setId('/functional/folder');
     $file = new File();
     $file->setFileContent(self::FILE_CONTENT);
     $file->setNodename('file');
     $folder->addChild($file);
     $this->dm->persist($folder);
     $this->dm->flush();
     $this->dm->clear();
     $this->assertFolderAndFile($this->node);
 }
コード例 #2
0
ファイル: FolderTest.php プロジェクト: nicam/phpcr-odm
 public function testCreateCascade()
 {
     $folder = new Folder();
     $folder->setId('/functional/folder');
     $file = new File();
     $file->setFileContent('Lorem ipsum dolor sit amet');
     $file->setNodename('file');
     $folder->addChild($file);
     $this->dm->persist($folder);
     $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();
     $content = stream_get_contents($binaryStream);
     $this->assertEquals('Lorem ipsum dolor sit amet', $content);
 }