コード例 #1
0
 /**
  * getContents()
  *
  * @return string
  */
 public function getContents()
 {
     $filter = new \Zend\Filter\Word\DashToCamelCase();
     $className = $filter->filter($this->_forControllerName) . 'ControllerTest';
     $codeGenFile = new Php\PhpFile(array('requiredFiles' => array('PHPUnit/Framework/TestCase.php'), 'classes' => array(new Php\PhpClass(array('name' => $className, 'extendedClass' => 'PHPUnit_Framework_TestCase', 'methods' => array(new Php\PhpMethod(array('name' => 'setUp', 'body' => '        /* Setup Routine */')), new Php\PhpMethod(array('name' => 'tearDown', 'body' => '        /* Tear Down Routine */'))))))));
     return $codeGenFile->generate();
 }
コード例 #2
0
ファイル: TestLibraryFile.php プロジェクト: nevvermind/zf2
 /**
  * getContents()
  *
  * @return string
  */
 public function getContents()
 {
     $filter = new \Zend\Filter\Word\DashToCamelCase();
     $className = $filter->filter($this->_forClassName) . 'Test';
     $codeGenFile = new FileGenerator();
     $codeGenFile->setRequiredFiles(array('PHPUnit/Framework/TestCase.php'));
     $codeGenFile->setClasses(array(new ClassGenerator($className, null, null, 'PHPUnit_Framework_TestCase', array(), array(), array(new MethodGenerator('setUp', array(), MethodGenerator::FLAG_PUBLIC, '        /* Setup Routine */'), new MethodGenerator('tearDown', array(), MethodGenerator::FLAG_PUBLIC, '        /* Tear Down Routine */')))));
     return $codeGenFile->generate();
 }
コード例 #3
0
 /**
  * @param $name
  * @param SlackConfig $slackConfig
  * @return RandomQuoteInterface
  * @throws \Exception
  */
 public static function createRandomQuoteByName($name, SlackConfig $slackConfig)
 {
     $filter = new \Zend\Filter\Word\DashToCamelCase();
     $className = self::CONCRETE_CLASSES_NAMESPACE . $filter->filter($name) . 'RandomQuote';
     if (!class_exists($className)) {
         throw new \Exception('Missing RandomQuote Class: ' . $className);
     }
     return new $className(self::createSlackBot($slackConfig));
 }
コード例 #4
0
 /** \Zend\Filter\DashToCamelCase() =>  */
 public function index19Action()
 {
     $filter = new \Zend\Filter\Word\DashToCamelCase();
     $input = 'Zend-framework-is-Easy';
     $output = $filter->filter($input);
     echo "<h3>" . $input . "</h3>";
     echo "<h3>" . $output . "</h3>";
     return false;
 }
コード例 #5
0
ファイル: Runner.php プロジェクト: linuxwhy/tiki-1
 private function getPrefixFactory($prefix)
 {
     return function ($functionName) use($prefix) {
         $filter = new Zend\Filter\Word\DashToCamelCase();
         // Workaround Deprecated errors showing from Zend lib
         if (error_reporting() & E_DEPRECATED) {
             $old_error_reporting = error_reporting();
             error_reporting($old_error_reporting - E_DEPRECATED);
         }
         $ucname = $filter->filter(ucfirst($functionName));
         if (isset($old_error_reporting)) {
             error_reporting($old_error_reporting);
         }
         $class = $prefix . $ucname;
         if (class_exists($class)) {
             return new $class();
         }
     };
 }
コード例 #6
0
 /**
  * getContents()
  *
  * @return string
  */
 public function getContents()
 {
     $filter = new \Zend\Filter\Word\DashToCamelCase();
     $className = $filter->filter($this->_projectProviderName) . 'Provider';
     $class = new ClassGenerator($className, null, null, '\\Zend\\Tool\\Project\\Provider\\AbstractProvider');
     $methods = array();
     foreach ($this->_actionNames as $actionName) {
         $methods[] = new MethodGenerator($actionName, array(), MethodGenerator::FLAG_PUBLIC, '        /** @todo Implementation */');
     }
     if ($methods) {
         $class->setMethods($methods);
     }
     $codeGenFile = new \Zend\Code\Generator\FileGenerator();
     $codeGenFile->setClass($class);
     return $codeGenFile->generate();
 }
コード例 #7
0
    /**
     * getContents()
     *
     * @return string
     */
    public function getContents()
    {

        $filter = new \Zend\Filter\Word\DashToCamelCase();

        $className = $filter->filter($this->_projectProviderName) . 'Provider';

        $class = new \Zend\CodeGenerator\Php\PhpClass(array(
            'name' => $className,
            'extendedClass' => '\Zend\Tool\Project\Provider\AbstractProvider'
            ));

        $methods = array();
        foreach ($this->_actionNames as $actionName) {
            $methods[] = new \Zend\CodeGenerator\Php\PhpMethod(array(
                'name' => $actionName,
                'body' => '        /** @todo Implementation */'
                ));
        }

        if ($methods) {
            $class->setMethods($methods);
        }

        $codeGenFile = new \Zend\CodeGenerator\Php\PhpFile(array(
            'classes' => array($class)
            ));

        return $codeGenFile->generate();
    }
コード例 #8
0
 public function getEntityById($nameSize, $entityContextName, $entityContextId)
 {
     $filter = new \Zend\Filter\Word\DashToCamelCase();
     $method = 'id' . $filter->filter($nameSize);
     return \Codeception\Module\Doctrine2::$em->getRepository($entityContextName)->findOneBy(array($method => $entityContextId));
 }