move notify constants to INotifyHandler

This commit is contained in:
Robin Appelman 2016-12-08 16:16:54 +01:00
commit e0ffe88756
3 changed files with 19 additions and 19 deletions

View file

@ -10,6 +10,16 @@ namespace Icewind\SMB;
interface INotifyHandler { interface INotifyHandler {
// https://msdn.microsoft.com/en-us/library/dn392331.aspx
const NOTIFY_ADDED = 1;
const NOTIFY_REMOVED = 2;
const NOTIFY_MODIFIED = 3;
const NOTIFY_RENAMED_OLD = 4;
const NOTIFY_RENAMED_NEW = 5;
const NOTIFY_ADDED_STREAM = 6;
const NOTIFY_REMOVED_STREAM = 7;
const NOTIFY_MODIFIED_STREAM = 8;
const NOTIFY_REMOVED_BY_DELETE = 9;
/** /**
* Get all changes detected since the start of the notify process or the last call to getChanges * Get all changes detected since the start of the notify process or the last call to getChanges

View file

@ -8,17 +8,6 @@
namespace Icewind\SMB; namespace Icewind\SMB;
interface IShare { interface IShare {
// https://msdn.microsoft.com/en-us/library/dn392331.aspx
const NOTIFY_ADDED = 1;
const NOTIFY_REMOVED = 2;
const NOTIFY_MODIFIED = 3;
const NOTIFY_RENAMED_OLD = 4;
const NOTIFY_RENAMED_NEW = 5;
const NOTIFY_ADDED_STREAM = 6;
const NOTIFY_REMOVED_STREAM = 7;
const NOTIFY_MODIFIED_STREAM = 8;
const NOTIFY_REMOVED_BY_DELETE = 9;
/** /**
* Get the name of the share * Get the name of the share
* *

View file

@ -9,6 +9,7 @@ namespace Icewind\SMB\Test;
use Icewind\SMB\Change; use Icewind\SMB\Change;
use Icewind\SMB\Exception\AlreadyExistsException; use Icewind\SMB\Exception\AlreadyExistsException;
use Icewind\SMB\INotifyHandler;
use Icewind\SMB\IShare; use Icewind\SMB\IShare;
class NotifyHandlerTest extends TestCase { class NotifyHandlerTest extends TestCase {
@ -37,11 +38,11 @@ class NotifyHandlerTest extends TestCase {
$changes = $process->getChanges(); $changes = $process->getChanges();
$process->stop(); $process->stop();
$expected = [ $expected = [
new Change(IShare::NOTIFY_ADDED, 'source.txt'), new Change(INotifyHandler::NOTIFY_ADDED, 'source.txt'),
new Change(IShare::NOTIFY_RENAMED_OLD, 'source.txt'), new Change(INotifyHandler::NOTIFY_RENAMED_OLD, 'source.txt'),
new Change(IShare::NOTIFY_RENAMED_NEW, 'target.txt'), new Change(INotifyHandler::NOTIFY_RENAMED_NEW, 'target.txt'),
new Change(IShare::NOTIFY_MODIFIED, 'target.txt'), new Change(INotifyHandler::NOTIFY_MODIFIED, 'target.txt'),
new Change(IShare::NOTIFY_REMOVED, 'target.txt'), new Change(INotifyHandler::NOTIFY_REMOVED, 'target.txt'),
]; ];
$this->assertEquals($expected, $changes); $this->assertEquals($expected, $changes);
@ -65,8 +66,8 @@ class NotifyHandlerTest extends TestCase {
$process->stop(); $process->stop();
$expected = [ $expected = [
new Change(IShare::NOTIFY_ADDED, 'sub/source.txt'), new Change(INotifyHandler::NOTIFY_ADDED, 'sub/source.txt'),
new Change(IShare::NOTIFY_REMOVED, 'sub/source.txt'), new Change(INotifyHandler::NOTIFY_REMOVED, 'sub/source.txt'),
]; ];
$share->rmdir('sub'); $share->rmdir('sub');
@ -89,7 +90,7 @@ class NotifyHandlerTest extends TestCase {
$results = $change; $results = $change;
return false; // stop listening return false; // stop listening
}); });
$this->assertEquals($results, new Change(IShare::NOTIFY_ADDED, 'source.txt')); $this->assertEquals($results, new Change(INotifyHandler::NOTIFY_ADDED, 'source.txt'));
} }
public function testStopped() { public function testStopped() {