• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
PHPUnit Myth
 

PHPUnit Myth

on

  • 400 views

PHPUnit

PHPUnit

Statistics

Views

Total Views
400
Views on SlideShare
400
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    PHPUnit Myth PHPUnit Myth Presentation Transcript

    • PH P Un itPHPUnit Myth•––• •••• •––• ••– –• •• –北緯 25 度 233 東經 121 度 3357#66
    • 寫程式時會怎麼測 試 ?!
    • 測 1 <?php 2 $fixture = array();試 ?! 3 4 $fixture[] = element; 1 <?php 2 $fixture = array(); 3 print count($fixture) . "n"; 4 $fixture[] = element; 5 print count($fixture) . "n"; 結果 : 0 1
    • 在大型專案直接把結果印出 來 反而更吃力試看看更有效率的方法 啾咪 ~^^
    • 自動化測 試<?php$fixture = array();print count($fixture) == 0 ? "okn" : "not okn";$fixture[] = element;print count($fixture) == 1 ? "okn" : "not okn";結果 :okok
    • 自動化測試 (PHPUnit 雛<?php 形)$fixture = array();assertTrue(count($fixture) == 0);$fixture[] = element;assertTrue(count($fixture) == 1);function assertTrue($condition){ if (!$condition) { throw new Exception(Assertion failed.); }}
    • PHPUnit 安裝需求PHPUnit 3.6 - 最低 PHP 5.2.7+, 建議 PHP 5.3.9+PHPUnit 3.7 - 最低 PHP 5.3.3+ , 建議 PHP 5.4.0+PHP_CodeCoverage- Xdebug 2.0.5+ 最低- Xdebug 2.1.3+ 建議安裝方式 :pear config-set auto_discover 1pear install pear.phpunit.de/PHPUnit
    • 接下來就為各位一一示範 PHPUnit 功能