Exemplo n.º 1
0
 public function testGetMethodAllStoresInvalid()
 {
     $this->_routeMock->expects($this->any())->method('getAclResources')->will($this->returnValue(['1']));
     $this->_authorizationMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true));
     $this->storeMock->expects($this->once())->method('getCode')->willReturn('admin');
     $this->_requestMock->expects($this->once())->method('getMethod')->willReturn('get');
     $this->_restController->dispatch($this->_requestMock);
     $this->assertTrue($this->_responseMock->isException());
     $this->assertSame("Cannot perform GET operation with store code 'all'", $this->_responseMock->getException()[0]->getMessage());
 }
 /**
  * @expectedException \Magento\Framework\Exception\AuthorizationException
  * @expectedExceptionMessage Consumer is not authorized to access 5, 6
  */
 public function testAuthorizationFailed()
 {
     $this->authorizationMock->expects($this->once())->method('isAllowed')->will($this->returnValue(false));
     $this->routeMock->expects($this->any())->method('getAclResources')->will($this->returnValue(['5', '6']));
     $this->requestValidator->validate();
 }