Question

I'm attempting to install phpunit via ansible with a view to running it on a vagrant vm, however I keep receiving an error in the build process:

Channel "pear.phpunit.de" is not initialized, use "pear channel-discover pear.phpunit.de" to initializeor pear config-set auto_discover 1 unknown channel "pear.phpunit.de" in "pear.phpunit.de/PHPUnit" invalid package name/package file "pear.phpunit.de/PHPUnit" install failed

The ansbile config looks something like:

- name: Install phpunit
  command: pear channel-discover pear.phpunit.de
  command: pear channel-discover pear.symfony-project.com
  command: pear channel-discover components.ez.no
  command: pear channel-discover pear.symfony.com
  command: pear update-channels
  command: pear upgrade-all
  command: pear install pear.symfony.com/Yaml
  command: pear install --alldeps pear.phpunit.de/PHPUnit 
  command: pear install --force --alldeps pear.phpunit.de/PHPUnit

Has anyone managed to successfully get phpunit to install via ansible?

Était-ce utile?

La solution

Since the pear installer for PHPUnit is no longer supported. If you want to install PHPUnit with ansible you could do:

 get_url: url=https://phar.phpunit.de/phpunit.phar dest=/usr/local/bin/phpunit mode=555 

Autres conseils

The playlist snippet you pasted is incorrect–it will only run the first command because you can't specify multiple commands in a single task. Try this list of tasks, instead:

 - command: pear channel-discover pear.phpunit.de
 - command: pear channel-discover pear.symfony-project.com
 - command: pear channel-discover components.ez.no
 - command: pear channel-discover pear.symfony.com
 - command: pear update-channels
 - command: pear upgrade-all
 - command: pear install pear.symfony.com/Yaml
 - command: pear install --alldeps pear.phpunit.de/PHPUnit 
 - command: pear install --force --alldeps pear.phpunit.de/PHPUnit

You don't need to specify a - name for every task, but you do have to use the hyphen before each command to signal to Ansible that this is a new task.

More infor about no longer supported PEAR installation method:

https://github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method

Russell's method works fine.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top