public function testClassifyAndTableizeFunction() { $start = 'auth_user'; $middle = 'AuthUser'; $this->assertEquals($middle, Centurion_Inflector::classify($start)); $this->assertEquals($start, Centurion_Inflector::tableize($middle)); }
/** * * @param string $key * @return Centurion_Signal_Abstract */ public static function factory($key) { $registered = self::registry($key); if (is_null($registered)) { $className = Centurion_Inflector::classify($key); $className = self::getPluginLoader()->load($className); $registered = new $className(); self::register($key, $registered); } return $registered; }
/** * Generic test for findOneBy method. */ public function testFindOneBy() { return; $modelId = $this->_model->insert($this->_getData()); $this->assertFalse(null === $modelId); if (is_array($modelId)) { $this->_data = call_user_func_array(array($this->_model, 'find'), array_values($modelId))->current()->toArray(); } else { $this->_data = $this->_model->find($modelId)->current()->toArray(); } foreach ($this->_getData() as $key => $value) { if (null === $value) { continue; } $method = 'findOneBy' . Centurion_Inflector::classify($key); $modelRow = $this->_model->{$method}($value); $this->assertEquals($this->_getData(), $modelRow->toArray(), sprintf('Method %s of %s object doesn\'t return the expected values', $method, get_class($this->_model))); } }
/** * Retrieve the class name for a registry name. * * @param string $registryName */ public static function getClassName($registryName) { $classArr = explode('/', trim($registryName)); $className = sprintf('%s_Model_DbTable_%s', ucfirst($classArr[0]), Centurion_Inflector::classify($classArr[1])); return $className; }