「Php/zend framework/test方法」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==zendの環境変数を通す== $ vi ~/.bash_profile alias=zf='/usr/lib/php/ZendFramework-1.12.0-minimal/bin/zf.sh' $ source ~/.bash_profile ==プロジェクトス...」) |
(→phpunit実行) |
||
| 行18: | 行18: | ||
phpunit | phpunit | ||
phpunit application/controllers/IndexControllerTest | phpunit application/controllers/IndexControllerTest | ||
| + | |||
| + | ==phpunit.xml== | ||
| + | <phpunit bootstrap="./application/bootstrap.php" colors="true"> | ||
| + | <testsuites> | ||
| + | <testsuite name="Application Test Suite"> | ||
| + | <directory>./application</directory> | ||
| + | </testsuite> | ||
| + | <testsuite name="Library Test Suite"> | ||
| + | <directory>./library</directory> | ||
| + | <exclude> | ||
| + | <directory suffix=".php">/path/to/files</directory> | ||
| + | <file>/path/to/file</file> | ||
| + | </exclude> | ||
| + | </testsuite> | ||
| + | </testsuites> | ||
| + | <filter> | ||
| + | <whitelist> | ||
| + | <directory>./</directory> | ||
| + | <exclude> | ||
| + | <directory>../library/ZendFramework-1.12.14-minimal</directory> | ||
| + | <directory>../vendor</directory> | ||
| + | </exclude> | ||
| + | </whitelist> | ||
| + | </filter> | ||
| + | <logging> | ||
| + | <log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/> | ||
| + | </logging> | ||
| + | </phpunit> | ||
2017年7月20日 (木) 12:25時点における最新版
zendの環境変数を通す
$ vi ~/.bash_profile alias=zf='/usr/lib/php/ZendFramework-1.12.0-minimal/bin/zf.sh'
$ source ~/.bash_profile
プロジェクトスケルトン作成
zf create project samplezend
phpunitをインストール(mac
sudo pear channel-discover pear.phpunit.de sudo pear channel-discover pear.symfony.com sudo pear install phpunit/PHPUnit phpunit --version
phpunit実行
cd samplezend/tests phpunit phpunit application/controllers/IndexControllerTest
phpunit.xml
<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./application</directory>
</testsuite>
<testsuite name="Library Test Suite">
<directory>./library</directory>
<exclude>
<directory suffix=".php">/path/to/files</directory>
<file>/path/to/file</file>
</exclude>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>../library/ZendFramework-1.12.14-minimal</directory>
<directory>../vendor</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
</logging>
</phpunit>
