LoginSignup
1
1

More than 5 years have passed since last update.

FuelPHPでユニットテストの準備

Last updated at Posted at 2015-12-21

FuelPHPでPHPUnitの準備をする。oilコマンドでテスト実施。

PHPUnitは5.0以上の場合はPHPのバージョンが5.6以上必須となるので
まずはbrewを使用してPHP56をインストール。

brew install php56

バージョンを確認

php -v
PHP 5.6.16 (cli) (built: Nov 27 2015 10:28:22) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

プロジェクトのcomposer.jsonに以下を追加。
以下参考にさせていただきました。感謝。

    ,   "phpunit/phpunit": "4.*"
    ,   "phpunit/dbunit": ">=1.3,<1.4"
    ,   "phpunit/phpunit-skeleton-generator": "*"
    ,   "piece/stagehand-testrunner": "~4.1@dev"
    ,   "davedevelopment/phpmig": "*"
    ,   "squizlabs/php_codesniffer": "1.*"

プロジェクトの/fuel/app/配下にphpinit.xmlを配置し修正。

とりあえず動くか確認。

oil test
Tests Running...This may take a few moments.
PHPUnit 5.1.3 by Sebastian Bergmann and contributors.

...............................................................  63 / 389 ( 16%)
............................................................... 126 / 389 ( 32%)
............................................................... 189 / 389 ( 48%)
............................................................... 252 / 389 ( 64%)
............................................................... 315 / 389 ( 80%)
............................................................... 378 / 389 ( 97%)
...........                                                     389 / 389 (100%)

Time: 1.36 seconds, Memory: 29.75Mb

OK (389 tests, 483 assertions)

動いているっぽいので一旦これで完了。

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