Skip to content

thienhv-dev/unit_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unit Test Project

Giới thiệu

Đây là source code mẫu cho hệ thống xử lý đơn hàng với các lớp dịch vụ, enum, và unit test sử dụng PHPUnit.

Yêu cầu hệ thống

  • PHP >= 7.4
  • Composer
  • PHPUnit >= 9.x

Cài đặt

  1. Clone repository:

    git clone <repository-url>
    cd unit_test
  2. Cài đặt Composer: Nếu chưa có Composer, cài đặt tại https://getcomposer.org/

  3. Cài đặt dependencies:

    composer install

Cấu trúc thư mục

  • app/ - Chứa mã nguồn chính (các class, enum, service)
  • tests/ - Chứa các file unit test
  • coverage/ - Báo cáo coverage sau khi chạy test
  • phpunit.xml - File cấu hình PHPUnit

Chạy Unit Test

./vendor/bin/phpunit --configuration phpunit.xml

Sinh báo cáo Coverage (HTML)

./vendor/bin/phpunit --coverage-html coverage

Sau khi chạy, mở file coverage/index.html để xem báo cáo coverage.

Ghi chú

  • Đảm bảo PHP và Composer đã được cài đặt đúng phiên bản.
  • Có thể cần cấp quyền thực thi cho file PHPUnit: chmod +x ./vendor/bin/phpunit

Liên hệ

Mọi thắc mắc vui lòng liên hệ chủ repository.

About

unit_test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages