2012-05-09 22 views
2

正則表達式過濾器「開頭」我想這 phpunit --debug --filter /^complete/ feed.php;我怎樣做PHPUnit中

出於某種原因,它說0的測試。

如果我做phpunit --debug --filter /complete/ feed.php;它擊中字的任何功能「完成」

回答

5

這是因爲測試的完全合格的$name表示爲Classname::testname

所以你需要使用::,而不是^

贊:

$ phpunit --filter /::testIs/ 
PHPUnit 3.6.10 by Sebastian Bergmann. 

Configuration read from /var/www/.../phpunit.xml 

.. 

Time: 1 second, Memory: 10.75Mb 

OK (2 tests, 4 assertions) 
+0

謝謝,沒有我數據包絡分析。 「該模式可以是單個測試的名稱,也可以是匹配多個測試名稱的正則表達式。」在手冊 –

+0

@Dave Stein中不是很清楚:事實上並非如此。我剛剛找到了它被過濾的地方,看着'$ filter'和'$ name' --- https://github.com/sebastianbergmann/phpunit/blob/3.6/PHPUnit/Framework/TestSuite.php#L718 – zerkms