本文整理汇总了PHP中OC_Mount_Config::app方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Mount_Config::app方法的具体用法?PHP OC_Mount_Config::app怎么用?PHP OC_Mount_Config::app使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Mount_Config
的用法示例。
在下文中一共展示了OC_Mount_Config::app方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
self::$hookCalls = array();
$config = \OC::$server->getConfig();
$this->dataDir = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/');
\OC_Mount_Config::$skipTest = true;
// prepare BackendService mock
$this->backendService = $this->getMockBuilder('\\OCA\\Files_External\\Service\\BackendService')->disableOriginalConstructor()->getMock();
$authMechanisms = ['identifier:\\Auth\\Mechanism' => $this->getAuthMechMock('null', '\\Auth\\Mechanism'), 'identifier:\\Other\\Auth\\Mechanism' => $this->getAuthMechMock('null', '\\Other\\Auth\\Mechanism'), 'identifier:\\OCA\\Files_External\\Lib\\Auth\\NullMechanism' => $this->getAuthMechMock()];
$this->backendService->method('getAuthMechanism')->will($this->returnCallback(function ($class) use($authMechanisms) {
if (isset($authMechanisms[$class])) {
return $authMechanisms[$class];
}
return null;
}));
$this->backendService->method('getAuthMechanismsByScheme')->will($this->returnCallback(function ($schemes) use($authMechanisms) {
return array_filter($authMechanisms, function ($authMech) use($schemes) {
return in_array($authMech->getScheme(), $schemes, true);
});
}));
$this->backendService->method('getAuthMechanisms')->will($this->returnValue($authMechanisms));
$sftpBackend = $this->getBackendMock('\\OCA\\Files_External\\Lib\\Backend\\SFTP', '\\OC\\Files\\Storage\\SFTP');
$backends = ['identifier:\\OCA\\Files_External\\Lib\\Backend\\SMB' => $this->getBackendMock('\\OCA\\Files_External\\Lib\\Backend\\SMB', '\\OC\\Files\\Storage\\SMB'), 'identifier:\\OCA\\Files_External\\Lib\\Backend\\SFTP' => $sftpBackend, 'identifier:sftp_alias' => $sftpBackend];
$backends['identifier:\\OCA\\Files_External\\Lib\\Backend\\SFTP']->method('getLegacyAuthMechanism')->willReturn($authMechanisms['identifier:\\Other\\Auth\\Mechanism']);
$this->backendService->method('getBackend')->will($this->returnCallback(function ($backendClass) use($backends) {
if (isset($backends[$backendClass])) {
return $backends[$backendClass];
}
return null;
}));
$this->backendService->method('getBackends')->will($this->returnValue($backends));
\OCP\Util::connectHook(Filesystem::CLASSNAME, Filesystem::signal_create_mount, get_class($this), 'createHookCallback');
\OCP\Util::connectHook(Filesystem::CLASSNAME, Filesystem::signal_delete_mount, get_class($this), 'deleteHookCallback');
$containerMock = $this->getMock('\\OCP\\AppFramework\\IAppContainer');
$containerMock->method('query')->will($this->returnCallback(function ($name) {
if ($name === 'OCA\\Files_External\\Service\\BackendService') {
return $this->backendService;
}
}));
\OC_Mount_Config::$app = $this->getMockBuilder('\\OCA\\Files_External\\Appinfo\\Application')->disableOriginalConstructor()->getMock();
\OC_Mount_Config::$app->method('getContainer')->willReturn($containerMock);
}
示例2:
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
OC::$CLASSPATH['OC\\Files\\Storage\\StreamWrapper'] = 'files_external/lib/streamwrapper.php';
OC::$CLASSPATH['OC\\Files\\Storage\\FTP'] = 'files_external/lib/ftp.php';
OC::$CLASSPATH['OC\\Files\\Storage\\OwnCloud'] = 'files_external/lib/owncloud.php';
OC::$CLASSPATH['OC\\Files\\Storage\\Google'] = 'files_external/lib/google.php';
OC::$CLASSPATH['OC\\Files\\Storage\\Swift'] = 'files_external/lib/swift.php';
OC::$CLASSPATH['OC\\Files\\Storage\\SMB'] = 'files_external/lib/smb.php';
OC::$CLASSPATH['OC\\Files\\Storage\\AmazonS3'] = 'files_external/lib/amazons3.php';
OC::$CLASSPATH['OC\\Files\\Storage\\Dropbox'] = 'files_external/lib/dropbox.php';
OC::$CLASSPATH['OC\\Files\\Storage\\SFTP'] = 'files_external/lib/sftp.php';
OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php';
OC::$CLASSPATH['OCA\\Files\\External\\Api'] = 'files_external/lib/api.php';
require_once __DIR__ . '/../3rdparty/autoload.php';
// register Application object singleton
\OC_Mount_Config::$app = new \OCA\Files_external\Appinfo\Application();
$appContainer = \OC_Mount_Config::$app->getContainer();
\OC_Mount_Config::$app->registerSettings();
$l = \OC::$server->getL10N('files_external');
\OCA\Files\App::getNavigationManager()->add(["id" => 'extstoragemounts', "appname" => 'files_external', "script" => 'list.php', "order" => 30, "name" => $l->t('External storage')]);
$mountProvider = $appContainer->query('OCA\\Files_External\\Config\\ConfigAdapter');
\OC::$server->getMountProviderCollection()->registerProvider($mountProvider);