diff options
author | Joas Schilling <coding@schilljs.com> | 2017-05-10 09:44:28 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-05-10 09:45:11 +0200 |
commit | ca399406146d74f2f46f8b8815f0b3c165c996ab (patch) | |
tree | 2a1c5ffd705698c04f8cef433e64b4416690af18 /tests/lib/Security/IdentityProof/ManagerTest.php | |
parent | a8bb4a18988534323d872b13a9895a2c9557b6c5 (diff) | |
download | nextcloud-server-ca399406146d74f2f46f8b8815f0b3c165c996ab.tar.gz nextcloud-server-ca399406146d74f2f46f8b8815f0b3c165c996ab.zip |
Automatic creation of Identity manager
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/Security/IdentityProof/ManagerTest.php')
-rw-r--r-- | tests/lib/Security/IdentityProof/ManagerTest.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/lib/Security/IdentityProof/ManagerTest.php b/tests/lib/Security/IdentityProof/ManagerTest.php index 2925dea5ec5..b46ca30705a 100644 --- a/tests/lib/Security/IdentityProof/ManagerTest.php +++ b/tests/lib/Security/IdentityProof/ManagerTest.php @@ -21,6 +21,7 @@ namespace Test\Security\IdentityProof; +use OC\Files\AppData\Factory; use OC\Security\IdentityProof\Key; use OC\Security\IdentityProof\Manager; use OCP\Files\IAppData; @@ -31,6 +32,8 @@ use OCP\Security\ICrypto; use Test\TestCase; class ManagerTest extends TestCase { + /** @var Factory|\PHPUnit_Framework_MockObject_MockObject */ + private $factory; /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */ private $appData; /** @var ICrypto|\PHPUnit_Framework_MockObject_MockObject */ @@ -40,11 +43,19 @@ class ManagerTest extends TestCase { public function setUp() { parent::setUp(); + + /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */ + $this->factory = $this->createMock(Factory::class); $this->appData = $this->createMock(IAppData::class); + $this->factory->expects($this->any()) + ->method('get') + ->with('identityproof') + ->willReturn($this->appData); + $this->crypto = $this->createMock(ICrypto::class); $this->manager = $this->getMockBuilder(Manager::class) ->setConstructorArgs([ - $this->appData, + $this->factory, $this->crypto ]) ->setMethods(['generateKeyPair']) @@ -151,12 +162,12 @@ class ManagerTest extends TestCase { public function testGenerateKeyPair() { $manager = new Manager( - $this->appData, + $this->factory, $this->crypto ); $data = 'MyTestData'; - list($resultPublicKey, $resultPrivateKey) = $this->invokePrivate($manager, 'generateKeyPair'); + list($resultPublicKey, $resultPrivateKey) = self::invokePrivate($manager, 'generateKeyPair'); openssl_sign($data, $signature, $resultPrivateKey); $details = openssl_pkey_get_details(openssl_pkey_get_public($resultPublicKey)); |