本文整理汇总了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());
}
示例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());
}
示例3: testGenerateTokenWithDefault
public function testGenerateTokenWithDefault()
{
$this->random->expects($this->once())->method('generate')->with(32)->willReturn('12345678901234567890123456789012');
$this->assertSame('12345678901234567890123456789012', $this->csrfTokenGenerator->generateToken(32));
}
示例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());
}