aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/opencart/catalog/controller/checkout/CartTest.php
blob: 5db180d3a9f19adf3da7a4c26d1cf64eef8ab685 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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']));
	}
}