0
我寫的,通過每個目錄散步,而忽略了一些腳本,並做了composer install
,phpunit
和應該工作,因爲它確實在大多數情況下 - 當我運行它第二次......必須運行我的腳本兩次?
的問題是命令phpunit
。該腳本來該命令,並打印出:
...
+ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
+ phpunit
PHPUnit 4.6.4 by Sebastian Bergmann and contributors.
Usage: phpunit [options] UnitTest [UnitTest.php]
phpunit [options] <directory>
...
當我運行它第二次,我得到:
...
+ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
+ phpunit
PHPUnit 4.6.4 by Sebastian Bergmann and contributors.
Configuration read from /vagrant/Freya/Form/phpunit.xml
...............................................................
Time: 647 ms, Memory: 15.25Mb
OK (63 tests, 63 assertions)
...
我不應該有兩次運行該腳本。腳本的目標是說:你有供應商目錄嗎?不,好吧做一個composer install
並運行phpunit
如果我們遇到一個有routes-test.sh
文件的目錄,我們會做一些其他的事情,但是這個概念在一天結束時仍然是一樣的。
所以,用下面的腳本:
#!/usr/bin/env bash
set -eux
function run_tests() {
if [[ -f "composer.json" ]]; then
if [[ -d "vendor" ]]; then
composer update
phpunit
cd ../
else
composer install
phpunit
cd ../
fi
fi
}
function wordpress_routes() {
cd ../../
if [[ -d "trunk" ]]; then
cd trunk
if [[ -f "wp-tests-config.php" ]]; then
continue
else
cd ../Freya/Routes/
cp wp-tests-config.php ../../trunk/
fi
else
svn co http://develop.svn.wordpress.org/trunk/
cd Freya/Routes/
cp wp-tests-config.php ../../trunk/
fi
}
for f in *; do
if [[ -d $f ]]; then
if [[ $f != ".git" ]] && [[ $f != "bin" ]] && [[ $f != "docs" ]]; then
cd "$f/"
if [[ -f "routes-test" ]]; then
wordpress_routes
run_tests
fi
run_tests
fi
fi
done
爲什麼我已運行腳本兩次獲得PHPUnit的實際運行?