[PEAR-BUG] Bug #18651 [Opn]: PHPunit Test cases for custom standards are not working on Windows.

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=18651&edit=1

 ID:               18651
 Updated by:       [email protected]
 Reported By:      gaurav dot deshmukh123 at gmail dot com
 Summary:          PHPunit Test cases for custom standards are not
                    working on Windows.
 Status:           Open
 Type:             Bug
 Package:          PHP_CodeSniffer
 Operating System: Windows/Linux
 Package Version:  1.3.0
 PHP Version:      5.3.6
 Roadmap Versions: 
 New Comment:

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?


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

[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?

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


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18651&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.