1111use  OCA \Files_Trashbin \Expiration ;
1212use  OCP \AppFramework \Utility \ITimeFactory ;
1313use  OCP \BackgroundJob \IJobList ;
14- use  OCP \IConfig ;
14+ use  OCP \IAppConfig ;
1515use  OCP \IUserManager ;
1616use  PHPUnit \Framework \MockObject \MockObject ;
1717use  Test \TestCase ;
1818
1919class  ExpireTrashTest extends  TestCase {
20- 	/** @var IConfig| MockObject */ 
21- 	private  $ config 
20+ 	/** @var IAppConfig& MockObject */ 
21+ 	private  $ appConfig 
2222
23- 	/** @var IUserManager| MockObject */ 
23+ 	/** @var IUserManager& MockObject */ 
2424	private  $ userManager
2525
26- 	/** @var Expiration| MockObject */ 
26+ 	/** @var Expiration& MockObject */ 
2727	private  $ expiration
2828
29- 	/** @var IJobList| MockObject */ 
29+ 	/** @var IJobList& MockObject */ 
3030	private  $ jobList
3131
32- 	/** @var ITimeFactory| MockObject */ 
32+ 	/** @var ITimeFactory& MockObject */ 
3333	private  $ time
3434
3535	protected  function  setUp (): void  {
3636		parent ::setUp ();
3737
38- 		$ this config  = $ this createMock (IConfig ::class);
38+ 		$ this appConfig  = $ this createMock (IAppConfig ::class);
3939		$ this userManager  = $ this createMock (IUserManager::class);
4040		$ this expiration  = $ this createMock (Expiration::class);
4141		$ this jobList  = $ this createMock (IJobList::class);
@@ -51,22 +51,25 @@ protected function setUp(): void {
5151	}
5252
5353	public  function  testConstructAndRun (): void  {
54- 		$ this config ->method ('getAppValue ' )
54+ 		$ this appConfig ->method ('getValueString ' )
5555			->with ('files_trashbin ' , 'background_job_expire_trash ' , 'yes ' )
5656			->willReturn ('yes ' );
57+ 		$ this appConfig ->method ('getValueInt ' )
58+ 			->with ('files_trashbin ' , 'background_job_expire_trash_offset ' , 0 )
59+ 			->willReturn (0 );
5760
58- 		$ jobnew  ExpireTrash ($ this config , $ this userManager , $ this expiration , $ this time );
61+ 		$ jobnew  ExpireTrash ($ this appConfig , $ this userManager , $ this expiration , $ this time );
5962		$ jobstart ($ this jobList );
6063	}
6164
6265	public  function  testBackgroundJobDeactivated (): void  {
63- 		$ this config ->method ('getAppValue ' )
66+ 		$ this appConfig ->method ('getValueString ' )
6467			->with ('files_trashbin ' , 'background_job_expire_trash ' , 'yes ' )
6568			->willReturn ('no ' );
6669		$ this expiration ->expects ($ this never ())
6770			->method ('getMaxAgeAsTimestamp ' );
6871
69- 		$ jobnew  ExpireTrash ($ this config , $ this userManager , $ this expiration , $ this time );
72+ 		$ jobnew  ExpireTrash ($ this appConfig , $ this userManager , $ this expiration , $ this time );
7073		$ jobstart ($ this jobList );
7174	}
7275}
0 commit comments