Skip to content

Commit

Permalink
Changed all the tests that where using getLastRequest() for path to t…
Browse files Browse the repository at this point in the history
…he new getLastRequestPath() method
  • Loading branch information
jswift committed Apr 11, 2021
1 parent 8468d0e commit 844a6da
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/BigCommerce/Api/Carts/CartItemsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testCanAddCartLineItem()

$this->getApi()->cart($id)->items()->add($lineItem, CartItemsApi::INCLUDE_REDIRECT_URLS);

$this->assertEquals("carts/$id/items", $this->getLastRequest()->getUri()->getPath());
$this->assertEquals("carts/$id/items", $this->getLastRequestPath());
}

public function testCanDeleteCartLineItem()
Expand Down
6 changes: 3 additions & 3 deletions tests/BigCommerce/Api/Carts/CartsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testCanGetCart()
$id = 'aae435b7-e8a4-48f2-abcd-ad0675dc3123';
$cart = $this->getApi()->cart($id)->get()->getCart();
$this->assertEquals(1815, $cart->cart_amount);
$this->assertEquals("carts/$id", $this->getLastRequest()->getUri()->getPath());
$this->assertEquals("carts/$id", $this->getLastRequestPath());
}

public function testCanCreateACart()
Expand All @@ -23,7 +23,7 @@ public function testCanCreateACart()
$cart = new Cart();

$this->getApi()->carts()->create($cart);
$this->assertEquals("carts", $this->getLastRequest()->getUri()->getPath());
$this->assertEquals("carts", $this->getLastRequestPath());
}

public function testCanUpdateCustomerIdForCart()
Expand All @@ -33,7 +33,7 @@ public function testCanUpdateCustomerIdForCart()

$this->getApi()->cart($id)->updateCustomerId(3);

$this->assertEquals("carts/$id", $this->getLastRequest()->getUri()->getPath());
$this->assertEquals("carts/$id", $this->getLastRequestPath());
$this->assertEquals(json_encode(['customer_id' => 3]), $this->getLastRequest()->getBody());
$this->markTestIncomplete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testCanGetBrandMetafield(): void

$response = $this->getApi()->catalog()->brand(158)->metafield(8)->get();
$this->assertEquals('Shelf 3, Bin 5', $response->getMetafield()->value);
$this->assertEquals('catalog/brands/158/metafields/8', $this->getLastRequest()->getUri()->getPath());
$this->assertEquals('catalog/brands/158/metafields/8', $this->getLastRequestPath());
}

public function testCanGetAllBrandMetafields(): void
Expand All @@ -32,6 +32,6 @@ public function testCanGetAllBrandMetafields(): void
$response = $this->getApi()->catalog()->brand(11)->metafields()->getAll();
$this->assertEquals(2, $response->getPagination()->total);
$this->assertEquals('Warehouse Locations', $response->getMetafields()[0]->namespace);
$this->assertEquals('catalog/brands/11/metafields', $this->getLastRequest()->getUri()->getPath());
$this->assertEquals('catalog/brands/11/metafields', $this->getLastRequestPath());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public function testCanSetApiUrlCorrectlyForGetAll(): void
$this->setReturnData('catalog__categories__111__metafields__get_all.json');
$this->getApi()->catalog()->category(111)->metafields()->getAll();

$this->assertEquals('catalog/categories/111/metafields', $this->getLastRequest()->getUri()->getPath());
$this->assertEquals('catalog/categories/111/metafields', $this->getLastRequestPath());
}

public function testCanSetApiUrlCorrectlyForGet(): void
{
$this->setReturnData('catalog__categories__158__metafields__8__get.json');
$this->getApi()->catalog()->category(158)->metafield(8)->get();

$this->assertEquals('catalog/categories/158/metafields/8', $this->getLastRequest()->getUri()->getPath());
$this->assertEquals('catalog/categories/158/metafields/8', $this->getLastRequestPath());
}
}
4 changes: 2 additions & 2 deletions tests/BigCommerce/Api/Orders/OrderMetafieldsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function testCanGetOrderMetafield(): void
$this->setReturnData('orders__2__metafields__3__get.json');

$this->getApi()->order(2)->metafield(3)->get();
$this->assertEquals('orders/2/metafields/3', $this->getLastRequest()->getUri()->getPath());
$this->assertEquals('orders/2/metafields/3', $this->getLastRequestPath());
}

public function testCanGetAllOrderMetafields(): void
Expand All @@ -20,6 +20,6 @@ public function testCanGetAllOrderMetafields(): void

$response = $this->getApi()->order(1)->metafields()->getAll();
$this->assertEquals(2, $response->getPagination()->total);
$this->assertEquals('orders/1/metafields', $this->getLastRequest()->getUri()->getPath());
$this->assertEquals('orders/1/metafields', $this->getLastRequestPath());
}
}
2 changes: 1 addition & 1 deletion tests/BigCommerce/Api/Subscribers/SubscribersApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public function testCanGetSubscribers(): void
$this->setReturnData('no-data-paginated.json');

$this->getApi()->customers()->subscribers()->getAll()->getSubscribers();
$this->assertEquals('customers/subscribers', $this->getLastRequest()->getUri()->getPath());
$this->assertEquals('customers/subscribers', $this->getLastRequestPath());
}
}

0 comments on commit 844a6da

Please sign in to comment.