diff options
Diffstat (limited to 'tests/phpunit/opencart/catalog/controller/checkout/CartTest.php')
-rw-r--r-- | tests/phpunit/opencart/catalog/controller/checkout/CartTest.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/phpunit/opencart/catalog/controller/checkout/CartTest.php b/tests/phpunit/opencart/catalog/controller/checkout/CartTest.php new file mode 100644 index 0000000..5db180d --- /dev/null +++ b/tests/phpunit/opencart/catalog/controller/checkout/CartTest.php @@ -0,0 +1,22 @@ +<?php + +class CatalogControllerCheckoutCartTest extends OpenCartTest { + + /** + * @before + */ + public function setupTest() { + $this->cart->clear(); + } + + public function testAddProduct() { + $this->request->post['product_id'] = 28; + $this->request->post['quantity'] = 1; + + $response = json_decode($this->dispatchAction("checkout/cart/add")->getOutput(), true); + + $this->assertTrue(!empty($response['success']) && !empty($response['total'])); + $this->assertEquals(1, preg_match('/HTC Touch HD/', $response['success'])); + $this->assertEquals(1, preg_match('/122\.00/', $response['total'])); + } +} |