public static function loadOpenCart() { if (!self::$loaded) { $application_config = 'test-config'; $_SERVER['SERVER_PORT'] = 80; $_SERVER['SERVER_PROTOCOL'] = 'CLI'; $_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; ob_start(); self::loadConfiguration(); require_once DIR_SYSTEM . 'startup.php'; require_once DIR_SYSTEM . 'framework.php'; ob_end_clean(); self::$registry = $registry; self::$registry->set('controller', $controller); if (self::isAdmin()) { $session = new stdClass(); $session->data = array(); $session->session_id = bin2hex(openssl_random_pseudo_bytes(16)); $session->getId = function () use($session) { return $session->session_id; }; self::$registry->set('session', $session); } self::$loaded = true; } }
<?php require_once '../src/OpenCartTest.php'; OpenCartTest::$_OPENCART = dirname(dirname(__DIR__)) . "/"; class SampleTest extends OpenCartTest { /** * @expectedException PHPUnit_Framework_Error */ public function testACallToARequiredLoginAction() { $response = $this->dispatchAction('account/wishlist'); $response->output(); } public function testACallToARequiredLoginActionWithLoggedInCustomer() { $this->customerLogin("*****@*****.**", "password"); $response = $this->dispatchAction('account/wishlist'); // $response->output(); } public function testLoadingExamplaryController() { $controller = $this->loadControllerByRoute('product/product'); $this->assertInstanceOf('ControllerProductProduct', $controller); } public function testDispatchingExamplaryAction() { $response = $this->dispatchAction('product/product'); $this->assertInstanceOf('Response', $response); } public function testLoadingExamplaryModel()