Esempio n. 1
0
 public function testUpdateDbWithException()
 {
     $this->databaseConfig->expects($this->once())->method('isAutoUpdate')->willReturn(true);
     $e = new \Exception();
     $this->updaterSelected->expects($this->once())->method('update')->willThrowException($e);
     $this->logger->expects($this->once())->method('critical')->with($e);
     $this->assertSame($this->cronUpdateDb, $this->cronUpdateDb->execute());
 }
Esempio n. 2
0
 public function testUpdate()
 {
     $statusInfo = 'some status info';
     $data = ['status' => 'success', 'message' => __('Database(s) successfully updated.'), 'status_info' => $statusInfo];
     $this->resultJson->expects($this->once())->method('setData')->with($data)->willReturnSelf();
     $this->updaterSelected->expects($this->once())->method('update')->willReturnSelf();
     $statusBlock = $this->getMockBuilder('Tobai\\GeoIp2\\Block\\Adminhtml\\System\\Config\\Status')->disableOriginalConstructor()->getMock();
     $layout = $this->getMock('Magento\\Framework\\View\\LayoutInterface');
     $this->layoutFactory->expects($this->once())->method('create')->willReturn($layout);
     $layout->expects($this->once())->method('createBlock')->with('Tobai\\GeoIp2\\Block\\Adminhtml\\System\\Config\\Status')->willReturn($statusBlock);
     $statusBlock->expects($this->once())->method('getDbStatus')->willReturn($statusInfo);
     $this->logger->expects($this->never())->method('critical');
     $this->assertSame($this->resultJson, $this->controllerUpdate->execute());
 }