June 2017
Intermediate to advanced
536 pages
9h 49m
English
The sample application for Behat testing is the same one we used for PHPUnit testing. We will merely extend it a bit by adding an extra class to it. Given the lack of any real "behavior" in our PHPUnit sample application, our extension here will include a dummy shopping cart functionality.
Therefore, we will add the src\Foggyline\Checkout\Model\Cart.php file, with its content as follows:
<?phpdeclare(strict_types=1);namespace Foggyline\Checkout\Model;class Cart implements \Countable{ protected $productQtyMapping = []; public function addProduct(\Foggyline\Catalog\Model\Product $product, int $qty): self { $this->productQtyMapping[$product->getId()]['product'] = $product; $this->productQtyMapping[$product->getId()][ ...
Read now
Unlock full access