Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

367
Vistas
Update PHPunit Xampp

This morning, I realized that the version of PHPUnit supplied with Xampp has been deprecated for quite a while... . The version 3.7.21. installed in Xampp, but the actual version (at the time of this writing) is 6.0.13.

I tried some solution proposed on google (all old 5 years + solution), including

  • https://wehuberconsultingllc.com/wordpress/2007/08/18/updating-phpunit-on-xampp/
  • How to configure PhpUnit in Xampp?
  • http://www.righthandedmonkey.com/2012/09/setting-up-phpunit-with-xampp.html
  • http://forum.kohanaframework.org/discussion/7346/installing-phpunit-on-windows-xampp/p1
  • ...

In any case, pear doesn't seem a viable solution. Is there a simple way to update PHPUnit in Xampp?

about 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Actually, it can be updated in three simple steps:

  1. Download the last version of PHPUnit here: https://phpunit.de/index.html
  2. Copy “phpunit.phar” in “C:\xampp\php”.
  3. In the file: “phpunit.bat”, update the following line: "%PHPBIN%" "C:\xampp\php\phpunit" %* to : "%PHPBIN%" "C:\xampp\php\phpunit.phar" %*

You don't need to restart apache.

Additional note: In your tests, you will need to replace: phpunit_framework_testcase by: TestCase

And include: use PHPUnit\Framework\TestCase at the top of your test files.

PHPunit in windows CMD

Of course, the test suites are still compatible on my production server (centos7, follow the official documentation to update on Linux https://phpunit.de/getting-started.html).

PHPUnit in Linux CMD

about 4 years ago · Santiago Trujillo Denunciar

0

Thanks, Working OK with XAMPP v7.3.7

The latest phpunit.phar can be downloaded from: https://phar.phpunit.de

  • XAMPP Included Version = PHPUnit 3.7.21 by Sebastian Bergmann.
  • DOWNLOADED Version (2019-08-11) = PHPUnit 8.3.4 by Sebastian Bergmann and contributors.
about 4 years ago · Santiago Trujillo Denunciar

0

I had similar problem and found different solution. I have install phpunit with composer globaly

composer global require phpunit/phpunit "^9"

and localy in my project (both same version "^9").

cd C:/fullpath/to/myproject

composer require-dev phpunit/phpunit "^9"

However for some reason phpunit was triggered from the xampp folder.. so what I did was removed

phpunit
phpunit.bat

From C:\xampp\php and it worked for me.

Just remember to set composer path to your env path in Windows.

Now you can create phpunit.xml in you project root (here is what worked for me):

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.0/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
         testdox="true"
         verbose="false"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         forceCoversAnnotation="true"
         processIsolation="false"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         stopOnRisky="false">
         
    <testsuites>
        <testsuite name="default">
            <directory suffix="Test.php">tests</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">src</directory>
        </whitelist>
    </filter>
</phpunit>

Then just cd to my root and run phpunit in my terminal to run all my tests from the tests folder

Hope you will find this information helpfull enter image description here *Editor: Hypper.js - using Git Bash on Windows 10 (incase you wonder)

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda