attempt to get baked code output closer to phpcs standard

This commit is contained in:
AD7six 2012-04-30 16:44:46 +02:00
parent 9001844396
commit d1f522e53a
3 changed files with 16 additions and 4 deletions

View file

@ -25,6 +25,7 @@
*
*/
class <?php echo $model; ?>Fixture extends CakeTestFixture {
<?php if ($table): ?>
/**
* Table name
@ -32,6 +33,7 @@ class <?php echo $model; ?>Fixture extends CakeTestFixture {
* @var string
*/
public $table = '<?php echo $table; ?>';
<?php endif; ?>
<?php if ($import): ?>
/**
@ -40,8 +42,8 @@ class <?php echo $model; ?>Fixture extends CakeTestFixture {
* @var array
*/
public $import = <?php echo $import; ?>;
<?php endif; ?>
<?php endif; ?>
<?php if ($schema): ?>
/**
* Fields
@ -49,8 +51,8 @@ class <?php echo $model; ?>Fixture extends CakeTestFixture {
* @var array
*/
public $fields = <?php echo $schema; ?>;
<?php endif;?>
<?php endif;?>
<?php if ($records): ?>
/**
* Records
@ -58,5 +60,6 @@ class <?php echo $model; ?>Fixture extends CakeTestFixture {
* @var array
*/
public $records = <?php echo $records; ?>;
<?php endif;?>
}

View file

@ -36,6 +36,7 @@ foreach (array('hasOne', 'belongsTo', 'hasMany', 'hasAndBelongsToMany') as $asso
?>
*/
class <?php echo $name ?> extends <?php echo $plugin; ?>AppModel {
<?php if ($useDbConfig != 'default'): ?>
/**
* Use database config
@ -43,11 +44,12 @@ class <?php echo $name ?> extends <?php echo $plugin; ?>AppModel {
* @var string
*/
public $useDbConfig = '<?php echo $useDbConfig; ?>';
<?php endif;?>
<?php if ($useTable && $useTable !== Inflector::tableize($name)):
$table = "'$useTable'";
echo "/**\n * Use table\n *\n * @var mixed False or table name\n */\n";
echo "\tpublic \$useTable = $table;\n";
echo "\tpublic \$useTable = $table;\n\n";
endif;
if ($primaryKey !== 'id'): ?>
/**
@ -56,6 +58,7 @@ if ($primaryKey !== 'id'): ?>
* @var string
*/
public $primaryKey = '<?php echo $primaryKey; ?>';
<?php endif;
if ($displayField): ?>
/**
@ -64,6 +67,7 @@ if ($displayField): ?>
* @var string
*/
public $displayField = '<?php echo $displayField; ?>';
<?php endif;
if (!empty($validate)):

View file

@ -29,6 +29,7 @@ App::uses('<?php echo $dependency[0]; ?>', '<?php echo $dependency[1]; ?>');
*
*/
class Test<?php echo $fullClassName; ?> extends <?php echo $fullClassName; ?> {
/**
* Auto render
*
@ -55,13 +56,16 @@ class Test<?php echo $fullClassName; ?> extends <?php echo $fullClassName; ?> {
*
*/
class <?php echo $fullClassName; ?>Test extends CakeTestCase {
<?php if (!empty($fixtures)): ?>
/**
* Fixtures
*
* @var array
*/
public $fixtures = array('<?php echo join("', '", $fixtures); ?>');
public $fixtures = array(
'<?php echo join("',\n\t\t'", $fixtures); ?>'
);
<?php endif; ?>
/**
@ -96,5 +100,6 @@ class <?php echo $fullClassName; ?>Test extends CakeTestCase {
public function test<?php echo Inflector::camelize($method); ?>() {
}
<?php endforeach;?>
}