Additional test cases

This commit is contained in:
Robin Appelman 2013-05-01 20:58:04 +02:00
commit 69e9082def
3 changed files with 120 additions and 5 deletions

View file

@ -29,6 +29,9 @@ class InvalidHostException extends \Exception {
class AccessDeniedException extends \Exception {
}
class InvalidTypeException extends \Exception {
}
class ErrorCodes {
/**
* connection errors
@ -44,4 +47,6 @@ class ErrorCodes {
const NameCollision = 'NT_STATUS_OBJECT_NAME_COLLISION';
const AccessDenied = 'NT_STATUS_ACCESS_DENIED';
const DirectoryNotEmpty = 'NT_STATUS_DIRECTORY_NOT_EMPTY';
const FileIsADirectory = 'NT_STATUS_FILE_IS_A_DIRECTORY';
const NotADirectory = 'NT_STATUS_NOT_A_DIRECTORY';
}

View file

@ -184,10 +184,11 @@ class Share {
/**
* @param $lines
*
* @throws \SMB\NotFoundException
* @throws \SMB\AlreadyExistsException
* @throws \SMB\AccessDeniedException
* @throws \SMB\NotEmptyException
* @throws NotFoundException
* @throws AlreadyExistsException
* @throws AccessDeniedException
* @throws NotEmptyException
* @throws InvalidTypeException
* @throws \Exception
* @return bool
*/
@ -210,6 +211,9 @@ class Share {
throw new AccessDeniedException();
case ErrorCodes::DirectoryNotEmpty:
throw new NotEmptyException();
case ErrorCodes::FileIsADirectory:
case ErrorCodes::NotADirectory:
throw new InvalidTypeException();
default:
throw new \Exception();
}