当前位置: 首页>>代码示例>>PHP>>正文


PHP TestCase::setUp方法代码示例

本文整理汇总了PHP中OCA\Files_Sharing\Tests\TestCase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP TestCase::setUp方法的具体用法?PHP TestCase::setUp怎么用?PHP TestCase::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCA\Files_Sharing\Tests\TestCase的用法示例。


在下文中一共展示了TestCase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     // prepare user1's dir structure
     $textData = "dummy file data\n";
     $this->view->mkdir('container');
     $this->view->mkdir('container/shareddir');
     $this->view->mkdir('container/shareddir/subdir');
     $this->view->mkdir('container/shareddirrestricted');
     $this->view->mkdir('container/shareddirrestricted/subdir');
     $this->view->file_put_contents('container/shareddir/textfile.txt', $textData);
     $this->view->file_put_contents('container/shareddirrestricted/textfile1.txt', $textData);
     list($this->ownerStorage, $internalPath) = $this->view->resolvePath('');
     $this->ownerCache = $this->ownerStorage->getCache();
     $this->ownerStorage->getScanner()->scan('');
     // share "shareddir" with user2
     $rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
     $node = $rootFolder->get('container/shareddir');
     $share = $this->shareManager->newShare();
     $share->setNode($node)->setShareType(\OCP\Share::SHARE_TYPE_USER)->setSharedWith(self::TEST_FILES_SHARING_API_USER2)->setSharedBy(self::TEST_FILES_SHARING_API_USER1)->setPermissions(\OCP\Constants::PERMISSION_ALL);
     $this->shareManager->createShare($share);
     $node = $rootFolder->get('container/shareddirrestricted');
     $share = $this->shareManager->newShare();
     $share->setNode($node)->setShareType(\OCP\Share::SHARE_TYPE_USER)->setSharedWith(self::TEST_FILES_SHARING_API_USER2)->setSharedBy(self::TEST_FILES_SHARING_API_USER1)->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
     $this->shareManager->createShare($share);
     // login as user2
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // retrieve the shared storage
     $this->secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
     list($this->sharedStorage, $internalPath) = $this->secondView->resolvePath('files/shareddir');
     list($this->sharedStorageRestrictedShare, $internalPath) = $this->secondView->resolvePath('files/shareddirrestricted');
     $this->sharedCache = $this->sharedStorage->getCache();
     $this->sharedCacheRestrictedShare = $this->sharedStorageRestrictedShare->getCache();
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:35,代码来源:PermissionsTest.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     $this->connection = \OC::$server->getDatabaseConnection();
     $this->migration = new Migration($this->connection);
     $this->cleanDB();
 }
开发者ID:ZverAleksey,项目名称:core,代码行数:7,代码来源:migrationtest.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->uid = $this->getUniqueID('user');
     $this->mountManager = new \OC\Files\Mount\Manager();
     $this->manager = new \OCA\Files_Sharing\External\Manager(\OC::$server->getDatabaseConnection(), $this->mountManager, new StorageFactory(), $this->getMockBuilder('\\OC\\HTTPHelper')->disableOriginalConstructor()->getMock(), $this->uid);
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:7,代码来源:managertest.php

示例4: setUp

 function setUp()
 {
     parent::setUp();
     \OC_User::setDisplayName(self::TEST_FILES_SHARING_API_USER1, 'User One');
     \OC_User::setDisplayName(self::TEST_FILES_SHARING_API_USER2, 'User Two');
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     $this->user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
     // prepare user1's dir structure
     $this->view->mkdir('container');
     $this->view->mkdir('container/shareddir');
     $this->view->mkdir('container/shareddir/subdir');
     $this->view->mkdir('container/shareddir/emptydir');
     $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
     $this->view->file_put_contents('container/not shared.txt', $textData);
     $this->view->file_put_contents('container/shared single file.txt', $textData);
     $this->view->file_put_contents('container/shareddir/bar.txt', $textData);
     $this->view->file_put_contents('container/shareddir/subdir/another.txt', $textData);
     $this->view->file_put_contents('container/shareddir/subdir/another too.txt', $textData);
     $this->view->file_put_contents('container/shareddir/subdir/not a text file.xml', '<xml></xml>');
     list($this->ownerStorage, $internalPath) = $this->view->resolvePath('');
     $this->ownerCache = $this->ownerStorage->getCache();
     $this->ownerStorage->getScanner()->scan('');
     // share "shareddir" with user2
     $fileinfo = $this->view->getFileInfo('container/shareddir');
     \OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
     $fileinfo = $this->view->getFileInfo('container/shared single file.txt');
     \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
     // login as user2
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // retrieve the shared storage
     $secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
     list($this->sharedStorage, $internalPath) = $secondView->resolvePath('files/shareddir');
     $this->sharedCache = $this->sharedStorage->getCache();
 }
开发者ID:Romua1d,项目名称:core,代码行数:34,代码来源:cache.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->uid = $this->getUniqueID('user');
     $this->mountManager = new \OC\Files\Mount\Manager();
     $this->httpHelper = $httpHelper = $this->getMockBuilder('\\OC\\HTTPHelper')->disableOriginalConstructor()->getMock();
     /** @var \OC\HTTPHelper $httpHelper */
     $this->manager = new Manager(\OC::$server->getDatabaseConnection(), $this->mountManager, new StorageFactory(), $httpHelper, \OC::$server->getNotificationManager(), $this->uid);
 }
开发者ID:hyb148,项目名称:core,代码行数:9,代码来源:managertest.php

示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->remoteUser = $this->getUniqueID('remoteuser');
     $this->storage = $this->getMockBuilder('\\OCA\\Files_Sharing\\External\\Storage')->disableOriginalConstructor()->getMock();
     $this->storage->expects($this->any())->method('getId')->will($this->returnValue('dummystorage::'));
     $this->cache = new \OCA\Files_Sharing\External\Cache($this->storage, 'http://example.com/owncloud', $this->remoteUser);
     $this->cache->put('test.txt', array('mimetype' => 'text/plain', 'size' => 5, 'mtime' => 123));
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:9,代码来源:cache.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->userManager = $this->getMockBuilder('OCP\\IUserManager')->disableOriginalConstructor()->getMock();
     $this->groupManager = $this->getMockBuilder('OCP\\IGroupManager')->disableOriginalConstructor()->getMock();
     $this->contactsManager = $this->getMockBuilder('OCP\\Contacts\\IManager')->disableOriginalConstructor()->getMock();
     $this->session = $this->getMockBuilder('OCP\\IUserSession')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMockBuilder('OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->sharees = new Sharees($this->groupManager, $this->userManager, $this->contactsManager, $this->getMockBuilder('OCP\\IConfig')->disableOriginalConstructor()->getMock(), $this->session, $this->getMockBuilder('OCP\\IURLGenerator')->disableOriginalConstructor()->getMock(), $this->request, $this->getMockBuilder('OCP\\ILogger')->disableOriginalConstructor()->getMock());
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:10,代码来源:shareestest.php

示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     \OCP\Share::registerBackend('test', 'Test_Share_Backend');
     $config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $certificateManager = $this->getMock('\\OCP\\ICertificateManager');
     $httpHelperMock = $this->getMockBuilder('\\OC\\HTTPHelper')->setConstructorArgs(array($config, $certificateManager))->getMock();
     $httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true));
     $this->registerHttpHelper($httpHelperMock);
     $this->s2s = new \OCA\Files_Sharing\API\Server2Server();
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:12,代码来源:server2server.php

示例9: setUp

 public function setUp()
 {
     parent::setUp();
     $this->httpClient = $this->getMock('OCP\\Http\\Client\\IClient');
     $this->jobList = $this->getMock('OCP\\BackgroundJob\\IJobList');
     $this->urlGenerator = $this->getMock('OCP\\IURLGenerator');
     $this->trustedServers = $this->getMockBuilder('OCA\\Federation\\TrustedServers')->disableOriginalConstructor()->getMock();
     $this->dbHandler = $this->getMockBuilder('OCA\\Federation\\DbHandler')->disableOriginalConstructor()->getMock();
     $this->logger = $this->getMock('OCP\\ILogger');
     $this->response = $this->getMock('OCP\\Http\\Client\\IResponse');
     $this->getSharedSecret = new GetSharedSecret($this->httpClient, $this->urlGenerator, $this->jobList, $this->trustedServers, $this->logger, $this->dbHandler);
 }
开发者ID:evanjt,项目名称:core,代码行数:12,代码来源:getsharedsecrettest.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     \OCP\Share::registerBackend('test', 'Test_Share_Backend');
     $config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $clientService = $this->getMock('\\OCP\\Http\\Client\\IClientService');
     $httpHelperMock = $this->getMockBuilder('\\OC\\HTTPHelper')->setConstructorArgs([$config, $clientService])->getMock();
     $httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true));
     $this->registerHttpHelper($httpHelperMock);
     $this->s2s = new \OCA\Files_Sharing\API\Server2Server();
     $this->connection = \OC::$server->getDatabaseConnection();
 }
开发者ID:hyb148,项目名称:core,代码行数:13,代码来源:server2server.php

示例11: setUp

 protected function setUp()
 {
     parent::setUp();
     \OCP\Util::connectHook('OC_Filesystem', 'post_delete', '\\OCA\\Files_Sharing\\Hooks', 'unshareChildren');
     $this->folder = self::TEST_FOLDER_NAME;
     $this->subfolder = '/subfolder_share_api_test';
     $this->subsubfolder = '/subsubfolder_share_api_test';
     $this->filename = '/share-api-test';
     // save file with content
     $this->view->mkdir($this->folder);
     $this->view->mkdir($this->folder . $this->subfolder);
     $this->view->mkdir($this->folder . $this->subfolder . $this->subsubfolder);
     $this->view->file_put_contents($this->folder . $this->filename, $this->data);
     $this->view->file_put_contents($this->folder . $this->subfolder . $this->filename, $this->data);
 }
开发者ID:evanjt,项目名称:core,代码行数:15,代码来源:unsharechildren.php

示例12: setUp

 function setUp()
 {
     parent::setUp();
     $this->folder = self::TEST_FOLDER_NAME;
     $this->subfolder = '/subfolder_share_api_test';
     $this->subsubfolder = '/subsubfolder_share_api_test';
     $this->filename = '/share-api-test.txt';
     // save file with content
     $this->view->file_put_contents($this->filename, $this->data);
     $this->view->mkdir($this->folder);
     $this->view->mkdir($this->folder . $this->subfolder);
     $this->view->mkdir($this->folder . $this->subfolder . $this->subsubfolder);
     $this->view->file_put_contents($this->folder . $this->filename, $this->data);
     $this->view->file_put_contents($this->folder . $this->subfolder . $this->filename, $this->data);
 }
开发者ID:Romua1d,项目名称:core,代码行数:15,代码来源:api.php

示例13: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->uid = $this->getUniqueID('user');
     $this->createUser($this->uid, '');
     $this->user = \OC::$server->getUserManager()->get($this->uid);
     $this->mountManager = new \OC\Files\Mount\Manager();
     $this->httpHelper = $httpHelper = $this->getMockBuilder('\\OC\\HTTPHelper')->disableOriginalConstructor()->getMock();
     $discoveryManager = new DiscoveryManager(\OC::$server->getMemCacheFactory(), \OC::$server->getHTTPClientService());
     /** @var \OC\HTTPHelper $httpHelper */
     $this->manager = new Manager(\OC::$server->getDatabaseConnection(), $this->mountManager, new StorageFactory(), $httpHelper, \OC::$server->getNotificationManager(), $discoveryManager, $this->uid);
     $this->mountProvider = new MountProvider(\OC::$server->getDatabaseConnection(), function () {
         return $this->manager;
     });
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:15,代码来源:ManagerTest.php

示例14: setUp

 public function setUp()
 {
     parent::setUp();
     $this->userBackend = new \Test\Util\User\Dummy();
     \OC::$server->getUserManager()->registerBackend($this->userBackend);
     $this->ownerUid = $this->getUniqueID('owner_');
     $this->recipientUid = $this->getUniqueID('recipient_');
     $this->userBackend->createUser($this->ownerUid, '');
     $this->userBackend->createUser($this->recipientUid, '');
     $this->loginAsUser($this->ownerUid);
     Filesystem::mkdir('/foo');
     Filesystem::file_put_contents('/foo/bar.txt', 'asd');
     $fileId = Filesystem::getFileInfo('/foo/bar.txt')->getId();
     \OCP\Share::shareItem('file', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->recipientUid, 31);
     $this->loginAsUser($this->recipientUid);
     $this->assertTrue(Filesystem::file_exists('bar.txt'));
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:17,代码来源:locking.php

示例15: setUp

 protected function setUp()
 {
     parent::setUp();
     \OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', 'no');
     \OC::$server->getAppConfig()->setValue('core', 'shareapi_expire_after_n_days', '7');
     $this->folder = self::TEST_FOLDER_NAME;
     $this->subfolder = '/subfolder_share_api_test';
     $this->subsubfolder = '/subsubfolder_share_api_test';
     $this->filename = '/share-api-test.txt';
     // save file with content
     $this->view->file_put_contents($this->filename, $this->data);
     $this->view->mkdir($this->folder);
     $this->view->mkdir($this->folder . $this->subfolder);
     $this->view->mkdir($this->folder . $this->subfolder . $this->subsubfolder);
     $this->view->file_put_contents($this->folder . $this->filename, $this->data);
     $this->view->file_put_contents($this->folder . $this->subfolder . $this->filename, $this->data);
 }
开发者ID:evanjt,项目名称:core,代码行数:17,代码来源:api.php


注:本文中的OCA\Files_Sharing\Tests\TestCase::setUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。