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


PHP ISecureRandom::expects方法代码示例

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


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

示例1: testCreateCredentials

 public function testCreateCredentials()
 {
     $this->jobList->expects($this->once())->method('add')->with('OCA\\UpdateNotification\\ResetTokenBackgroundJob');
     $this->secureRandom->expects($this->once())->method('generate')->with(64)->willReturn('MyGeneratedToken');
     $this->config->expects($this->once())->method('setSystemValue')->with('updater.secret');
     $this->timeFactory->expects($this->once())->method('getTime')->willReturn(12345);
     $this->config->expects($this->once())->method('setAppValue')->with('core', 'updater.secret.created', 12345);
     $expected = new DataResponse('MyGeneratedToken');
     $this->assertEquals($expected, $this->adminController->createCredentials());
 }
开发者ID:ZverAleksey,项目名称:core,代码行数:10,代码来源:AdminControllerTest.php

示例2: testGetIdWithoutModUnique

 public function testGetIdWithoutModUnique()
 {
     $lowRandomSource = $this->getMockBuilder('\\OCP\\Security\\ISecureRandom')->disableOriginalConstructor()->getMock();
     $lowRandomSource->expects($this->once())->method('generate')->with('20')->will($this->returnValue('GeneratedByOwnCloudItself'));
     $this->secureRandom->expects($this->once())->method('getLowStrengthGenerator')->will($this->returnValue($lowRandomSource));
     $request = new Request([], $this->secureRandom, $this->getMock('\\OCP\\Security\\ICrypto'), $this->config, $this->stream);
     $this->assertSame('GeneratedByOwnCloudItself', $request->getId());
 }
开发者ID:rosarion,项目名称:core,代码行数:8,代码来源:RequestTest.php

示例3: testGenerateTokenWithDefault

 public function testGenerateTokenWithDefault()
 {
     $this->random->expects($this->once())->method('generate')->with(32)->willReturn('12345678901234567890123456789012');
     $this->assertSame('12345678901234567890123456789012', $this->csrfTokenGenerator->generateToken(32));
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:5,代码来源:CsrfTokenGeneratorTest.php

示例4: testGetIdWithoutModUnique

 public function testGetIdWithoutModUnique()
 {
     $this->secureRandom->expects($this->once())->method('generate')->with('20')->will($this->returnValue('GeneratedByOwnCloudItself'));
     $request = new Request([], $this->secureRandom, $this->config, $this->csrfTokenManager, $this->stream);
     $this->assertSame('GeneratedByOwnCloudItself', $request->getId());
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:6,代码来源:RequestTest.php


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