Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 16 |
App\Controllers\OrderReviewControlController | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 16 |
__construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 7 |
|||
reviewAction | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 9 |
<?php | |
namespace App\Controllers; | |
use App\Models\Cart; | |
use App\Models\OrderReview; | |
use App\Models\DatabaseMySql; | |
use App\Models\Email; | |
class OrderReviewControlController extends \Core\Controller { | |
private $form; | |
private $cartTotal; | |
private $cart; | |
private $email; | |
/** | |
* | |
* @var DatabaseMySql | |
*/ | |
private $db; | |
public function __construct($route_params) { | |
parent::__construct($route_params); | |
$this->db = DatabaseMySql::getInstance(); | |
$this->form = OrderReview::getInstance(); | |
$this->cart = Cart::getInstance(); | |
$this->cartTotal = CartViewController::getCartTotal($this->cart->getArticles()); | |
$this->email = Email::getInstance(); | |
} | |
public function reviewAction() { | |
$this->email->sendMail(); | |
$formular = new \App\Models\OrderReview(); | |
$formular->insertForm($_SESSION['formularData'], $this->cartTotal); | |
$orderId = $this->db->lastInsertedId(); | |
$articles = new \App\Models\OrderReview(); | |
$articles->insertCart($this->cart, $orderId); | |
session_destroy(); | |
header('Location: /thankYou'); | |
} | |
} |