public function setUp() { $options = array('env' => 'testing', 'resources' => array('Cache', 'Config', 'Path')); $path = GENE_APP_PATH; Gene::app($path, $options); require_once dirname(__FILE__) . '/var/Test/AbstractMock.php'; }
public function testappメソッドはzend_applicationオブジェクトを応答する() { $options = array('env' => 'testing', 'resources' => array('Config', 'Path')); $path = GENE_APP_PATH; $app = Gene::app($path, $options); $this->assertTrue($app instanceof Zend_Application); }
public function init() { require_once 'Zend.php'; $this->_session = Gene::load('Gene_Service_Session'); $this->_dao = Gene::load('Gene_Service_Model')->getDao('Test_Service_Zend'); $this->getTranslateObject()->setTranslatePath(GENE_TEST_ROOT . '/var/locales/'); $this->_validator = $this->getValidator('Test_Service_Validator', 'message.ini'); }
public function init() { require_once 'Zend.php'; $this->_session = Gene::load('Gene_Service_Session'); $this->_dao = Gene::load('Gene_Service_Model')->getDao('Test_Service_Zend'); $this->getTranslateObject()->setTranslatePath(GENE_TEST_ROOT . '/var/locales/'); $this->_validator = $this->getValidator('Test_Service_Validator', 'message.ini'); $this->_before['confirm'] = array(array(new Test_Foo(), 'foo')); $this->_before['create'] = array(array(array(new Test_Bar(), 'foo'), array('Test_Bar::foo'))); $this->_before['editconfirm'] = array(array(new Test_Foo(), 'foo'), array(new Test_Baz(), 'foo')); $this->_before['update'] = array('Test_Foo::bar', array('Test_Foo', 'baz'), array(new Test_Foo(), 'baz')); }
public function init() { require_once 'Zend.php'; $this->_session = Gene::load('Gene_Service_Session'); $this->_dao = Gene::load('Gene_Service_Model')->getDao('Test_Service_Zend'); $this->getTranslateObject()->setTranslatePath(GENE_TEST_ROOT . '/var/locales/'); $this->_validator = $this->getValidator('Test_Service_Validator', 'message.ini'); $this->_before['confirm'] = 'beforeConfirm'; $this->_before['create'] = 'beforeCreate'; $this->_before['editconfirm'] = 'beforeEditconfirm'; $this->_before['update'] = 'beforeUpdate'; $this->_before['deleteconfirm'] = 'beforeDeleteconfirm'; $this->_before['delete'] = 'beforeDelete'; }
public function testセッションを消去できる() { $namespace = 'test2'; $key = 'fizz'; $value = 'baz'; $instance = Gene::load('Gene_Service_Session'); $instance->set($key, $value, $namespace); $instance->remove($namespace); $session = $instance->get($key, $namespace); $this->assertSame($session, null); }
public function testloadメソッドでロードしたキャッシュ済みオブジェクトを削除できる() { $options = array('env' => 'testing', 'resources' => array('Config', 'Log')); $path = GENE_APP_PATH; Gene::app($path, $options); $class = Gene::load('Zend_Version'); Gene::removeInstance('Zend_Version'); $clazz = Gene::load('Zend_Version'); $this->assertNotSame(spl_object_hash($class), spl_object_hash($clazz)); }
public function testaround修飾子があるメソッドが実行メソッドを上書きする() { require_once 'var/Test/Aop.php'; $service = Gene::load('Test_AroundFoo'); ob_start(); $service->run('foo'); $buffer = ob_get_contents(); ob_end_clean(); $this->assertSame($buffer, 'aroundFoo'); ob_start(); $service->run('bar', array('foo')); $buffer = ob_get_contents(); ob_end_clean(); $this->assertSame($buffer, 'fooaroundBar'); }
/** * Traceback * * @param ArrayObject $handler * @access private * @return ErrorController Fluent interface */ private function _traceback(ArrayObject $handler) { $env = $this->getInvokeArg('bootstrap')->getEnvironment(); $exception = $handler->exception; $error = array('message' => $exception->getMessage(), 'code' => $exception->getCode(), 'file' => $exception->getFile(), 'line' => $exception->getLine()); $errors = $exception->getTrace(); $traceArray = array(); if (is_array($errors)) { foreach ($errors as $key => $val) { $traceArray[$key]['file'] = $val['file']; $traceArray[$key]['line'] = $val['line']; $traceArray[$key]['class'] = $val['class']; $traceArray[$key]['type'] = $val['type']; $traceArray[$key]['function'] = $val['function']; } } if (strtolower($env) === 'production') { // Convert array to string format $errorMessage = print_r($error, true); $traceMessage = print_r($traceArray, true); $log = Gene::getParams('log'); $log->write($errorMessage)->write($traceMessage); } else { $this->view->assign('traces', $traceArray); } return $this; }
public function setUp() { $options = array('env' => 'testing', 'resources' => array('Cache', 'Config', 'Path')); $path = GENE_APP_PATH; Gene::app($path, $options); }
/** * Get validator * * @param mixed $name Validator class name * @param string $appmessage Application message file name * @access public * @return mixed Validation class */ public function getValidator($name, $appmessage = 'message.ini') { $system = $this->getSystemTranslate(); $app = $this->getTranslate($appmessage); $valid = Gene::load($name); $valid->setValidatorTranslate($system)->setAppTranslate($app); $this->_apptranslate = $app; return $valid; }
public function test呼び出したモデルをプロパティにキャッシュする() { require_once 'var/Test/ModelMock.php'; $instance = Gene::load('Test_Service_ModelMock'); $model = $instance->getDao('Test_Service_Zend'); $object = $instance->getInstances(); $this->assertSame($model, $object['Test_Service_Zend']); }