Skip to content

Commit

Permalink
Added a new test to ensure everything is working with a single functi…
Browse files Browse the repository at this point in the history
…on param

git-svn-id: http://svn.php.net/repository/pear/packages/PHP_CodeSniffer/trunk@305978 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
gsherwood committed Dec 5, 2010
1 parent b6b8cc2 commit 0886472
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/Core/File/GetMethodParametersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,36 @@ public function testVariable()
}//end testVariable()


/**
* Verify default value parsing with a single function param.
*
* @return void
*/
public function testSingleDefaultValue()
{
$expected = array();
$expected[0] = array(
'name' => '$var1',
'default' => 'self::CONSTANT',
'pass_by_reference' => false,
'type_hint' => '',
);

$start = ($this->_phpcsFile->numTokens - 1);
$function = $this->_phpcsFile->findPrevious(
T_COMMENT,
$start,
null,
false,
'/* testSingleDefaultValue */'
);

$found = $this->_phpcsFile->getMethodParameters(($function + 2));
$this->assertSame($expected, $found);

}//end testSingleDefaultValue()


/**
* Verify default value parsing.
*
Expand Down Expand Up @@ -242,6 +272,7 @@ public function testDefaultValues()
/* testPassByReference */ function passByReference(&$var) {}
/* testArrayHint */ function arrayHint(array $var) {}
/* testVariable */ function variable($var) {}
/* testSingleDefaultValue */ function defaultValue($var1=self::CONSTANT) {}
/* testDefaultValues */ function defaultValues($var1=1, $var2='value') {}
/* testTypeHint */ function typeHint(foo $var1, bar $var2) {}
// @codingStandardsIgnoreEnd
Expand Down

0 comments on commit 0886472

Please sign in to comment.