diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-05-19 22:51:26 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-07-12 19:24:20 +0200 |
commit | 04f209069859004702ca5138cda3dbcafe4d8c0f (patch) | |
tree | 30a901c9b02971e28ce3ef98b47c65bcac3ebe21 /tests/lib | |
parent | 86a496d94ae438ae5de033fd6d9c5bee19ed4fcf (diff) | |
download | nextcloud-server-04f209069859004702ca5138cda3dbcafe4d8c0f.tar.gz nextcloud-server-04f209069859004702ca5138cda3dbcafe4d8c0f.zip |
Write cert bundle to tmp file first
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Security/CertificateManagerTest.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php index 408e65c6766..6bdb647abc5 100644 --- a/tests/lib/Security/CertificateManagerTest.php +++ b/tests/lib/Security/CertificateManagerTest.php @@ -12,6 +12,7 @@ use OC\Files\Storage\Temporary; use \OC\Security\CertificateManager; use OCP\IConfig; use OCP\ILogger; +use OCP\Security\ISecureRandom; /** * Class CertificateManagerTest @@ -26,6 +27,8 @@ class CertificateManagerTest extends \Test\TestCase { private $certificateManager; /** @var String */ private $username; + /** @var ISecureRandom */ + private $random; protected function setUp() { parent::setUp(); @@ -45,7 +48,17 @@ class CertificateManagerTest extends \Test\TestCase { $config->expects($this->any())->method('getSystemValue') ->with('installed', false)->willReturn(true); - $this->certificateManager = new CertificateManager($this->username, new \OC\Files\View(), $config, $this->createMock(ILogger::class)); + $this->random = $this->createMock(ISecureRandom::class); + $this->random->method('generate') + ->willReturn('random'); + + $this->certificateManager = new CertificateManager( + $this->username, + new \OC\Files\View(), + $config, + $this->createMock(ILogger::class), + $this->random + ); } protected function tearDown() { @@ -145,7 +158,7 @@ class CertificateManagerTest extends \Test\TestCase { /** @var CertificateManager | \PHPUnit_Framework_MockObject_MockObject $certificateManager */ $certificateManager = $this->getMockBuilder('OC\Security\CertificateManager') - ->setConstructorArgs([$uid, $view, $config, $this->createMock(ILogger::class)]) + ->setConstructorArgs([$uid, $view, $config, $this->createMock(ILogger::class), $this->random]) ->setMethods(['getFilemtimeOfCaBundle', 'getCertificateBundle']) ->getMock(); |