Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A script to compile PHPUnit-3.5.15 with all dependencies into archive which can be extracted to CakePHP 2.0 Vendor directory in order to UnitTest cake (if you don't have access to PEAR commands or PEAR insists on installing PHPUnit-3.6.0 and not working).
#!/bin/sh
# Creating temp dirs
mkdir .compile_PHPUnit_$$
cd .compile_PHPUnit_$$
# Fetching the archives
wget -nv http://pear.phpunit.de/get/PHPUnit-3.5.15.tgz
wget -nv http://pear.phpunit.de/get/DbUnit-1.0.0.tgz
wget -nv http://pear.phpunit.de/get/File_Iterator-1.2.3.tgz
wget -nv http://pear.phpunit.de/get/Text_Template-1.0.0.tgz
wget -nv http://pear.phpunit.de/get/PHP_CodeCoverage-1.0.2.tgz
wget -nv http://pear.phpunit.de/get/PHP_Timer-1.0.0.tgz
wget -nv http://pear.phpunit.de/get/PHPUnit_MockObject-1.0.3.tgz
wget -nv http://pear.phpunit.de/get/PHPUnit_Selenium-1.0.1.tgz
wget -nv http://pear.phpunit.de/get/PHP_TokenStream-1.1.0.tgz
wget -nv http://pear.symfony-project.com/get/YAML-1.0.2.tgz
wget -nv http://download.pear.php.net/package/XML_RPC2-1.1.1.tgz
# Unpacking
tar -xzf PHPUnit-3.5.15.tgz && echo "Unpacked PHPUnit 3.5.15"
tar -xzf DbUnit-1.0.0.tgz && echo "Unpacked DbUnit 1.0.0"
tar -xzf File_Iterator-1.2.3.tgz && echo "Unpacked File_Iterator 1.2.3"
tar -xzf Text_Template-1.0.0.tgz && echo "Unpacked Text_Template 1.0.0"
tar -xzf PHP_CodeCoverage-1.0.2.tgz && echo "Unpacked PHP_CodeCoverage 1.0.2"
tar -xzf PHP_Timer-1.0.0.tgz && echo "Unpacked PHP_Timer 1.0.0"
tar -xzf PHPUnit_MockObject-1.0.3.tgz && echo "Unpacked PHPUnit_MockObject 1.0.3"
tar -xzf PHPUnit_Selenium-1.0.1.tgz && echo "Unpacked PHPUnit_Selenium 1.0.1"
tar -xzf PHP_TokenStream-1.1.0.tgz && echo "Unpacked PHP_TokenStream 1.1.0"
tar -xzf YAML-1.0.2.tgz && echo "Unpacked YAML 1.0.2"
tar -xzf XML_RPC2-1.1.1.tgz && echo "Unpacked XML_RPC2 1.1.1"
# Creating target dir
mkdir Vendor
# Copying everything to Vendor
cp -r PHPUnit-3.5.15/PHPUnit Vendor/
cp -r DbUnit-1.0.0/PHPUnit Vendor/
cp -r PHPUnit_MockObject-1.0.3/PHPUnit Vendor/
cp -r PHPUnit_Selenium-1.0.1/PHPUnit Vendor/
cp -r File_Iterator-1.2.3/File Vendor/
cp -r PHP_CodeCoverage-1.0.2/PHP Vendor/
cp -r PHP_Timer-1.0.0/PHP Vendor/
cp -r Text_Template-1.0.0/Text Vendor/
cp -r YAML-1.0.2/lib Vendor/
cp -r XML_RPC2-1.1.1/XML Vendor/
cp -r PHP_TokenStream-1.1.0/PHP Vendor/
# Creating a package
cd Vendor
tar -czf ../../PHPUnit_for_Vendor.tar.gz *
cd ..
# Cleaning up
cd ..
rm -rf .compile_PHPUnit_$$
echo
echo "Done. Extract the files from `pwd`/PHPUnit_for_Vendor.tar.gz to your Vendor directory."
@arjenroodselaar

This comment has been minimized.

Copy link

@arjenroodselaar arjenroodselaar commented Nov 2, 2011

Hi Marko. Thank you for this script, it saved me some struggling with PEAR on an old setup. Unfortunately it was missing the PHP_TokenStream dependency. I cloned your gist, modified the script, and testing seems to be fully functional now in my CakePHP 2.0.1 app. Unfortunately I do not know how to send you a Pull Request on this modification (I am new to Git and GitHub), in case you are interested in my change.

@markomarkovic

This comment has been minimized.

Copy link
Owner Author

@markomarkovic markomarkovic commented Nov 2, 2011

Thanks, I've added it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment