コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: shop.php プロジェクト: reillo/ninjawars
<?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.