示例#1
0
 public function testRunInstanceVerification()
 {
     $this->checker = $this->getMockBuilder('\\OC\\IntegrityCheck\\Checker')->setConstructorArgs([$this->environmentHelper, $this->fileAccessHelper, $this->appLocator, $this->config, $this->cacheFactory, $this->appManager])->setMethods(['verifyCoreSignature', 'verifyAppSignature'])->getMock();
     $this->checker->expects($this->at(0))->method('verifyCoreSignature');
     $this->appLocator->expects($this->at(0))->Method('getAllApps')->will($this->returnValue(['files', 'calendar', 'contacts', 'dav']));
     $this->appManager->expects($this->at(0))->method('isShipped')->with('files')->will($this->returnValue(true));
     $this->checker->expects($this->at(1))->method('verifyAppSignature')->with('files');
     $this->appManager->expects($this->at(1))->method('isShipped')->with('calendar')->will($this->returnValue(false));
     $this->appLocator->expects($this->at(1))->method('getAppPath')->with('calendar')->will($this->returnValue('/apps/calendar'));
     $this->fileAccessHelper->expects($this->at(0))->method('file_exists')->with('/apps/calendar/appinfo/signature.json')->will($this->returnValue(true));
     $this->checker->expects($this->at(2))->method('verifyAppSignature')->with('calendar');
     $this->appManager->expects($this->at(2))->method('isShipped')->with('contacts')->will($this->returnValue(false));
     $this->appLocator->expects($this->at(2))->method('getAppPath')->with('contacts')->will($this->returnValue('/apps/contacts'));
     $this->fileAccessHelper->expects($this->at(1))->method('file_exists')->with('/apps/contacts/appinfo/signature.json')->will($this->returnValue(false));
     $this->appManager->expects($this->at(3))->method('isShipped')->with('dav')->will($this->returnValue(true));
     $this->checker->expects($this->at(3))->method('verifyAppSignature')->with('dav');
     $this->checker->runInstanceVerification();
 }