1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PhpStorm(on Windows10) 基本設定メモ(4) - PHPUnit設定

Last updated at Posted at 2016-09-29

$sin^{-1}x$番煎じのメモ

PHPUnit設定(Windowsに導入)

software version
PhpStorm v2016.02

Composer install

本記事ではPHPUnitはComposer経由で利用します(手動でダウンロードしても勿論できますが)

Composer Getting Started
Composer-Setup.exeをダウンロードして実行

OpenSSLをOnにするの推奨だと怒られた場合はphp.iniを以下のように編集

;extension=php_openssl.dll
↓
extension=php_openssl.dll

PhpStorm Setting

Composer Settings

projectを右クリックして
Composer > Init Composer...

Path to PHP executable: <PHP_PATH>
Path to composer.phar: <COMPOSER_PATH>

勝手にcomposer.jsonが開くので、右クリックして
Composer > Add dependency...

phpunit/phpunitを選択してinstall

PHPUnit Settings

ツールバーのFile > Settings...

Languages & Frameworks > PHP > PHPUnit

Use Compose autoloaderにチェック
Path to script: <PROJECT_PATH>\vendor\autoload.php

Run Config

ツールバーの Run > Edit Configurations...

+を押してPHPUnitを指定

TestRunnerを適当に指定

Name: UnitTest
Directory: <UNITTEST_PATH>

使ってみる

(PHPUnitを使ってテストクラス書いておく)
UnitTestを指定してRun

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?