2929use  OCA \Files_Trashbin \Expiration ;
3030use  OCP \AppFramework \Utility \ITimeFactory ;
3131use  OCP \BackgroundJob \IJobList ;
32- use  OCP \IConfig ;
32+ use  OCP \IAppConfig ;
3333use  OCP \IUserManager ;
3434use  PHPUnit \Framework \MockObject \MockObject ;
3535use  Test \TestCase ;
3636
3737class  ExpireTrashTest extends  TestCase {
38- 	/** @var IConfig| MockObject */ 
39- 	private  $ config 
38+ 	/** @var IAppConfig& MockObject */ 
39+ 	private  $ appConfig 
4040
41- 	/** @var IUserManager| MockObject */ 
41+ 	/** @var IUserManager& MockObject */ 
4242	private  $ userManager
4343
44- 	/** @var Expiration| MockObject */ 
44+ 	/** @var Expiration& MockObject */ 
4545	private  $ expiration
4646
47- 	/** @var IJobList| MockObject */ 
47+ 	/** @var IJobList& MockObject */ 
4848	private  $ jobList
4949
50- 	/** @var ITimeFactory| MockObject */ 
50+ 	/** @var ITimeFactory& MockObject */ 
5151	private  $ time
5252
5353	protected  function  setUp (): void  {
5454		parent ::setUp ();
5555
56- 		$ this config  = $ this createMock (IConfig ::class);
56+ 		$ this appConfig  = $ this createMock (IAppConfig ::class);
5757		$ this userManager  = $ this createMock (IUserManager::class);
5858		$ this expiration  = $ this createMock (Expiration::class);
5959		$ this jobList  = $ this createMock (IJobList::class);
@@ -69,22 +69,25 @@ protected function setUp(): void {
6969	}
7070
7171	public  function  testConstructAndRun (): void  {
72- 		$ this config ->method ('getAppValue ' )
72+ 		$ this appConfig ->method ('getValueString ' )
7373			->with ('files_trashbin ' , 'background_job_expire_trash ' , 'yes ' )
7474			->willReturn ('yes ' );
75+ 		$ this appConfig ->method ('getValueInt ' )
76+ 			->with ('files_trashbin ' , 'background_job_expire_trash_offset ' , 0 )
77+ 			->willReturn (0 );
7578
76- 		$ jobnew  ExpireTrash ($ this config , $ this userManager , $ this expiration , $ this time );
79+ 		$ jobnew  ExpireTrash ($ this appConfig , $ this userManager , $ this expiration , $ this time );
7780		$ jobstart ($ this jobList );
7881	}
7982
8083	public  function  testBackgroundJobDeactivated (): void  {
81- 		$ this config ->method ('getAppValue ' )
84+ 		$ this appConfig ->method ('getValueString ' )
8285			->with ('files_trashbin ' , 'background_job_expire_trash ' , 'yes ' )
8386			->willReturn ('no ' );
8487		$ this expiration ->expects ($ this never ())
8588			->method ('getMaxAgeAsTimestamp ' );
8689
87- 		$ jobnew  ExpireTrash ($ this config , $ this userManager , $ this expiration , $ this time );
90+ 		$ jobnew  ExpireTrash ($ this appConfig , $ this userManager , $ this expiration , $ this time );
8891		$ jobstart ($ this jobList );
8992	}
9093}
0 commit comments