Only run phpunit from a specific configuration file

i want to not simply run phpunit but run it from a specific configuration file.

regarding to the documentation: circleci runs phpunit if phpunit.xml exists in the repo

what i have tried:
1: remove the file manually
2: ignoring the file with git.

i do still experience it runs from the main configuration file.
is there any way i can tell my builds not to run from the phpunit.xml configuration file?

thanks

I believe you want to override the default tests like so:

test:
  override:
    - phpunit --configuration filename.xml
1 Like

and that work perfectly

my problem is that is still runs phpunit from the main config file => phpunit.xml wich i dont want it to run

my circle configuration:

test:
  override:
    - vendor/bin/phpunit --configuration testing-circle.xml

Try adding --no-configuration as well

Ref: https://phpunit.de/manual/current/en/phpunit-book.html#textui.clioptions

i have now tried following

test:
  override:
    - vendor/bin/phpunit --configuration testing-circle.xml --no-configuration

and it still runs vendor/bin/phpunit and hitting the phpunit.xml file after the above command

When you say you have tried removing it, how does it still run? Is there any reason to keep the file if you don’t plan to use it?

I’m assuming this is not a public project, but is there any chance you can share the full circle.yml file?

thats right i have tried to do a rm phpunit.xml on the build in case that it wouldn’t use that file and not run vendor/bin/phpunit command

machine:

 pre:
   - curl -s https://packagecloud.io/install/repositories/circleci/trusty/script.deb.sh | sudo bash
   - sudo apt-get install circleci-php-7.0.4=4

 php:
   version: 7.0.4

 services:
   - mysql

 hosts:
   athliit.app: 127.0.0.1

dependencies:
  override:
    - composer install
    - cp ~/athliit/.env.testing ~/athliit/.env
    - export DEBIAN_FRONTEND=noninteractive
    - curl -sSL https://s3.amazonaws.com/circle-downloads/install-mysql5.7-circleci.sh | sh
    - php artisan migrate --env=testing
    - php artisan db:seed --class=TestingDatabaseSeeder

test:
  override:
   - vendor/bin/phpunit --configuration testing-circle.xml --no-configuration

I find I actually don’t have an example of phpunit handy. I’m starting to wonder if this is a bug with the search path of phpunit.

Give this a try

  • phpunit --configuration testing-circle.xml --no-configuration

I’m pretty sure that the path isn’t required to run it, in fact I think it might come installed. In the meanwhile, let me try to get a test up and running.

Edit: Here is a working example. It is only running circle-phpunit.xml
https://circleci.com/gh/drazisil/fun-with-circle/149

1 Like

i found out a way

i used cp ~/projectfolder/circle-phpunit.xml ~/projectfolder/phpunit.xml
and works perfectly

again many thanks for your help anyways

cheers