6

Install PHPUnit on CentOS 7 / CentOS 8 & Fedora 34/33/32/31/30

 2 years ago
source link: https://computingforgeeks.com/how-to-install-phpunit-on-centos-fedora/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
CentOS 8 & Fedora 34/33/32/31/30

Are you looking for an easy way to install PHPUnit on CentOS 7 / CentOS 8 & Fedora 34/33/32/31/30/29?. PHPUnit is a unit testing framework for PHP applications. It is an instance of the xUnit architecture for unit testing frameworks and it became popular with JUnit. PHPUnit requires PHP dom and json , pcrereflection and spl extensions.

Step 1: Add Remi repository

PHPUnit package for CentOS 7/8 will be pulled from Remi repository which is not readily available on either system. Add it manually using the commands shared below.

CentOS 8:

sudo dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo dnf -y install dnf-utils
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

CentOS 7:

sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install epel-release
sudo yum -y install yum-utils

Fedora:

# Fedora 34
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-34.rpm
sudo dnf -y install dnf-utils

# Fedora 33
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-33.rpm
sudo dnf -y install dnf-utils

# Fedora 32
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-32.rpm
sudo dnf -y install dnf-utils

# Fedora 31
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-31.rpm
sudo dnf -y install dnf-utils

# Fedora 30
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-30.rpm
sudo dnf -y install dnf-utils

# Fedora 29
sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-29.rpm
sudo dnf -y install dnf-utils

Step 2: Install PHPUnit on CentOS 7 / CentOS 8 / Fedora 31/30/29

Let’s install the latest PHPUnit and required extensions.

CentOS 8 / Fedora:

sudo dnf module install php:7.4
sudo dnf --enablerepo=remi -y install phpunit9

CentOS 7:

sudo yum-config-manager --disable remi-php54
sudo yum-config-manager --enable remi-php74
sudo yum --enablerepo=remi -y install phpunit9

View more information on the installed package.

$ rpm -qi phpunit9
Name        : phpunit9
Version     : 9.5.6
Release     : 1.el7.remi
Architecture: noarch
Install Date: Mon 12 Jul 2021 05:25:19 PM UTC
Group       : Unspecified
Size        : 1411129
License     : BSD
Signature   : DSA/SHA1, Wed 23 Jun 2021 07:57:03 AM UTC, Key ID 004e6f4700f97f56
Source RPM  : phpunit9-9.5.6-1.el7.remi.src.rpm
Build Date  : Wed 23 Jun 2021 07:56:21 AM UTC
Build Host  : builder.remirepo.net
Relocations : (not relocatable)
Packager    : Remi Collet
Vendor      : Remi's RPM repository <https://rpms.remirepo.net/>
URL         : https://github.com/%{gh_vendor}/phpunit
Bug URL     : https://forum.remirepo.net/
Summary     : The PHP Unit Testing framework version 9

Visit PHPUnit Documentation page to get started.

Video Courses To Learn PHP Web Programming:

More content:

Best CCNP R&S Certification Preparation books

Best Kubernetes Study books

Best Linux Books for Beginners & Experts


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK