public function testGenerate() { $testLocation = 'tmp/gen'; Skeleton::setTestLocation($testLocation); $mockClass = '\\mock\\Phantom'; $file = 'tests/mock/Phantom.php'; require_once $file; Skeleton\Reverse::setProviderClass($mockClass); $file = 'tmp/gen/Administrator/Callrecords/ListTest.php'; if (file_exists($file)) { unlink($file); } static::assertFileNotExists($file); Skeleton::generate(); static::assertFileExists($file); static::assertFileEquals('tests/fixtures/code/listTest.fixture', $file); }
/** * @return string */ public function getPhpName() { if (method_exists($this, 'getName') && $this->getName()) { $name = $this->getName(); } elseif ($this->getId()) { $name = $this->getId(); } elseif (method_exists($this, 'getLabel') && $this->getLabel()) { $name = $this->getLabel(); } else { $name = 'undefined' . Skeleton::getVarName(); //throw new \LogicException('cant determine name'); } $name = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $name); return '$' . str_replace(['-', '.', ' ', ']', '['], '_', $name); }