__toString() public method

public __toString ( )
Beispiel #1
0
 public function testStringSerializationReturnsEmptyStringWhenStreamIsNotReadable()
 {
     $this->tmpnam = tempnam(sys_get_temp_dir(), 'phly');
     file_put_contents($this->tmpnam, 'FOO BAR');
     $stream = new Stream($this->tmpnam, 'w');
     $this->assertEquals('', $stream->__toString());
 }
Beispiel #2
0
 public function testMovesFileToDesignatedPath()
 {
     $stream = new Stream('php://temp', 'wb+');
     $stream->write('Foo bar!');
     $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);
     $this->tmpFile = $to = tempnam(sys_get_temp_dir(), 'phly');
     $upload->moveTo($to);
     $this->assertTrue(file_exists($to));
     $contents = file_get_contents($to);
     $this->assertEquals($stream->__toString(), $contents);
 }