Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function open($path, $flags, $mode = self::CREATION_MODE)
 {
     $flags = $this->openFlagResolver->resolve($flags);
     $mode = $this->permissionFlagResolver->resolve($mode);
     return $this->openFileLimiter->open()->then(function () use($path, $flags, $mode) {
         return $this->invoker->invokeCall('eio_open', [$path, $flags, $mode]);
     })->then(function ($fileDescriptor) use($path, $flags) {
         return Eio\StreamFactory::create($path, $fileDescriptor, $flags, $this);
     }, function ($error) {
         $this->openFileLimiter->close();
         return \React\Promise\reject($error);
     });
 }
Ejemplo n.º 2
0
 public function testCreateDuplex()
 {
     $filesystem = $this->getMock('React\\Filesystem\\Eio\\Adapter', [], [$this->getMock('React\\EventLoop\\StreamSelectLoop')]);
     $this->assertInstanceOf('React\\Filesystem\\Eio\\DuplexStream', StreamFactory::create('foo.bar', null, EIO_O_RDWR, $filesystem));
 }