11<?php 
2+ 
3+ declare (strict_types=1 );
4+ 
25/** 
36 * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> 
47 * 
3437use  OCP \AppFramework \Utility \ITimeFactory ;
3538use  OCP \IConfig ;
3639use  OCP \Security \ICrypto ;
40+ use  PHPUnit \Framework \MockObject \MockObject ;
3741use  Psr \Log \LoggerInterface ;
3842use  Test \TestCase ;
3943
@@ -46,6 +50,8 @@ class PublicKeyTokenProviderTest extends TestCase {
4650	private  $ crypto
4751	/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ 
4852	private  $ config
53+ 	/** @var IDBConnection|IDBConnection|MockObject */ 
54+ 	private  IDBConnection $ db
4955	/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ 
5056	private  $ logger
5157	/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */ 
@@ -66,14 +72,24 @@ protected function setUp(): void {
6672				['secret ' , '' , '1f4h9s ' ],
6773				['openssl ' , [], []],
6874			]);
75+ 		$ this db  = $ this createMock (IDBConnection::class);
76+ 		$ this db ->method ('atomic ' )->willReturnCallback (function ($ cb
77+ 			return  $ cb
78+ 		});
6979		$ this logger  = $ this createMock (LoggerInterface::class);
7080		$ this timeFactory  = $ this createMock (ITimeFactory::class);
7181		$ this time  = 1313131 ;
7282		$ this timeFactory ->method ('getTime ' )
7383			->willReturn ($ this time );
7484
75- 		$ this tokenProvider  = new  PublicKeyTokenProvider ($ this mapper , $ this crypto , $ this config , $ this logger ,
76- 			$ this timeFactory );
85+ 		$ this tokenProvider  = new  PublicKeyTokenProvider (
86+ 			$ this mapper ,
87+ 			$ this crypto ,
88+ 			$ this config ,
89+ 			$ this db ,
90+ 			$ this logger ,
91+ 			$ this timeFactory ,
92+ 		);
7793	}
7894
7995	public  function  testGenerateToken () {
0 commit comments