Skip to content
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

phpunit.bat on 3.5.0RC1 doesn't work #4

Closed
mbeccati opened this issue Aug 10, 2010 · 5 comments
Closed

phpunit.bat on 3.5.0RC1 doesn't work #4

mbeccati opened this issue Aug 10, 2010 · 5 comments

Comments

@mbeccati
Copy link
Contributor

When running phpunit.bat on a freshly installed 3.5.0RC1 I get an error like "Files not expected" (sorry if it's not the real error, my OS is not english). A bit of debugging showed that the path environment variable PHPBIN was had double "double quotes". I'm not a .bat expert but here's one that works for me:

if "%PHPBIN%" == "" set PHPBIN=C:\Program Files (x86)\PHP\php.exe
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "C:\Program Files (x86)\php\phpunit" %*

@sebastianbergmann
Copy link
Owner

  • Did you use the PEAR Installer to install PHPUnit?
  • Did the PEAR Installer correctly expand the @php_bin@ and @bin_dir@ placeholders?

@mbeccati
Copy link
Contributor Author

Yes, installed via Pear, and expansion worked correctly. I can't remember any similar issues with 3.4, but of course I can test that as well.

@mbeccati
Copy link
Contributor Author

Basically the issue on my system is that the PHPBIN env var is not set. At the first run its content becomes "C:\Program Files (x86)\PHP\php.exe" and the following run will execute:

if ""C:\Program Files (x86)\PHP\php.exe"" == "" set ...

which apparently isn't properly formatted. The patch fixes the issue by making sure that the PHPBIN variable doesn't contain double quotes, while adding them at execution time.

I took some time to clone the git repo and prepare a patch, you'll find it below:

[root@aperol ~/compile/phpunit]# git diff origin/master master
diff --git a/dbunit.bat b/dbunit.bat
index 70da6b5..02a70f9 100644
--- a/dbunit.bat
+++ b/dbunit.bat
@@ -34,10 +34,10 @@ REM ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 OF THE
 REM POSSIBILITY OF SUCH DAMAGE.
 REM

-if "%PHPBIN%" == "" set PHPBIN="@php_bin@"
+if "%PHPBIN%" == "" set PHPBIN=@php_bin@
 if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
 GOTO RUN
 :USE_PEAR_PATH
-set PHPBIN="%PHP_PEAR_PHP_BIN%"
+set PHPBIN=%PHP_PEAR_PHP_BIN%
 :RUN
-%PHPBIN% "@bin_dir@\dbunit" %*
+"%PHPBIN%" "@bin_dir@\dbunit" %*
diff --git a/phpunit.bat b/phpunit.bat
index bd70a3d..29208ec 100644
--- a/phpunit.bat
+++ b/phpunit.bat
@@ -34,10 +34,10 @@ REM ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 OF THE
 REM POSSIBILITY OF SUCH DAMAGE.
 REM

-if "%PHPBIN%" == "" set PHPBIN="@php_bin@"
+if "%PHPBIN%" == "" set PHPBIN=@php_bin@
 if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
 GOTO RUN
 :USE_PEAR_PATH
-set PHPBIN="%PHP_PEAR_PHP_BIN%"
+set PHPBIN=%PHP_PEAR_PHP_BIN%
 :RUN
-%PHPBIN% "@bin_dir@\phpunit" %*
+"%PHPBIN%" "@bin_dir@\phpunit" %*

@sebastianbergmann
Copy link
Owner

Can you please for PHPUnit, apply your patch, commit it, push it, and send me a pull request? That way author information is not lost and you get credit for your fix. Thanks!

@sebastianbergmann
Copy link
Owner

Merged, thanks.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants