Ejemplo n.º 1
0
 public function dispatch()
 {
     try {
         $map = (include ROOT_DIR . '/conf/routes.php');
         SRoutes::initialize($map);
         SLocale::initialize();
         $request = new SRequest();
         $response = new SResponse();
         if (file_exists($path = APP_DIR . '/controllers/application_controller.php')) {
             require_once $path;
         }
         if (file_exists($path = APP_DIR . '/helpers/application_helper.php')) {
             require_once $path;
         }
         SActionController::factory(SRoutes::recognize($request), $response)->out();
     } catch (Exception $e) {
         SActionController::processWithException($request, $response, $e)->out();
     }
 }
<?php

require_once CORE_DIR . '/view/view.php';
require_once CORE_DIR . '/model/lib/attribute.php';
require_once CORE_DIR . '/common/lib/locale.php';
SLocale::initialize(false);
class MockContent extends MockRecord
{
    public $id = null;
    public $contentAttributes = array();
    public $newRecord = true;
    public $errors = array();
    protected $attributes = array('title', 'body', 'private', 'written_on');
    public function isNewRecord()
    {
        return $this->newRecord;
    }
    public function contentAttributes()
    {
        return $this->contentAttributes;
    }
    public function getAttribute($name)
    {
        foreach ($this->contentAttributes as $attr) {
            if ($attr->name == $name) {
                return $attr;
            }
        }
    }
}
if (!class_exists('SUrlRewriter')) {