mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 10:07:12 +00:00
Add test for method default values with special chars
This commit is contained in:
@@ -47,6 +47,21 @@ class ExampleTest extends TestCase
|
||||
$this->assertEquals(['$last', '$first = \'Barry\'', '...$middle'], $method->getParamsWithDefault(false));
|
||||
$this->assertEquals(true, $method->shouldReturn());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test special characters in method
|
||||
*/
|
||||
public function testSpecialChars()
|
||||
{
|
||||
$reflectionClass = new \ReflectionClass(ExampleClass::class);
|
||||
$reflectionMethod = $reflectionClass->getMethod('setSpecialChars');
|
||||
|
||||
$method = new Method($reflectionMethod, 'Example', $reflectionClass);
|
||||
$this->assertEquals('$chars', $method->getParams(true));
|
||||
$this->assertEquals(['$chars'], $method->getParams(false));
|
||||
$this->assertEquals('$chars = \'$\\\'\\\\\'', $method->getParamsWithDefault(true));
|
||||
$this->assertEquals(['$chars = \'$\\\'\\\\\''], $method->getParamsWithDefault(false));
|
||||
}
|
||||
}
|
||||
|
||||
class ExampleClass
|
||||
@@ -60,4 +75,9 @@ class ExampleClass
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function setSpecialChars($chars = "\$'\\")
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user