FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=18651&edit=1

ID: 18651
Updated by: [email protected]
Reported By: gaurav dot [email protected]
Summary: PHPunit Test cases for custom standards are not
working on Windows.
-Status: Feedback
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Windows/Linux
Package Version: 1.3.0
PHP Version: 5.3.6
Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Feedback
+Status: Closed
Assuming they work. If not, please reopen.


Previous Comments:
------------------------------------------------------------------------

[2012-06-18 08:38:43] squiz

-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
I've committed a fix to the git repo. Along with a few other changes
made recently,
the tests run ok for me on Windows now. Please try them out if you can.
https://github.com/squizlabs/PHP_CodeSniffer/commit/97a8219d26fba9ee9b323d904
c47bff44223bd77

------------------------------------------------------------------------

[2012-06-12 16:05:22] aoudin

I found a similar bug and the fix is quite simple, you have to edit
patch the file CodeSniffer.php,

this only occured on windows because of directory separator mixed with /
and \

see Patches
http://pear.php.net/bugs/bug.php?id=18651&edit=12&patch=patch_fix_path_bug_windows&revision=latest

------------------------------------------------------------------------

[2012-06-12 16:01:32] aoudin

Added #patch
bug:18651;patch:patch_fix_path_bug_windows;revision:1339513292;.

------------------------------------------------------------------------

[2011-07-05 13:59:42] ggaurav123

Description:
------------
I have created Unit testcases for my custom standard rules.I have
followed the all the instruction given in codesniffer test class
library.Also I have taken refernce from folowing sites.

http://no-mercy.h1236134.stratoserver.net/trac/libIwParsers/browser/trunk/3rdParty/PHP_CodeSniffer-1.2.0/CodeSniffer/Standards/PEAR/Tests/


&

http://blueparabola.com/blog/coding-standard-analysis-using-phpcodesniffer

When I executed test cases on windows envoirment, it return blank result
set as follows.

C:\Program Files\PHP>phpunit PEAR\PHP\tests\AllTests.php

PHPUnit 3.5.14 by Sebastian Bergmann.

........................................

Time: 3 seconds, Memory: 12.25Mb

OK (40 tests, 146 assertions)

Warning: Deprecated PHPUnit features are being used 2 times!
Use --verbose for more information.

But when I executed same test cases on linux enviorment ,it returns
expected result set.

When I checked the AbstractSniffUnitTest file, I found that there is
mapping from Test file to Sniff file.
When file being mapped, the file path contains the mixing of forward &
backward slashes on windows.
because of that it fails at following condition

foreach ($di as $file) {
$path = $file->getPathname();
if (substr($path, 0, strlen($testFileBase)) ===
$testFileBase) {
if ($path !== $testFileBase.'php') {
$testFiles[] = $path;
}
}
}


Is there any way to resolve this issue on windows?

------------------------------------------------------------------------

[2011-07-05 13:58:48] ggaurav123

Description:
------------
I have created Unit testcases for my custom standard rules.I have
followed the all the instruction given in codesniffer test class
library.Also I have taken refernce from folowing sites.

http://no-mercy.h1236134.stratoserver.net/trac/libIwParsers/browser/trunk/3rdParty/PHP_CodeSniffer-1.2.0/CodeSniffer/Standards/PEAR/Tests/


&

http://blueparabola.com/blog/coding-standard-analysis-using-phpcodesniffer

When I executed test cases on windows envoirment, it return balnk result
set as follows.

C:\Program Files\PHP>phpunit PEAR\PHP\tests\AllTests.php

PHPUnit 3.5.14 by Sebastian Bergmann.

........................................

Time: 3 seconds, Memory: 12.25Mb

OK (40 tests, 146 assertions)

Warning: Deprecated PHPUnit features are being used 2 times!
Use --verbose for more information.

But when I executed same test cases on linux enviorment ,it returns
expected result set.

When I checked the AbstractSniffUnitTest file, I found that there is
mapping from Test file to Sniff file.
When file being mapped, the file path contains the mixing of forward &
backward slashes on windows.
because of that it fails at following condition

foreach ($di as $file) {
$path = $file->getPathname();
if (substr($path, 0, strlen($testFileBase)) ===
$testFileBase) {
if ($path !== $testFileBase.'php') {
$testFiles[] = $path;
}
}
}


Is there any way to resolve this issue on windows?

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJul 10, '12 at 12:22a
activeJul 10, '12 at 12:22a
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2023 Grokbase