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


PHP IL10N::expects方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     $this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($text, $parameters = array()) {
         return vsprintf($text, $parameters);
     }));
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:8,代码来源:CalendarTest.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->urlGenerator = $this->getMockBuilder('OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     $this->infoCache = $this->getMockBuilder('OCA\\Activity\\ViewInfoCache')->disableOriginalConstructor()->getMock();
     $this->l = $this->getMockBuilder('OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l->expects($this->any())->method('t')->willReturnCallback(function ($string, $parameters) {
         return vsprintf($string, $parameters);
     });
 }
开发者ID:arietimmerman,项目名称:activity,代码行数:10,代码来源:fileformattertest.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->sessionMock = $this->getMockBuilder('OCA\\Encryption\\Session')->disableOriginalConstructor()->getMock();
     $this->requestMock = $this->getMock('OCP\\IRequest');
     $this->l10nMock = $this->getMockBuilder('OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10nMock->expects($this->any())->method('t')->will($this->returnCallback(function ($message) {
         return $message;
     }));
     $this->controller = new StatusController('encryptionTest', $this->requestMock, $this->l10nMock, $this->sessionMock);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:11,代码来源:StatusControllerTest.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->manager = $this->getMockBuilder('OCA\\AnnouncementCenter\\Manager')->disableOriginalConstructor()->getMock();
     $this->l = $this->getMockBuilder('OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l->expects($this->any())->method('t')->willReturnCallback(function ($string, $args) {
         return vsprintf($string, $args);
     });
     $this->factory = $this->getMockBuilder('OCP\\L10N\\IFactory')->disableOriginalConstructor()->getMock();
     $this->factory->expects($this->any())->method('get')->willReturn($this->l);
     $this->notifier = new NotificationsNotifier($this->manager, $this->factory);
 }
开发者ID:arietimmerman,项目名称:announcementcenter,代码行数:12,代码来源:NotificationsNotifierTest.php

示例5: setUp

 public function setUp()
 {
     $this->request = $this->getMockBuilder('\\OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($message, array $replace) {
         return vsprintf($message, $replace);
     }));
     $this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $this->connection = $this->getMockBuilder('\\OC\\DB\\Connection')->disableOriginalConstructor()->getMock();
     $this->userManager = $this->getMockBuilder('\\OCP\\IUserManager')->disableOriginalConstructor()->getMock();
     $this->view = $this->getMockBuilder('\\OC\\Files\\View')->disableOriginalConstructor()->getMock();
     $this->logger = $this->getMockBuilder('\\OCP\\ILogger')->disableOriginalConstructor()->getMock();
     $this->encryptionController = $this->getMockBuilder('\\OC\\Settings\\Controller\\EncryptionController')->setConstructorArgs(['settings', $this->request, $this->l10n, $this->config, $this->connection, $this->userManager, $this->view, $this->logger])->setMethods(['getMigration'])->getMock();
 }
开发者ID:evanjt,项目名称:core,代码行数:14,代码来源:EncryptionControllerTest.php

示例6: setUp

 public function setUp()
 {
     parent::setUp();
     $this->storageMock = $this->getMockBuilder('OCP\\Files\\Storage')->disableOriginalConstructor()->getMock();
     $this->cryptMock = $this->getMockBuilder('OCA\\Encryption\\Crypto\\Crypt')->disableOriginalConstructor()->getMock();
     $this->utilMock = $this->getMockBuilder('OCA\\Encryption\\Util')->disableOriginalConstructor()->getMock();
     $this->keyManagerMock = $this->getMockBuilder('OCA\\Encryption\\KeyManager')->disableOriginalConstructor()->getMock();
     $this->sessionMock = $this->getMockBuilder('OCA\\Encryption\\Session')->disableOriginalConstructor()->getMock();
     $this->encryptAllMock = $this->getMockBuilder('OCA\\Encryption\\Crypto\\EncryptAll')->disableOriginalConstructor()->getMock();
     $this->decryptAllMock = $this->getMockBuilder('OCA\\Encryption\\Crypto\\DecryptAll')->disableOriginalConstructor()->getMock();
     $this->loggerMock = $this->getMockBuilder('OCP\\ILogger')->disableOriginalConstructor()->getMock();
     $this->l10nMock = $this->getMockBuilder('OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10nMock->expects($this->any())->method('t')->with($this->anything())->willReturnArgument(0);
     $this->instance = new Encryption($this->cryptMock, $this->keyManagerMock, $this->utilMock, $this->sessionMock, $this->encryptAllMock, $this->decryptAllMock, $this->loggerMock, $this->l10nMock);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:15,代码来源:EncryptionTest.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->request = $this->getMockBuilder('OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->groupManager = $this->getMockBuilder('OCP\\IGroupManager')->disableOriginalConstructor()->getMock();
     $this->userManager = $this->getMockBuilder('OCP\\IUserManager')->disableOriginalConstructor()->getMock();
     $this->activityManager = $this->getMockBuilder('OCP\\Activity\\IManager')->disableOriginalConstructor()->getMock();
     $this->notificationManager = $this->getMockBuilder('OC\\Notification\\IManager')->disableOriginalConstructor()->getMock();
     $this->l = $this->getMockBuilder('OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l->expects($this->any())->method('t')->willReturnCallback(function ($string, $args) {
         return vsprintf($string, $args);
     });
     $this->urlGenerator = $this->getMockBuilder('OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     $this->manager = $this->getMockBuilder('OCA\\AnnouncementCenter\\Manager')->disableOriginalConstructor()->getMock();
 }
开发者ID:arietimmerman,项目名称:announcementcenter,代码行数:15,代码来源:PageControllerTest.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     $this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->mailer = $this->getMockBuilder('\\OCP\\Mail\\IMailer')->disableOriginalConstructor()->getMock();
     $this->logger = $this->getMockBuilder('\\OCP\\ILogger')->disableOriginalConstructor()->getMock();
     $this->defaults = $this->getMockBuilder('\\OCP\\Defaults')->disableOriginalConstructor()->getMock();
     $this->user = $this->getMockBuilder('\\OCP\\IUser')->disableOriginalConstructor()->getMock();
     $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($text, $parameters = array()) {
         return vsprintf($text, $parameters);
     }));
     $this->defaults->expects($this->once())->method('getName')->will($this->returnValue('UnitTestCloud'));
     $this->user->expects($this->once())->method('getEMailAddress')->willReturn('sharer@owncloud.com');
     $this->user->expects($this->once())->method('getDisplayName')->willReturn('TestUser');
 }
开发者ID:kenwi,项目名称:core,代码行数:15,代码来源:MailNotificationsTest.php

示例9: setUp

 public function setUp()
 {
     parent::setUp();
     $this->request = $this->getMockBuilder('\\OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10n->expects($this->any())->method('t')->will($this->returnArgument(0));
     $this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $cacheFactory = $this->getMockBuilder('\\OCP\\ICacheFactory')->disableOriginalConstructor()->getMock();
     $this->cache = $this->getMockBuilder('\\OCP\\ICache')->disableOriginalConstructor()->getMock();
     $cacheFactory->expects($this->once())->method('create')->with('settings')->will($this->returnValue($this->cache));
     $this->navigationManager = $this->getMockBuilder('\\OCP\\INavigationManager')->disableOriginalConstructor()->getMock();
     $this->appManager = $this->getMockBuilder('\\OCP\\App\\IAppManager')->disableOriginalConstructor()->getMock();
     $this->ocsClient = $this->getMockBuilder('\\OC\\OCSClient')->disableOriginalConstructor()->getMock();
     $this->appSettingsController = new AppSettingsController('settings', $this->request, $this->l10n, $this->config, $cacheFactory, $this->navigationManager, $this->appManager, $this->ocsClient);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:15,代码来源:AppSettingsControllerTest.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     $this->request = $this->getMockBuilder('\\OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $this->clientService = $this->getMockBuilder('\\OCP\\Http\\Client\\IClientService')->disableOriginalConstructor()->getMock();
     $this->util = $this->getMockBuilder('\\OC_Util')->disableOriginalConstructor()->getMock();
     $this->urlGenerator = $this->getMockBuilder('\\OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     $this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($message, array $replace) {
         return vsprintf($message, $replace);
     }));
     $this->checkSetupController = $this->getMockBuilder('\\OC\\Settings\\Controller\\CheckSetupController')->setConstructorArgs(['settings', $this->request, $this->config, $this->clientService, $this->urlGenerator, $this->util, $this->l10n])->setMethods(['getCurlVersion'])->getMock();
 }
开发者ID:GrumpyCrouton,项目名称:core,代码行数:15,代码来源:CheckSetupControllerTest.php

示例11: testJoinParameterList

 /**
  * @dataProvider dataJoinParameterList
  *
  * @param int $numParameters
  * @param bool $allowHtml
  * @param string $expected
  */
 public function testJoinParameterList($numParameters, $allowHtml, $expected)
 {
     $parameterList = $plainParameterList = [];
     for ($i = 1; $i <= $numParameters; $i++) {
         if ($allowHtml) {
             $parameterList[] = '<strong>item' . $i . '</strong>';
         } else {
             $parameterList[] = 'item' . $i;
         }
         $plainParameterList[] = 'item' . $i;
     }
     $collection = $this->getCollection();
     $this->l->expects($this->any())->method('t')->willReturnCallback(function ($string, $parameters) {
         return vsprintf($string, $parameters);
     });
     $this->l->expects($this->any())->method('n')->willReturnCallback(function ($singular, $plural, $count, $parameters) {
         if ($count === 1) {
             $string = str_replace('%n', $count, $singular);
         } else {
             $string = str_replace('%n', $count, $plural);
         }
         return vsprintf($string, $parameters);
     });
     $this->assertSame($expected, $this->invokePrivate($collection, 'joinParameterList', [$parameterList, $plainParameterList, $allowHtml]));
 }
开发者ID:ynott,项目名称:activity,代码行数:32,代码来源:collectiontest.php

示例12: testAddPersonalRootCertificateValidCertificate

 public function testAddPersonalRootCertificateValidCertificate()
 {
     $uploadedFile = ['tmp_name' => __DIR__ . '/../../data/certificates/goodCertificate.crt', 'name' => 'goodCertificate.crt'];
     $certificate = $this->getMock('\\OCP\\ICertificate');
     $certificate->expects($this->once())->method('getName')->will($this->returnValue('Name'));
     $certificate->expects($this->once())->method('getCommonName')->will($this->returnValue('CommonName'));
     $certificate->expects($this->once())->method('getOrganization')->will($this->returnValue('Organization'));
     $certificate->expects($this->exactly(2))->method('getIssueDate')->will($this->returnValue(new \DateTime('@1429099555')));
     $certificate->expects($this->exactly(2))->method('getExpireDate')->will($this->returnValue(new \DateTime('@1529099555')));
     $certificate->expects($this->once())->method('getIssuerName')->will($this->returnValue('Issuer'));
     $certificate->expects($this->once())->method('getIssuerOrganization')->will($this->returnValue('IssuerOrganization'));
     $this->request->expects($this->once())->method('getUploadedFile')->with('rootcert_import')->will($this->returnValue($uploadedFile));
     $this->certificateManager->expects($this->once())->method('addCertificate')->with(file_get_contents($uploadedFile['tmp_name'], 'goodCertificate.crt'))->will($this->returnValue($certificate));
     $this->l10n->expects($this->at(0))->method('l')->with('date', new \DateTime('@1429099555'))->will($this->returnValue('Valid From as String'));
     $this->l10n->expects($this->at(1))->method('l')->with('date', new \DateTime('@1529099555'))->will($this->returnValue('Valid Till as String'));
     $expected = new DataResponse(['name' => 'Name', 'commonName' => 'CommonName', 'organization' => 'Organization', 'validFrom' => 1429099555, 'validTill' => 1529099555, 'validFromString' => 'Valid From as String', 'validTillString' => 'Valid Till as String', 'issuer' => 'Issuer', 'issuerOrganization' => 'IssuerOrganization']);
     $this->assertEquals($expected, $this->certificateController->addPersonalRootCertificate());
 }
开发者ID:kenwi,项目名称:core,代码行数:18,代码来源:CertificateControllerTest.php

示例13: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->navigationManager = $this->getMockBuilder('OCP\\INavigationManager')->disableOriginalConstructor()->getMock();
     $this->urlGenerator = $this->getMockBuilder('OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     $this->languageFactory = $this->getMockBuilder('OCP\\L10N\\IFactory')->disableOriginalConstructor()->getMock();
     $this->notificationManager = $this->getMockBuilder('OC\\Notification\\IManager')->disableOriginalConstructor()->getMock();
     $this->activityManager = $this->getMockBuilder('OCP\\Activity\\IManager')->disableOriginalConstructor()->getMock();
     $this->language = $this->getMockBuilder('OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->language->expects($this->any())->method('t')->willReturnCallback(function ($string, $args) {
         return vsprintf($string, $args);
     });
     $this->overwriteService('NavigationManager', $this->navigationManager);
     $this->overwriteService('NotificationManager', $this->notificationManager);
     $this->overwriteService('ActivityManager', $this->activityManager);
     $this->overwriteService('URLGenerator', $this->urlGenerator);
     $this->overwriteService('L10NFactory', $this->languageFactory);
 }
开发者ID:arietimmerman,项目名称:announcementcenter,代码行数:18,代码来源:AppTest.php

示例14: setUp

 protected function setUp()
 {
     $this->existingUser = $this->getMockBuilder('OCP\\IUser')->disableOriginalConstructor()->getMock();
     $this->existingUser->expects($this->any())->method('getEMailAddress')->willReturn('test@example.com');
     $this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
     $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($text, $parameters = array()) {
         return vsprintf($text, $parameters);
     }));
     $this->defaults = $this->getMockBuilder('\\OC_Defaults')->disableOriginalConstructor()->getMock();
     $this->userManager = $this->getMockBuilder('\\OCP\\IUserManager')->disableOriginalConstructor()->getMock();
     $this->urlGenerator = $this->getMockBuilder('\\OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     $this->mailer = $this->getMockBuilder('\\OCP\\Mail\\IMailer')->disableOriginalConstructor()->getMock();
     $this->secureRandom = $this->getMockBuilder('\\OCP\\Security\\ISecureRandom')->disableOriginalConstructor()->getMock();
     $this->timeFactory = $this->getMockBuilder('\\OCP\\AppFramework\\Utility\\ITimeFactory')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMockBuilder('OCP\\IRequest')->disableOriginalConstructor()->getMock();
     $this->lostController = new LostController('Core', $this->request, $this->urlGenerator, $this->userManager, $this->defaults, $this->l10n, $this->config, $this->secureRandom, 'lostpassword-noreply@localhost', true, $this->mailer, $this->timeFactory);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:18,代码来源:LostControllerTest.php

示例15: testFormat

 /**
  * @dataProvider dataFormat
  *
  * @param string $parameter
  * @param null|\OCP\IUser $user
  * @param bool $avatarsEnabled
  * @param bool $allowHtml
  * @param bool $verbose
  * @param string $expected
  */
 public function testFormat($parameter, $user, $avatarsEnabled, $allowHtml, $verbose, $expected)
 {
     /** @var \OCP\Activity\IEvent|\PHPUnit_Framework_MockObject_MockObject $event */
     $event = $this->getMockBuilder('OCP\\Activity\\IEvent')->disableOriginalConstructor()->getMock();
     $this->l->expects($this->never())->method('t');
     $this->userManager->expects($this->once())->method('get')->with($parameter)->willReturn($user);
     $this->config->expects($this->any())->method('getSystemValue')->with('enable_avatars', true)->willReturn($avatarsEnabled);
     $formatter = $this->getFormatter();
     $this->assertSame($expected, $formatter->format($event, $parameter, $allowHtml, $verbose));
 }
开发者ID:ynott,项目名称:activity,代码行数:20,代码来源:userformattertest.php


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