Exemple #1
0
 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');
 }
Exemple #2
0
 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'));
 }
Exemple #3
0
 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';
 }
Exemple #4
0
 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));
 }
Exemple #5
0
 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);
 }
Exemple #6
0
 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');
 }
Exemple #7
0
 /**
  * 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;
 }
Exemple #8
0
 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']);
 }