<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[Zend for eclipse 中PHPUnit 的环境变量path设置文件梳理]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Wed, 23 Jun 2010 06:22:02 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	D:&#92;Program Files&#92;Zend&#92;Zend Studio - 7.2.0&#92;plugins&#92;com.zend.php.phpunit_7.2.0.v20100324-1300&#92;resources&#92;ZendPHPUnit.php<br/><div class="code"><br/>require_once $_SERVER&#91;&#039;ZEND_PHPUNIT_TESTS_LOCATION&#039;&#93;;<br/><br/>define(&#039;PHPUnit_MAIN_METHOD&#039;, &#039;&#039;);<br/><br/>set_include_path(get_include_path()<br/>&nbsp;&nbsp;. PATH_SEPARATOR . $_SERVER&#91;&#039;ZEND_PHPUNIT_LOCATION&#039;&#93;<br/>&nbsp;&nbsp;. PATH_SEPARATOR . $_SERVER&#91;&#039;ZEND_PHPUNIT_PROJECT_LOCATION&#039;&#93;<br/>&nbsp;&nbsp;. PATH_SEPARATOR . $_SERVER&#91;&#039;ZEND_PHPUNIT_CONTAINER_INCLUDE_PATH&#039;&#93;<br/>);<br/></div><br/>开始继承PHPUnit_Framework_TestSuite：<br/><div class="code"><br/>require_once &#039;PHPUnit/TextUI/TestRunner.php&#039;;<br/><br/>$cwd = getCwd();<br/><br/>foreach ($ZendPHPUnitTests as $test) &#123;<br/>&nbsp;&nbsp;chDir(dirname($test&#91;&#039;file&#039;&#93;));<br/>&nbsp;&nbsp;require_once $test&#91;&#039;file&#039;&#93;;<br/>&nbsp;&nbsp;chDir(dirname($cwd));<br/>&#125;<br/><br/>class ZendPHPUnitSuite extends PHPUnit_Framework_TestSuite &#123;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;public static function suite() &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$suite = new self();<br/>&nbsp;&nbsp;&nbsp;&nbsp;$suite-&gt;setName(__CLASS__);<br/>&nbsp;&nbsp;&nbsp;&nbsp;foreach ($GLOBALS&#91;&#039;ZendPHPUnitTests&#039;&#93; as $test)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($test&#91;&#039;type&#039;&#93; === &#039;suite&#039;) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$suite-&gt;addTest(call_user_func(array ($test&#91;&#039;name&#039;&#93;, &#039;suite&#039;)));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125; else $suite-&gt;addTestSuite($test&#91;&#039;name&#039;&#93;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;return $suite;<br/>&nbsp;&nbsp;&#125;<br/>&#125;<br/></div><br/>首先是加入环境变量：<br/>.;Z:&#92;soa1.3.1_code;;Z:&#92;soa1.3.1_code;<br/>然后，才是自己继承它加入自己的变量：<br/>VoteTest.php 内容：<br/>&lt;?php<br/>require_once &#039;component/test/service/DirTest**.include.php&#039;;<br/>包含被测试文件<br/>继承文件：require_once &#039;component/test/ComponentPHPUnit_Framework_TestCase***.php&#039;;其内容大体如下：<br/>class ComponentPHPUnit_Framework_TestCase extends PHPUnit_Framework_TestCase&#123;<br/>。<br/>。<br/>。<br/>开始测试的函数编写<br/>EOF！<br/><br/>=================================================================<br/>DirTest**.include.phpcode如下：<br/><div class="code"><br/>&lt;?php<br/>define(&quot;ROOT_PATH&quot;,realpath(&quot;../../../&quot;).&#039;/&#039;);<br/>define(&quot;LIB_PATH&quot;,ROOT_PATH.&quot;PHP_TM_LIB***/&quot;);<br/><br/>set_include_path(<br/>&nbsp;&nbsp;&nbsp;&nbsp;get_include_path()<br/>&nbsp;&nbsp;&nbsp;&nbsp;.PATH_SEPARATOR . ROOT_PATH<br/>&nbsp;&nbsp;&nbsp;&nbsp;.PATH_SEPARATOR . LIB_PATH<br/>);<br/>?&gt;</div><br/><br/>首先：path里面已经包含：<br/>.;Z:&#92;soa1.3.1_code;D:&#92;Program Files&#92;Zend&#92;Zend Studio - 7.2.0&#92;plugins&#92;com.zend.php.phpunit_7.2.0.v20100324-1300&#92;resources&#92;library&#92;<br/>然后：<br/><div class="code"><br/>set_include_path(get_include_path()<br/>&nbsp;&nbsp;. PATH_SEPARATOR . $_SERVER&#91;&#039;ZEND_PHPUNIT_LOCATION&#039;&#93;<br/>&nbsp;&nbsp;. PATH_SEPARATOR . $_SERVER&#91;&#039;ZEND_PHPUNIT_PROJECT_LOCATION&#039;&#93;<br/>&nbsp;&nbsp;. PATH_SEPARATOR . $_SERVER&#91;&#039;ZEND_PHPUNIT_CONTAINER_INCLUDE_PATH&#039;&#93;<br/>);<br/></div><br/>把本地文件包含进来：<br/>注意：zend unit里面的：<br/>var_dump( $_SERVER[&#039;ZEND_PHPUNIT_LOCATION&#039;]); 就是源文件工程目录path位置：Z:&#92;soa1.3.1_code
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] Zend for eclipse 中PHPUnit 的环境变量path设置文件梳理]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>