8. $fun is not fun! -_-属 function emptyfoo($el){ return $el; }
9. $fun is not fun! -_-属 function emptyfoo($el){ return $el; } // verifico se le date vanno in formato SQL (YYYY-MM-DD) if($SQLDATE) $foo = "dataSQL"; else $foo = "emptyfoo"; //echo $foo("10/9/2007"); exit; // verifica se bisogna inserire gli slashes nei caratteri che richiedono il quoting (es: ', ", if($ADDSLHS) $fun = "addslashes"; else $fun = "emptyfoo";
10. $fun is not fun! -_-属 function emptyfoo($el){ return $el; } // verifico se le date vanno in formato SQL (YYYY-MM-DD) if($SQLDATE) $foo = "dataSQL"; else $foo = "emptyfoo"; //echo $foo("10/9/2007"); exit; // verifica se bisogna inserire gli slashes nei caratteri che richiedono il quoting (es: ', ", if($ADDSLHS) $fun = "addslashes"; else $fun = "emptyfoo"; "if($ADDSLHS) $fun = "addslashes"; else $fun = "emptyfoo";" is not so fun... Let's meet at http:// phpday.it /2010 to get started with QA 3:46 PM Apr 27th via Echofon
11. I valori di eXtreme Programming Comunicazione (tutti possono parlare con tutti, ehm sono da solo) Semplicit (unit testing, d.r.y., k.i.s.s.)
13. Coraggio (si d in uso il sistema subito e si implementano i cambiamenti) ehm 竪 gi online! http://it.wikipedia.org/wiki/Extreme_Programming
14. Test Unitari e Funzionali Assumono una condizione E controllano che sia soddisfatta Unit Testing per astrarre ogni componente Functional testing per soddisfare i comportamenti desiderati
19. Consigli per iniziare TDD Ok, red , green , prima i test e poi il codice Ma come inizio i test , se non ho codice da testare ? E poi la console di windows 竪 in bianco e nero!
20. L'illuminazione: The more stress you feel, the less likely you are to test enough. La quantit di stress 竪 inversamente proporzionale alla quantit di test . (Kent Beck Test Driven Development by example, p.129)
21. DAI! DAI! DAI! Portiamocelo a casa questo test! Identificare un bisogno
28. testProva.php (1) <?php require_once('PHPUnit/Framework.php'); require_once('PHPUnit/Extensions/WebBrowserTestCase.php'); class ProvaTest extends PHPUnit_Framework_TestCase { public function testProva () { $this-> assert True(true, 'True is true'); } }
29. testProva.php class ProvaFunzionaleTest extends PHPUnit_Extensions_WebBrowserTestCase { public function setUp() { $this->url = 'http://www.regione.emilia-romagna.it'; } public function testProvaFunzionale () { $this->get($this->url); $this->responseContains('PER I CITTADINI'); } }
30. testWsdl.php <?php require_once('PHPUnit/Framework.php'); require_once('../Packages/RERAuthentication.php'); class WsdlTest extends PHPUnit_Framework_TestCase { public function setUp() { $this->rerAuth = new RERAuthentication; } public function testSoapExtension() { $this->assertEquals(1, SOAP_1_1); $this->assertEquals(2, SOAP_1_2); } public function testHttpsSocket() { $fp = fopen($this->rerAuth->getWsdl(), 'r'); $this->assertNotEquals(false, $fp); fclose($fp); } }
31. RERAuthentication.php <?php class RERAuthentication { protected $wsdl = 'https://www/Authentication.asmx?WSDL'; [] /** * Restituisce la URL WSDL del webservice Autenticazione Centralizzata Authentication * * @return string URL WSDL * */ public function getWsdl() { return $this->wsdl; }
32. cmd.exe PHPUnit 3.4.11 by Sebastian Bergmann. ................ Time: 4 seconds, Memory: 4.75Mb OK (16 tests, 33 assertions) C:rogrammiasyPHP5.2.10wwfficaciaFPest>