/** * @depends testProductDelete */ public function testProductPagination() { for ($i = 0; $i <= 9; $i++) { $this->client->createProduct(['title' => 'test product ' . $i]); } $counter = 0; foreach ($this->client->getResourcePager('products', 5) as $product) { $this->assertNotEmpty($product); $this->assertObjectHasAttribute('title', $product); $this->assertEquals('test product ' . $counter, $product->title); $counter++; } $this->assertEquals(10, $this->client->getProductsCount(), 'There should be 10 products in the system.'); $opts['query']['limit'] = 5; foreach ($this->client->getProducts($opts) as $product) { $this->assertObjectHasAttribute('id', $product); $this->client->deleteProduct($product->id); } $this->assertEquals(0, $this->client->getProductsCount(), 'Not all products were deleted.'); }