示例#1
0
 public function testProcessRequestReturnsNotFoundIfFileIsNotSynchronized()
 {
     $this->_requestMock->expects($this->any())->method('getPathInfo')->will($this->returnValue($this->_mediaDirectory . '/'));
     $this->_sync->expects($this->once())->method('synchronize');
     $this->_requestMock->expects($this->any())->method('getFilePath')->will($this->returnValue('non_existing_file_name'));
     $this->_responseMock->expects($this->once())->method('setHttpResponseCode')->with(404);
     $this->assertSame($this->_responseMock, $this->_model->launch());
 }
示例#2
0
 /**
  * @param bool $isDeveloper
  * @param int $setBodyCalls
  *
  * @dataProvider catchExceptionDataProvider
  */
 public function testCatchException($isDeveloper, $setBodyCalls)
 {
     $bootstrap = $this->getMock('Magento\\Framework\\App\\Bootstrap', [], [], '', false);
     $exception = $this->getMock('Exception', [], [], '', false);
     $this->responseMock->expects($this->once())->method('setHttpResponseCode')->with(404);
     $bootstrap->expects($this->once())->method('isDeveloperMode')->will($this->returnValue($isDeveloper));
     $this->responseMock->expects($this->exactly($setBodyCalls))->method('setBody');
     $this->responseMock->expects($this->once())->method('sendResponse');
     $this->model->catchException($bootstrap, $exception);
 }