Friday, April 15, 2011

Getting Started with Zend Framework - Part I

This would be the first of many (hopefully) tutorials on the Zend Framework. We will create an application as we go...

Wednesday, April 13, 2011

Installing PHPUnit in XAMPPLite for Windows 1.7.2

Installing PHPUnit on XAMPPLite 1.7.2 wasn't as straightforward as I imagined it would be.

E:\xampplite\php>pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded

1st step went fine.

E:\xampplite\php>pear install phpunit/PHPUnit
WARNING: channel "pear.phpunit.de" has updated its protocols, use "pear channel-update pear.phpunit.de" to update
Unknown remote channel: pear.symfony-project.com
Unknown remote channel: pear.symfony-project.com
Unknown remote channel: components.ez.no
Did not download optional dependencies: channel://components.ez.no/ConsoleTools, use --alldeps to download automatically
Unknown remote channel: components.ez.no
phpunit/PHPUnit requires PEAR Installer (version >= 1.9.2), installed version is 1.8.1
phpunit/PHPUnit requires package "channel://pear.symfony-project.com/YAML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "dbus"
phpunit/DbUnit requires PEAR Installer (version >= 1.9.1), installed version is 1.8.1
phpunit/DbUnit requires package "channel://pear.symfony-project.com/YAML" (version >= 1.0.2)
phpunit/File_Iterator requires PEAR Installer (version >= 1.9.2), installed version is 1.8.1
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.1), installed version is 1.8.1
phpunit/PHP_CodeCoverage requires package "phpunit/File_Iterator" (version >= 1.2.2)
phpunit/PHP_CodeCoverage can optionally use package "channel://components.ez.no/ConsoleTools" (version >= 1.6)
phpunit/PHP_Timer requires PEAR Installer (version >= 1.9.0), installed version is 1.8.1
phpunit/PHPUnit_MockObject requires PEAR Installer (version >= 1.9.1), installed version is 1.8.1
phpunit/PHPUnit_Selenium requires PEAR Installer (version >= 1.9.1), installed version is 1.8.1
phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.1), installed version is 1.8.1
phpunit/PHP_TokenStream requires package "channel://components.ez.no/ConsoleTools" (version >= 1.6)
No valid packages found
install failed

Ooops...lot of errors. I started to sort them out one at a time. The warning first.

E:\xampplite\php>pear channel-update pear.phpunit.de
Updating channel "pear.phpunit.de"
Update of Channel "pear.phpunit.de" succeeded

Looks like I have a older version of PEAR. So...

E:\xampplite\php>pear upgrade pear
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
downloading PEAR-1.9.2.tgz ...
Starting to download PEAR-1.9.2.tgz (295,120 bytes)
.................................................done: 295,120 bytes
downloading Archive_Tar-1.3.7.tgz ...
Starting to download Archive_Tar-1.3.7.tgz (17,610 bytes)
...done: 17,610 bytes
downloading Structures_Graph-1.0.4.tgz ...
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
...done: 30,318 bytes
downloading Console_Getopt-1.3.1.tgz ...
Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes)
...done: 4,471 bytes
upgrade ok: channel://pear.php.net/Archive_Tar-1.3.7
upgrade ok: channel://pear.php.net/Structures_Graph-1.0.4
upgrade ok: channel://pear.php.net/Console_Getopt-1.3.1
upgrade ok: channel://pear.php.net/PEAR-1.9.2
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

E:\xampplite\php>pear -V
PEAR Version: 1.9.2
PHP Version: 5.3.0
Zend Engine Version: 2.3.0
Running on: Windows NT COM4 5.1 build 2600 (Windows XP Professional Service Pack 3) i586

Great. Now for the other unknown remote channels.

E:\xampplite\php>pear channel-discover pear.symfony-project.com
Adding Channel "pear.symfony-project.com" succeeded
Discovery of channel "pear.symfony-project.com" succeeded

E:\xampplite\php>pear channel-discover components.ez.no
Adding Channel "components.ez.no" succeeded
Discovery of channel "components.ez.no" succeeded

Keeping my fingers crossed...

E:\xampplite\php>pear install phpunit/PHPUnit
Did not download optional dependencies: ezc/ConsoleTools, use --alldeps to download automatically
phpunit/PHPUnit can optionally use PHP extension "dbus"
downloading PHPUnit-3.5.13.tgz ...
Starting to download PHPUnit-3.5.13.tgz (118,553 bytes)
..........................done: 118,553 bytes
downloading PHP_CodeCoverage-1.0.4.tgz ...
Starting to download PHP_CodeCoverage-1.0.4.tgz (115,029 bytes)
...done: 115,029 bytes
downloading PHP_TokenStream-1.0.1.tgz ...
Starting to download PHP_TokenStream-1.0.1.tgz (7,250 bytes)
...done: 7,250 bytes
downloading ConsoleTools-1.6.1.tgz ...
Starting to download ConsoleTools-1.6.1.tgz (869,994 bytes)
...done: 869,994 bytes
downloading Base-1.8.tgz ...
Starting to download Base-1.8.tgz (236,357 bytes)
...done: 236,357 bytes
install ok: channel://components.ez.no/Base-1.8
install ok: channel://components.ez.no/ConsoleTools-1.6.1
install ok: channel://pear.phpunit.de/PHP_TokenStream-1.0.1
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-1.0.4
install ok: channel://pear.phpunit.de/PHPUnit-3.5.13

E:\xampplite\php>phpunit --version
PHPUnit 3.5.13 by Sebastian Bergmann.

Done.