You are here

public function FedExRequestTest::testRateRequest in Commerce FedEx 8

@covers ::getRateRequest

File

tests/src/Unit/FedExRequestTest.php, line 33

Class

FedExRequestTest
Test Class for the Fedex Shipping Plugin.

Namespace

Drupal\Tests\commerce_fedex\Unit

Code

public function testRateRequest() {
  $rate_request = $this->request
    ->getRateRequest($this->configuration);
  $this
    ->assertInstanceOf("\\NicholasCreativeMedia\\FedExPHP\\Structs\\RateRequest", $rate_request);
  $client_detail = $rate_request
    ->getClientDetail();
  $this
    ->assertInstanceOf("\\NicholasCreativeMedia\\FedExPHP\\Structs\\ClientDetail", $client_detail);
  $this
    ->assertEquals('1234567', $client_detail
    ->getAccountNumber());
  $this
    ->assertEquals('9876543', $client_detail
    ->getMeterNumber());
  $web_authentication_detail = $rate_request
    ->getWebAuthenticationDetail();
  $this
    ->assertInstanceOf("\\NicholasCreativeMedia\\FedExPHP\\Structs\\WebAuthenticationDetail", $web_authentication_detail);
  $user_credential = $web_authentication_detail
    ->getUserCredential();
  $this
    ->assertInstanceOf("\\NicholasCreativeMedia\\FedExPHP\\Structs\\WebAuthenticationCredential", $user_credential);
  $this
    ->assertEquals('testkey', $user_credential
    ->getKey());
  $this
    ->assertEquals('testpass', $user_credential
    ->getPassword());
}