Esempio n. 1
0
 public function testCreateWithMode()
 {
     $driverPool = $this->getMock('Magento\\Framework\\Filesystem\\DriverPool', ['getDriver']);
     $driverPool->expects($this->never())->method('getDriver');
     $driver = $this->getMockForAbstractClass('Magento\\Framework\\Filesystem\\DriverInterface');
     $driver->expects($this->any())->method('isExists')->willReturn(true);
     $factory = new WriteFactory($driverPool);
     $result = $factory->create('path', $driver, 'a+');
     $this->assertInstanceOf('Magento\\Framework\\Filesystem\\File\\Write', $result);
 }
Esempio n. 2
0
 /**
  * @dataProvider createProvider
  * @param string|null $protocol
  */
 public function testCreate($protocol)
 {
     $path = 'path';
     $directoryDriver = $this->getMockForAbstractClass('Magento\\Framework\\Filesystem\\DriverInterface');
     $mode = 'a+';
     if ($protocol) {
         $this->driverFactory->expects($this->once())->method('get')->with($protocol, get_class($directoryDriver))->will($this->returnValue($directoryDriver));
     } else {
         $this->driverFactory->expects($this->never())->method('get');
     }
     $this->assertInstanceOf('Magento\\Framework\\Filesystem\\File\\Write', $this->factory->create($path, $protocol, $directoryDriver, $mode));
 }