-
Notifications
You must be signed in to change notification settings - Fork 11
Add --custom-function parameter to check #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
72e3c10
3940349
a43368b
73dcc40
5c74a77
a3a361b
43d823b
6e2a072
38513d0
5495e34
e537cda
66a65a8
eee8857
417f968
95e0158
f58fae3
562b7aa
5847d7e
a29a7eb
f79cba3
f7886fd
d6cf4df
e779ac4
5941fae
252cd39
0f7b965
52d9da7
6476f7b
10fecd3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
/vendor/ | ||
/composer.lock | ||
/composer.lock |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, why isn't this commit included in implementation? I mean that will be better for people who read Git history :) |
||
|
||
use JakubOnderka\PhpVarDumpCheck; | ||
|
||
class CustomFunctionTest extends PHPUnit_Framework_TestCase | ||
{ | ||
|
||
public function testCheck_noDebugFunction() | ||
{ | ||
$settings = new PhpVarDumpCheck\Settings(); | ||
|
||
$settings->functionsToCheck = array_merge($settings->functionsToCheck, array( | ||
'functionName1' | ||
)); | ||
|
||
$uut = new PhpVarDumpCheck\Checker($settings); | ||
$content = <<<PHP | ||
<?php | ||
nonDebugFunction1(\$var); | ||
\$i++; | ||
nonDebugFunction2(\$i); | ||
PHP; | ||
$result = $uut->check($content); | ||
$this->assertCount(0, $result); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about add test for none function founded? (I mean when code does not includes |
||
public function testCheck_singleFunction() | ||
{ | ||
$settings = new PhpVarDumpCheck\Settings(); | ||
|
||
$settings->functionsToCheck = array_merge($settings->functionsToCheck, array( | ||
'functionName1' | ||
)); | ||
|
||
$uut = new PhpVarDumpCheck\Checker($settings); | ||
$content = <<<PHP | ||
<?php | ||
functionName1(\$var); | ||
PHP; | ||
$result = $uut->check($content); | ||
$this->assertCount(1, $result); | ||
} | ||
|
||
|
||
public function testCheck_multipleFunction() | ||
{ | ||
$settings = new PhpVarDumpCheck\Settings(); | ||
|
||
$settings->functionsToCheck = array_merge($settings->functionsToCheck, array( | ||
'functionName1', | ||
'functionName2' | ||
)); | ||
|
||
$uut = new PhpVarDumpCheck\Checker($settings); | ||
|
||
$content1 = <<<PHP | ||
<?php | ||
functionName1(\$var); | ||
PHP; | ||
$content2 = <<<PHP | ||
<?php | ||
functionName2(\$var); | ||
PHP; | ||
$content3 = <<<PHP | ||
<?php | ||
functionName1(\$var); | ||
sleep(4); | ||
functionName2(\$var); | ||
PHP; | ||
$result = $uut->check($content1); | ||
$this->assertCount(1, $result); | ||
|
||
$result = $uut->check($content2); | ||
$this->assertCount(1, $result); | ||
|
||
$result = $uut->check($content3); | ||
$this->assertCount(2, $result); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit can be squash with implementation