make sure that hooks are registered for the tests

This commit is contained in:
Bjoern Schiessle 2014-06-25 15:20:52 +02:00
parent a0b85fc5e4
commit 38ff8173ab
3 changed files with 23 additions and 14 deletions

View File

@ -14,24 +14,14 @@ OC::$CLASSPATH['OCA\Files\Share\Proxy'] = 'files_sharing/lib/proxy.php';
\OCP\App::registerAdmin('files_sharing', 'settings-admin'); \OCP\App::registerAdmin('files_sharing', 'settings-admin');
OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup'); \OCA\Files_Sharing\Helper::registerHooks();
OCP\Util::connectHook('OC_Filesystem', 'setup', '\OCA\Files_Sharing\External\Manager', 'setup');
OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
OCP\Util::addScript('files_sharing', 'share'); OCP\Util::addScript('files_sharing', 'share');
OCP\Util::addScript('files_sharing', 'external'); OCP\Util::addScript('files_sharing', 'external');
\OC_Hook::connect('OC_Filesystem', 'post_write', '\OC\Files\Cache\Shared_Updater', 'writeHook');
\OC_Hook::connect('OC_Filesystem', 'post_delete', '\OC\Files\Cache\Shared_Updater', 'postDeleteHook');
\OC_Hook::connect('OC_Filesystem', 'delete', '\OC\Files\Cache\Shared_Updater', 'deleteHook');
\OC_Hook::connect('OC_Filesystem', 'post_rename', '\OC\Files\Cache\Shared_Updater', 'renameHook');
\OC_Hook::connect('OC_Appconfig', 'post_set_value', '\OCA\Files\Share\Maintainer', 'configChangeHook');
\OCP\Util::connectHook('OCP\Share', 'post_shared', '\OC\Files\Cache\Shared_Updater', 'postShareHook');
\OCP\Util::connectHook('OCP\Share', 'post_unshare', '\OC\Files\Cache\Shared_Updater', 'postUnshareHook');
\OCP\Util::connectHook('OCP\Share', 'post_unshareFromSelf', '\OC\Files\Cache\Shared_Updater', 'postUnshareFromSelfHook');
OC_FileProxy::register(new OCA\Files\Share\Proxy()); OC_FileProxy::register(new OCA\Files\Share\Proxy());
\OCA\Files\App::getNavigationManager()->add( \OCA\Files\App::getNavigationManager()->add(

View File

@ -7,6 +7,20 @@ use PasswordHash;
class Helper { class Helper {
public static function registerHooks() {
\OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup');
\OCP\Util::connectHook('OC_Filesystem', 'setup', '\OCA\Files_Sharing\External\Manager', 'setup');
\OCP\Util::connectHook('OC_Filesystem', 'post_write', '\OC\Files\Cache\Shared_Updater', 'writeHook');
\OCP\Util::connectHook('OC_Filesystem', 'post_delete', '\OC\Files\Cache\Shared_Updater', 'postDeleteHook');
\OCP\Util::connectHook('OC_Filesystem', 'delete', '\OC\Files\Cache\Shared_Updater', 'deleteHook');
\OCP\Util::connectHook('OC_Filesystem', 'post_rename', '\OC\Files\Cache\Shared_Updater', 'renameHook');
\OCP\Util::connectHook('OC_Appconfig', 'post_set_value', '\OCA\Files\Share\Maintainer', 'configChangeHook');
\OCP\Util::connectHook('OCP\Share', 'post_shared', '\OC\Files\Cache\Shared_Updater', 'postShareHook');
\OCP\Util::connectHook('OCP\Share', 'post_unshare', '\OC\Files\Cache\Shared_Updater', 'postUnshareHook');
\OCP\Util::connectHook('OCP\Share', 'post_unshareFromSelf', '\OC\Files\Cache\Shared_Updater', 'postUnshareFromSelfHook');
}
/** /**
* Sets up the filesystem and user for public sharing * Sets up the filesystem and user for public sharing
* @param string $token string share token * @param string $token string share token

View File

@ -28,14 +28,19 @@ require_once __DIR__ . '/base.php';
*/ */
class Test_Files_Sharing_Updater extends Test_Files_Sharing_Base { class Test_Files_Sharing_Updater extends Test_Files_Sharing_Base {
const TEST_FOLDER_NAME = '/folder_share_api_test'; const TEST_FOLDER_NAME = '/folder_share_updater_test';
public static function setUpBeforeClass() {
parent::setUpBeforeClass();
\OCA\Files_Sharing\Helper::registerHooks();
}
function setUp() { function setUp() {
parent::setUp(); parent::setUp();
$this->folder = self::TEST_FOLDER_NAME; $this->folder = self::TEST_FOLDER_NAME;
$this->filename = '/share-api-test.txt'; $this->filename = '/share-updater-test.txt';
// save file with content // save file with content
$this->view->file_put_contents($this->filename, $this->data); $this->view->file_put_contents($this->filename, $this->data);