Exemple #1
0
    public function testExceptionRenderCaseForbiddenException()
    {
        Configure::load('../app/config/test.config.php');
        $this->expectOutputString('<div><h2>Forbidden</h2>
</div>
');
        ErrorHandler::handleException(new ForbiddenException('error'));
    }
Exemple #2
0
 public function setUp()
 {
     Configure::load('../app/config/config.php');
     $viewPath = '../app/View';
     $layoutPath = '../app/Layout';
     $elementPath = '../app/View/Element';
     $this->view = new ViewAdapter($viewPath, $layoutPath, $elementPath, new UsersController(new RequestAggregate()));
 }
<?php

use TRW\Core\Configure;
use TRW\Router\Router;
use TRW\ActiveRecord\BaseRecord;
use TRW\ActiveRecord\Database\Driver\MySql;
use TRW\Exception\ErrorHandler;
//ini_set('display_errors',1);
Configure::load(dirname(__FILE__) . '/config.php');
set_exception_handler('TRW\\Exception\\ErrorHandler::handleException');
BaseRecord::setConnection(new MySql(Configure::read('Database', 'MySql')));
Router::add('/', ['controller' => 'Pages', 'action' => 'index']);
 /**
 * デフォルトのレンダリングメソッド.
 *
 * 独自のレンダリングメソッドを実装しなかった場合このメソッドが呼ばれる
 *\
 * @return void
 */
 private function error()
 {
     $fileName = $this->template;
     if (Configure::read('Debug', 'level') === 1) {
         $fileName = 'develop';
     }
     echo $this->controller->render($fileName);
 }
Exemple #5
0
 public function setUp()
 {
     Configure::load('../app/config/config.php');
 }
Exemple #6
0
 public function setUp()
 {
     Configure::load('../app/config/config.php');
     BaseRecord::setConnection(new MySql(Configure::read('Database', 'MySql')));
 }
Exemple #7
0
 public function setUp()
 {
     Configure::load('../app/config/config.php');
     Router::clear();
 }
Exemple #8
0
 public function testLoadAndRead()
 {
     Configure::load('../app/config/config.php');
     $this->assertEquals('App', Configure::read('App', 'namespace'));
 }
Exemple #9
0
<?php

require '../../vendor/autoload.php';
use TRW\Core\Configure;
use TRW\Router\Router;
Configure::load(dirname(__FILE__) . '/config.php');
Router::add('/', ['controller' => 'Pages', 'action' => 'index', 'arguments' => [1]]);