facebook twitter hatena line email

Php/zend framework/test方法

提供: 初心者エンジニアの簡易メモ
2017年7月20日 (木) 12:25時点におけるAdmin (トーク | 投稿記録)による版 (phpunit実行)

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

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>