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


PHP IAppManager::expects方法代码示例

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


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

示例1: testChangeExperimentalConfigStateFalse

	public function testChangeExperimentalConfigStateFalse() {
		$this->config
			->expects($this->once())
			->method('setSystemValue')
			->with('appstore.experimental.enabled', false);
		$this->appManager
			->expects($this->once())
			->method('clearAppsCache');
		$this->assertEquals(new DataResponse(), $this->appSettingsController->changeExperimentalConfigState(false));
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:10,代码来源:AppSettingsControllerTest.php

示例2: testCheckAppUpdates

 /**
  * @dataProvider dataCheckAppUpdates
  *
  * @param string[] $apps
  * @param array $isUpdateAvailable
  * @param array $notifications
  */
 public function testCheckAppUpdates(array $apps, array $isUpdateAvailable, array $notifications)
 {
     $job = $this->getJob(['isUpdateAvailable', 'createNotifications']);
     $this->appManager->expects($this->once())->method('getInstalledApps')->willReturn($apps);
     $job->expects($this->exactly(sizeof($apps)))->method('isUpdateAvailable')->willReturnMap($isUpdateAvailable);
     $this->urlGenerator->expects($this->exactly(sizeof($notifications)))->method('linkToRouteAbsolute')->with('settings.AppSettings.viewApps')->willReturn('apps-url');
     $mockedMethod = $job->expects($this->exactly(sizeof($notifications)))->method('createNotifications');
     call_user_func_array([$mockedMethod, 'withConsecutive'], $notifications);
     $this->invokePrivate($job, 'checkAppUpdates');
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:17,代码来源:BackgroundJobTest.php

示例3: testBuildProviderListWithEverythingEnabled

	public function testBuildProviderListWithEverythingEnabled() {
		$this->appManager
			->expects($this->any())
			->method('isEnabledForUser')
			->will($this->returnValue(true));

		$expected = new \OCP\AppFramework\Http\JSONResponse(
			[
				'version' => 2,
				'PRIVATE_DATA' => [
					'version' => 1,
					'endpoints' => [
						'store' => '/ocs/v1.php/privatedata/setattribute',
						'read' => '/ocs/v1.php/privatedata/getattribute',
						'delete' => '/ocs/v1.php/privatedata/deleteattribute',
					],
				],
				'FEDERATED_SHARING' => [
					'version' => 1,
					'endpoints' => [
						'share' => '/ocs/v1.php/cloud/shares',
						'webdav' => '/public.php/webdav/',
					],
				],
				'SHARING' => [
					'version' => 1,
					'endpoints' => [
						'share' => '/ocs/v1.php/apps/files_sharing/api/v1/shares',
					],
				],
				'ACTIVITY' => [
					'version' => 1,
					'endpoints' => [
						'list' => '/ocs/v1.php/cloud/activity',
					],
				],
				'PROVISIONING' => [
					'version' => 1,
					'endpoints' => [
						'user' => '/ocs/v1.php/cloud/users',
						'groups' => '/ocs/v1.php/cloud/groups',
						'apps' => '/ocs/v1.php/cloud/apps',
					],
				],
			]
		);

		$this->assertEquals($expected, $this->ocsProvider->buildProviderList());
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:49,代码来源:provider.php

示例4: testGetIncompatibleApps

 public function testGetIncompatibleApps()
 {
     $this->manager = $this->getMockBuilder('\\OC\\App\\AppManager')->setConstructorArgs([$this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher])->setMethods(['getAppInfo'])->getMock();
     $appInfos = ['dav' => ['id' => 'dav'], 'files' => ['id' => 'files'], 'federatedfilesharing' => ['id' => 'federatedfilesharing'], 'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '8.0.0'], 'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'], 'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'], 'testnoversion' => ['id' => 'testnoversion', 'requiremin' => '8.2.0']];
     $this->manager->expects($this->any())->method('getAppInfo')->will($this->returnCallback(function ($appId) use($appInfos) {
         return $appInfos[$appId];
     }));
     $this->appConfig->setValue('test1', 'enabled', 'yes');
     $this->appConfig->setValue('test2', 'enabled', 'yes');
     $this->appConfig->setValue('test3', 'enabled', 'yes');
     $apps = $this->manager->getIncompatibleApps('8.2.0');
     $this->assertCount(2, $apps);
     $this->assertEquals('test1', $apps[0]['id']);
     $this->assertEquals('test3', $apps[1]['id']);
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:15,代码来源:manager.php

示例5: testRunInstanceVerification

 public function testRunInstanceVerification()
 {
     $this->checker = $this->getMockBuilder('\\OC\\IntegrityCheck\\Checker')->setConstructorArgs([$this->environmentHelper, $this->fileAccessHelper, $this->appLocator, $this->config, $this->cacheFactory, $this->appManager])->setMethods(['verifyCoreSignature', 'verifyAppSignature'])->getMock();
     $this->checker->expects($this->at(0))->method('verifyCoreSignature');
     $this->appLocator->expects($this->at(0))->Method('getAllApps')->will($this->returnValue(['files', 'calendar', 'contacts', 'dav']));
     $this->appManager->expects($this->at(0))->method('isShipped')->with('files')->will($this->returnValue(true));
     $this->checker->expects($this->at(1))->method('verifyAppSignature')->with('files');
     $this->appManager->expects($this->at(1))->method('isShipped')->with('calendar')->will($this->returnValue(false));
     $this->appLocator->expects($this->at(1))->method('getAppPath')->with('calendar')->will($this->returnValue('/apps/calendar'));
     $this->fileAccessHelper->expects($this->at(0))->method('file_exists')->with('/apps/calendar/appinfo/signature.json')->will($this->returnValue(true));
     $this->checker->expects($this->at(2))->method('verifyAppSignature')->with('calendar');
     $this->appManager->expects($this->at(2))->method('isShipped')->with('contacts')->will($this->returnValue(false));
     $this->appLocator->expects($this->at(2))->method('getAppPath')->with('contacts')->will($this->returnValue('/apps/contacts'));
     $this->fileAccessHelper->expects($this->at(1))->method('file_exists')->with('/apps/contacts/appinfo/signature.json')->will($this->returnValue(false));
     $this->appManager->expects($this->at(3))->method('isShipped')->with('dav')->will($this->returnValue(true));
     $this->checker->expects($this->at(3))->method('verifyAppSignature')->with('dav');
     $this->checker->runInstanceVerification();
 }
开发者ID:evanjt,项目名称:core,代码行数:18,代码来源:checkertest.php

示例6: testShowFileRouteWithTrashedFile

 /**
  * @dataProvider showFileMethodProvider
  */
 public function testShowFileRouteWithTrashedFile($useShowFile)
 {
     $this->appManager->expects($this->once())->method('isEnabledForUser')->with('files_trashbin')->will($this->returnValue(true));
     $parentNode = $this->getMock('\\OCP\\Files\\Folder');
     $parentNode->expects($this->once())->method('getPath')->will($this->returnValue('testuser1/files_trashbin/files/test.d1462861890/sub'));
     $baseFolderFiles = $this->getMock('\\OCP\\Files\\Folder');
     $baseFolderTrash = $this->getMock('\\OCP\\Files\\Folder');
     $this->rootFolder->expects($this->at(0))->method('get')->with('testuser1/files/')->will($this->returnValue($baseFolderFiles));
     $this->rootFolder->expects($this->at(1))->method('get')->with('testuser1/files_trashbin/files/')->will($this->returnValue($baseFolderTrash));
     $baseFolderFiles->expects($this->once())->method('getById')->with(123)->will($this->returnValue([]));
     $node = $this->getMock('\\OCP\\Files\\File');
     $node->expects($this->once())->method('getParent')->will($this->returnValue($parentNode));
     $node->expects($this->once())->method('getName')->will($this->returnValue('somefile.txt'));
     $baseFolderTrash->expects($this->at(0))->method('getById')->with(123)->will($this->returnValue([$node]));
     $baseFolderTrash->expects($this->at(1))->method('getRelativePath')->with('testuser1/files_trashbin/files/test.d1462861890/sub')->will($this->returnValue('/test.d1462861890/sub'));
     $this->urlGenerator->expects($this->once())->method('linkToRoute')->with('files.view.index', ['view' => 'trashbin', 'dir' => '/test.d1462861890/sub', 'scrollto' => 'somefile.txt'])->will($this->returnValue('/apps/files/?view=trashbin&dir=/test.d1462861890/sub&scrollto=somefile.txt'));
     $expected = new Http\RedirectResponse('/apps/files/?view=trashbin&dir=/test.d1462861890/sub&scrollto=somefile.txt');
     if ($useShowFile) {
         $this->assertEquals($expected, $this->viewController->showFile(123));
     } else {
         $this->assertEquals($expected, $this->viewController->index('/whatever', '', '123'));
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:26,代码来源:ViewControllerTest.php

示例7: testBeforeControllerWithSharingDisabled

 /**
  * @expectedException \OCP\Files\NotFoundException
  * @expectedExceptionMessage Sharing is disabled.
  */
 public function testBeforeControllerWithSharingDisabled()
 {
     $this->appManager->expects($this->once())->method('isEnabledForUser')->with('files_sharing')->will($this->returnValue(false));
     $this->sharingCheckMiddleware->beforeController($this->controllerMock, 'myMethod');
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:9,代码来源:SharingCheckMiddlewareTest.php

示例8: testIsSharingEnabledWithSharingDisabled

 public function testIsSharingEnabledWithSharingDisabled()
 {
     $this->appManager->expects($this->once())->method('isEnabledForUser')->with('files_sharing')->will($this->returnValue(true));
     $this->config->expects($this->once())->method('getAppValue')->with('core', 'shareapi_allow_links', 'yes')->will($this->returnValue('no'));
     $this->assertFalse(\Test_Helper::invokePrivate($this->sharingCheckMiddleware, 'isSharingEnabled'));
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:6,代码来源:sharingcheckmiddleware.php

示例9: mockBadAppEnabled

 private function mockBadAppEnabled($app)
 {
     $this->appManager->expects($this->once())->method('isInstalled')->with($app)->willReturn(true);
 }
开发者ID:patman15,项目名称:galleryplus,代码行数:4,代码来源:PageControllerTest.php


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