public function testUnauthorized() { $serviceInfo = ['soap' => ['service' => 'testModule3ErrorV1', 'operation' => 'testModule3ErrorV1AuthorizationException', 'token' => 'invalidToken']]; $expectedException = new AuthorizationException(__(AuthorizationException::NOT_AUTHORIZED, ['resources' => 'Magento_TestModule3::resource1, Magento_TestModule3::resource2'])); try { $this->_webApiCall($serviceInfo); $this->fail("SoapFault was not raised as expected."); } catch (\SoapFault $e) { $this->checkSoapFault($e, $expectedException->getRawMessage(), 'env:Sender', $expectedException->getParameters()); } }
/** * @return void */ public function testConstructor() { $authorizationException = new AuthorizationException(new Phrase(AuthorizationException::NOT_AUTHORIZED, ['consumer_id' => 1, 'resources' => 'record2'])); $this->assertSame('Consumer is not authorized to access record2', $authorizationException->getMessage()); }