Example #1
0
 public function testContentAsStream()
 {
     $file = new File();
     $file->setContentFromString('Test file content.');
     $stream = $file->getContentAsStream();
     $this->assertTrue(is_resource($stream));
     $this->assertEquals(0, ftell($stream), 'filepointer at the beginning of \\Doctrine\\ODM\\PHPCR\\Document\\Resource::data');
     $stat = fstat($stream);
     $this->assertEquals(18, $stat['size']);
     $this->assertEquals('application/octet-stream', $file->getContentType());
     // cannot determine mime-type for php://memory stream
     $this->assertEquals(18, $file->getSize());
     $this->assertInstanceOf('DateTime', $file->getUpdatedAt());
 }