예제 #1
0
 /**
  * @test
  */
 public function writeRaisesExceptionWhenStreamIsDetached()
 {
     $fileName = PATH_site . 'typo3temp/' . $this->getUniqueId('test_');
     $this->testFilesToDelete[] = $fileName;
     file_put_contents($fileName, 'FOO BAR');
     $resource = fopen($fileName, 'wb+');
     $stream = new Stream($resource);
     $stream->detach();
     $this->setExpectedException('RuntimeException', 'No resource');
     $stream->write('bar');
 }
예제 #2
0
 /**
  * @test
  */
 public function getGetStreamRaisesExceptionAfterMove()
 {
     $stream = new Stream('php://temp', 'wb+');
     $stream->write('Foo bar!');
     $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);
     $this->tmpFile = $to = GeneralUtility::tempnam('psr7');
     $upload->moveTo($to);
     $this->assertTrue(file_exists($to));
     $this->setExpectedException('RuntimeException', 'moved');
     $upload->getStream();
 }