Jamm\Memory\Tests\TestMethodsGenerator::getCodeForMethod PHP 메소드

getCodeForMethod() 보호된 메소드

protected getCodeForMethod ( ReflectionMethod $Method )
$Method ReflectionMethod
    protected function getCodeForMethod(\ReflectionMethod $Method)
    {
        $code = "\tpublic function test_" . $Method->name . '()' . PHP_EOL . "\t{\n";
        $arguments = $Method->getParameters();
        if (count($arguments) == 0) {
            $code .= "\t\t" . '$this->assertEquals("' . strtolower(str_replace('_', ' ', $Method->name)) . '", $this->redis->' . $Method->name . '());' . PHP_EOL;
        } else {
            $code .= "\t\t//TODO: implement test\n";
            $params = [];
            foreach ($arguments as $Argument) {
                $params[] = strtolower($Argument->name);
            }
            $code .= "\t\t" . '$this->assertEquals("' . strtolower(str_replace('_', ' ', $Method->name)) . ' ';
            $code .= implode(' ', $params);
            $code .= '", $this->redis->' . $Method->name . '("' . implode('", "', $params) . '"));' . PHP_EOL;
        }
        $code .= "\t}\n";
        return $code;
    }