Я написал сценарий, который идет через каждый каталог, игнорируя при этом некоторые, и делает 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)
...
я не должен запустить скрипт дважды. Цель сценария - сказать: у вас есть каталог поставщика? no, ok do a 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, чтобы реально работать?