You are here

public function WishlistPurchaseTest::testGetters in Commerce Wishlist 8.3

Tests getters.

::covers getOrderId ::covers getQuantity ::covers getPurchasedTime ::covers toArray.

File

tests/src/Unit/WishlistPurchaseTest.php, line 61

Class

WishlistPurchaseTest
Tests the WishlistPurchase class.

Namespace

Drupal\Tests\commerce_wishlist\Unit

Code

public function testGetters() {
  $time = time();
  $this->purchase = new WishlistPurchase('10', 2, $time);
  $this
    ->assertEquals('10', $this->purchase
    ->getOrderId());
  $this
    ->assertEquals(2, $this->purchase
    ->getQuantity());
  $this
    ->assertEquals($time, $this->purchase
    ->getPurchasedTime());
  $expected = [
    'order_id' => '10',
    'quantity' => '2',
    'purchased' => $time,
  ];
  $this
    ->assertEquals($expected, $this->purchase
    ->toArray());
}