handle error from non-empty folders in nativeshare

This commit is contained in:
Robin Appelman 2014-08-26 19:26:14 +02:00
commit aaf2c049fd
2 changed files with 12 additions and 0 deletions

View file

@ -11,6 +11,7 @@ use Icewind\SMB\Exception\AlreadyExistsException;
use Icewind\SMB\Exception\Exception; use Icewind\SMB\Exception\Exception;
use Icewind\SMB\Exception\ForbiddenException; use Icewind\SMB\Exception\ForbiddenException;
use Icewind\SMB\Exception\InvalidTypeException; use Icewind\SMB\Exception\InvalidTypeException;
use Icewind\SMB\Exception\NotEmptyException;
use Icewind\SMB\Exception\NotFoundException; use Icewind\SMB\Exception\NotFoundException;
/** /**
@ -42,6 +43,8 @@ class NativeState {
throw new InvalidTypeException(); throw new InvalidTypeException();
case 21: case 21:
throw new InvalidTypeException(); throw new InvalidTypeException();
case 39:
throw new NotEmptyException();
default: default:
throw new Exception('Unknown error (' . $error . ')'); throw new Exception('Unknown error (' . $error . ')');
} }

View file

@ -281,6 +281,15 @@ abstract class AbstractShare extends \PHPUnit_Framework_TestCase {
$this->share->del($this->root . '/foobar'); $this->share->del($this->root . '/foobar');
} }
/**
* @expectedException \Icewind\SMB\Exception\NotEmptyException
*/
public function testRmdirNotEmpty() {
$this->share->mkdir($this->root . '/foobar');
$this->share->put($this->getTextFile(), $this->root . '/foobar/asd');
$this->share->rmdir($this->root . '/foobar');
}
/** /**
* @expectedException \Icewind\SMB\Exception\NotFoundException * @expectedException \Icewind\SMB\Exception\NotFoundException
*/ */