本文整理汇总了PHP中Psc\Code\Code::mapClassToFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Code::mapClassToFile方法的具体用法?PHP Code::mapClassToFile怎么用?PHP Code::mapClassToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psc\Code\Code
的用法示例。
在下文中一共展示了Code::mapClassToFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
$jsonc = JSONConverter::create();
$root = Dir::factoryTS(__DIR__)->sub('../');
$json = $root->getFile($input->getArgument('file'))->getContents();
$json = '[' . str_replace('}{', '},{', $json) . ']';
try {
$report = $jsonc->parse($json);
} catch (\Webforge\Common\JS\JSONParsingException $e) {
$parser = new JsonParser();
$parsingException = $parser->lint($root->getFile('output.json')->getContents());
throw $parsingException;
}
$toRun = array();
foreach ($report as $event) {
if ($event->event === 'test' && ($event->status === 'fail' || $event->status === 'error')) {
$testFQN = $event->suite;
$file = Code::mapClassToFile($testFQN, $root->sub('tests/'));
$file->getDirectory()->resolvePath();
$toRun[(string) $file] = (string) $file;
}
}
$toRun = array_filter($toRun);
$output->writeln(count($toRun) . ' tests have failed');
$root->getFile('to-run.json')->writeContents($jsonc->stringify($toRun));
});
$createCommand('tests:to-run', array(), function ($input, $output, $command) {
$jsonc = JSONConverter::create();
$root = Dir::factoryTS(__DIR__)->sub('../');
$toRun = (array) $jsonc->parseFile($root->getFile('to-run.json'));
$leftToRun = array();
foreach ($toRun as $filename) {
$leftToRun[] = $filename;
示例2: getTestFile
/**
* @return Webforge\Common\System\File
*/
public function getTestFile()
{
/* zuerst setzen wir den ns in einen relativen pfad um */
$file = Code::mapClassToFile($this->class->getName(), NULL);
/* entfernt das erste und zweite verzeichnis (das erste ist der .)*/
$file->getDirectory()->slice(2);
/* wir fügen den rest des relativen Verzeichnisses an das tests-Verzeichnis an */
$dir = clone $this->dir;
$dir->append($file->getDirectory());
$file = new File($dir, $this->class->getClassName() . 'Test');
$file->setExtension('.php');
return $file;
}
示例3: getClassFile
/**
* @return File
*/
public function getClassFile($className)
{
if ($className instanceof GClass) {
$className = $className->getFQN();
}
return Code::mapClassToFile($className, $this->getClassPath()->up());
}
示例4: writeRepository
/**
* @return File
*/
public function writeRepository(File $file = NULL, $overwrite = NULL)
{
$gClass = $this->getRepositoryGClass();
$this->classWriter->setClass($gClass);
if (!isset($file)) {
$autoLoadRoot = $this->module->getEntitiesPath()->sub(str_repeat('../', count(explode('\\', $this->module->getEntitiesNamespace()))))->resolvePath();
$file = Code::mapClassToFile($gClass->getFQN(), $autoLoadRoot);
}
$this->classWriter->write($file, array(), $overwrite);
$this->classWriter->syntaxCheck($file);
return $file;
}
示例5: testMapClassToFile_withoutDirParam
/**
* @depends testNamespaceToPath_withoutDirParam
*/
public function testMapClassToFile_withoutDirParam()
{
$ds = DIRECTORY_SEPARATOR;
$this->assertEquals(getcwd() . $ds . 'Psc' . $ds . 'Code' . $ds . 'Generate' . $ds . 'myClass.php', (string) Code::mapClassToFile('\\Psc\\Code\\Generate\\myClass')->resolvePath());
}