public function testShopPurchaseHandlesNoItemNoQuantity() { // Inject post request. $request = new Request([], []); RequestWrapper::inject($request); $shop = new ShopController(); ob_start(); $shop->buy(); $shop_outcome = ob_get_contents(); ob_end_clean(); $this->assertNotEmpty($shop_outcome); }
<?php require_once LIB_ROOT . "control/lib_inventory.php"; require_once LIB_ROOT . "control/ShopController.php"; use app\Controller\ShopController; if ($error = init(ShopController::$private, ShopController::$alive)) { display_error($error); } else { $shop = new ShopController(); if (post('purchase') == '1') { $response = $shop->buy(); } else { $response = $shop->index(); } display_page($response['template'], $response['title'], $response['parts'], $response['options']); } // End of no display error.