Skip to content

Commit 7f5a021

Browse files
committed
add authentication test
1 parent 3b38455 commit 7f5a021

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace FedEx\Tests;
4+
5+
use FedEx\RateService\Request;
6+
use FedEx\RateService\ComplexType\RateRequest;
7+
use FedEx\RateService\ComplexType\RateReply;
8+
use FedEx\Utility\ComplexTypePopulator;
9+
10+
class AuthenticationTest extends TestCase
11+
{
12+
/**
13+
* Test for handling an authentication error.
14+
*/
15+
public function testAuthenticationFailed()
16+
{
17+
$rateRequest = new RateRequest();
18+
19+
$populator = new ComplexTypePopulator();
20+
$populator->populate($rateRequest);
21+
22+
$expectedResponse = $this->mockResponseSerializer->get('error-authentication-failed.ser');
23+
24+
$mockSoapClient = $this->getMockFromWsdl(Request::getWsdlPath());
25+
$mockSoapClient->method('getRates')->will($this->returnValue($expectedResponse));
26+
27+
$request = new Request($mockSoapClient);
28+
29+
$ratesReply = $request->getGetRatesReply($rateRequest);
30+
31+
$this->assertInstanceOf(RateReply::class, $ratesReply);
32+
$this->assertEquals('ERROR', $ratesReply->Notifications[0]->Severity);
33+
$this->assertEquals(1000, $ratesReply->Notifications[0]->Code);
34+
}
35+
}

0 commit comments

Comments
 (0)