Re: PHP Unit tests

From: Date: Sat, 23 Jun 2007 16:08:08 +0000
Subject: Re: PHP Unit tests
References: 1 2  Groups: php.evangelism 
Request: Send a blank email to php-evangelism+get-376@lists.php.net to get a copy of this message
Big Thanks to all you this is very helpful information (I hope my boss will google this page ;) ) Yes we are using APC for application variables and some seralized array that we need on every page load and memcached for HTML caches as we need to deliver page in less then 0.2 seconds in busy environment (20 req/s) We don't have strong documentation as we are moving from startup level to more corporate level where we will need to compile stronger documentation for apps. What I mean about strong types is this simple situation if( ! $price) then do something this is a common way we do coding and it is very unsecure but PHP allows it, and most of the time it works but sometimes people are lazy and forgot to take into account all possibilities of $price so the above code to be more secure would become if($price==='' || $price === null || $price === false) then do something and we cant use is_numeric() as $price can sometime be 'unknown' and this is because of stong types, so from here we can see that PHP programmer should be much more intuitive and smarter ;) then java one For unit test we do use same approach as Zend F. do but it is hell to manage those test once one of classes changes (this is more of a laziness) Finally I think that PHP is completely OK for us RnR is just a language that my boss likes he is kinda fancy as RnR is :) Java is very hard in a way that it doesn't have natively strong support for web environment (file uploads Cookies POST etc) but using apache libs and solid framework can be strong platform but PHP has most of that already bundled so I will stick to PHP ;) thanks again for fast response. Claus Jørgensen wrote:
Hey 1. Strong types is not nessary in a scripting language, if it causes headaches it's due to poor documentation which is far worse than just the lack of strong types. The reason things are developed in scripting languages is to avoid *too* much typing overheat. I can't say that strong typing ever would have solved an issue in php, that couldn't been solved by the nessary documentation. 2. There is alot of unit tests frameworks for php, have you not looked in /test/ that is shipped with Zend Framework ? http://www.phpunit.de/ is one of the more populare , and one of the lead developers being Sebastian Bergmann from eZ Components. 3. That will be nailed in PHP6, but my experience is that Ruby and Java ain't much better, and Ruby most likely would relay on the same libs as php does (iconv). 4. http://pecl.php.net/APC <http://pecl.php.net/APC> , www.php.net/APC <http://www.php.net/APC> , op-code cache for php5 :-) Works like a charm. And regarding Java... your boss should look at history, and perhaps explain him how horrible struts is :-) 2007/6/22, Bojan Tesanovic <btesanovic@gmail.com <mailto:btesanovic@gmail.com>>:
    Hi there,
    I am Web developer and front-end team lead of classifieds search
    engine site.
    We are using php 5.2.0 and Zend Framework to power our web site.
    But lately my manager wants to jump to another platform RnR or Java
    which I dislike though he is right in some points.
    1. Lack of strong types which can cause lot of headaches
    2. Missing of PHP Unit framework that is supported by Zend or PHP
    community
    3. Robust UTF-8 and I18N support which will I hope be nailed in PHP6
    4. Maybe a way to compress source or make opcode of php files in one
    file and deploy it to web server
        this is very helpful in production environments and large systems
    So it would be of great importance for PHP to tackle #1 and #2 and
    to dive more deeply in
    Enterprise waters.
    best
    Bojan Tesanovic
    http://www.classicio.com/
-- Sincerely Claus Jørgensen, Denmark Mobil: +45 30 13 27 32 http://www.dragons-lair.org
-- Bojan Tesanovic http://www.classicio.com/

« previous php.evangelism (#376) next »