1
0

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.

PHPUnitを使ってみる

Last updated at Posted at 2017-12-04

PHPUnitの使い方について記載

1.composerのインストール

brew install homebrew/php/composer

2.composer.jsに以下を追加

  "require": {
    "piece/stagehand-testrunner": "4.2.*"
  },
  "require-dev": {
      "phpunit/phpunit": "3.7.*"
  }

3.composerをアップデートしてパッケージのダウンロード

composer update

4.テストランナーのコンパイル

./vendor/bin/testrunner compile -p vendor/autoload.php

5.テストコードを作成(testsディレクトい配下に作成)

class Setup_test extends PHPUnit_Framework_TestCase {

	public function test_foo()
	{

        $this->assertTrue(true);

	}

}

6.テスト実行(vendor/autoload.phpを読み込んでtests配下をテスト)

./vendor/bin/testrunner phpunit -p vendor/autoload.php -a tests/

7.OKが出たら成功

以上

1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?