Skip to content
Mitsuru Mutaguchi edited this page May 5, 2025 · 12 revisions

phpunitは、テストツールです。

前作業

  1. Connect-CMSの最新版にアップデートする
  2. 開発ライブラリ(phpunit等)を入れる

phpunit実行

// プロジェクトルートへ移動
cd /path/to/connect-cms

// phpunit実行
./vendor/bin/phpunit

composerコマンドでphpunit実行(上記と同等)

// プロジェクトルートへ移動
cd /path/to/connect-cms

// composerコマンドでphpunit実行
composer phpunit
// or
php composer.phar phpunit

// composerコマンドで任意のファイルでphpunit実行(下記パス指定は例です。任意に変更してください)
// (windowsの場合)
composer phpunit -- tests\Unit\Migration\MigrationTraitTest.php
// (linuxの場合)
composer phpunit -- tests/Unit/Migration/MigrationTraitTest.php

artisanコマンドでphpunit実行

// プロジェクトルートへ移動
cd /path/to/connect-cms

// artisanコマンドでphpunit実行
php artisan test

// artisanコマンドで任意のファイルのphpunit実行(下記パス指定は例です。任意に変更してください)
// (windowsの場合)
php artisan test tests\Unit\Migration\MigrationTraitTest.php
// (linuxの場合)
php artisan test tests/Unit/Migration/MigrationTraitTest.php

// artisanコマンドで任意のディレクトリをまとめてphpunit実行(下記パス指定は例です。任意に変更してください)
// (windowsの場合)
php artisan test tests\Unit\Migration\
// (linuxの場合)
php artisan test tests/Unit/Migration/

テストケースディレクトリ

参考リンク

Clone this wiki locally