Server IP : 127.0.0.2 / Your IP : 18.118.193.52 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/vendor/guzzlehttp/streams/tests/ |
Upload File : |
<?php namespace GuzzleHttp\Tests\Stream; use GuzzleHttp\Stream\GuzzleStreamWrapper; use GuzzleHttp\Stream\Stream; /** * @covers GuzzleHttp\Stream\GuzzleStreamWrapper */ class GuzzleStreamWrapperTest extends \PHPUnit_Framework_TestCase { public function testResource() { $stream = Stream::factory('foo'); $handle = GuzzleStreamWrapper::getResource($stream); $this->assertSame('foo', fread($handle, 3)); $this->assertSame(3, ftell($handle)); $this->assertSame(3, fwrite($handle, 'bar')); $this->assertSame(0, fseek($handle, 0)); $this->assertSame('foobar', fread($handle, 6)); $this->assertTrue(feof($handle)); // This fails on HHVM for some reason if (!defined('HHVM_VERSION')) { $this->assertEquals([ 'dev' => 0, 'ino' => 0, 'mode' => 33206, 'nlink' => 0, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 6, 'atime' => 0, 'mtime' => 0, 'ctime' => 0, 'blksize' => 0, 'blocks' => 0, 0 => 0, 1 => 0, 2 => 33206, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 6, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 12 => 0, ], fstat($handle)); } $this->assertTrue(fclose($handle)); $this->assertSame('foobar', (string) $stream); } /** * @expectedException \InvalidArgumentException */ public function testValidatesStream() { $stream = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface') ->setMethods(['isReadable', 'isWritable']) ->getMockForAbstractClass(); $stream->expects($this->once()) ->method('isReadable') ->will($this->returnValue(false)); $stream->expects($this->once()) ->method('isWritable') ->will($this->returnValue(false)); GuzzleStreamWrapper::getResource($stream); } /** * @expectedException \PHPUnit_Framework_Error_Warning */ public function testReturnsFalseWhenStreamDoesNotExist() { fopen('guzzle://foo', 'r'); } public function testCanOpenReadonlyStream() { $stream = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface') ->setMethods(['isReadable', 'isWritable']) ->getMockForAbstractClass(); $stream->expects($this->once()) ->method('isReadable') ->will($this->returnValue(false)); $stream->expects($this->once()) ->method('isWritable') ->will($this->returnValue(true)); $r = GuzzleStreamWrapper::getResource($stream); $this->assertInternalType('resource', $r); fclose($r); } }