Пример #1
0
	protected function addNewEncryptionModule(Manager $manager, $id) {
		$encryptionModule = $this->getMock('\OCP\Encryption\IEncryptionModule');
		$encryptionModule->expects($this->any())
			->method('getId')
			->willReturn('ID' . $id);
		$encryptionModule->expects($this->any())
			->method('getDisplayName')
			->willReturn('TestDummyModule' . $id);
		/** @var \OCP\Encryption\IEncryptionModule $encryptionModule */
		$manager->registerEncryptionModule('ID' . $id, 'TestDummyModule' . $id, function() use ($encryptionModule) {
			return $encryptionModule;
		});
	}
Пример #2
0
 public function testGetDefaultEncryptionModule()
 {
     $config = $this->getMock('\\OCP\\IConfig');
     $config->expects($this->any())->method('getAppValue')->willReturn(true);
     $em = $this->getMock('\\OCP\\Encryption\\IEncryptionModule');
     $em->expects($this->any())->method('getId')->willReturn(0);
     $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
     $m = new Manager($config);
     $m->registerEncryptionModule($em);
     $this->assertSame(1, count($m->getEncryptionModules()));
     $en0 = $m->getEncryptionModule(0);
     $this->assertEquals(0, $en0->getId());
 }