{"id":31,"date":"2006-06-16T00:59:38","date_gmt":"2006-06-15T23:59:38","guid":{"rendered":"http:\/\/blogs.igalia.com\/eocanha\/?p=31"},"modified":"2015-11-08T00:21:16","modified_gmt":"2015-11-07T23:21:16","slug":"php-is-my-friend","status":"publish","type":"post","link":"https:\/\/eocanha.org\/blog\/2006\/06\/16\/php-is-my-friend\/","title":{"rendered":"PHP is my friend :) (and also is NetBeans)"},"content":{"rendered":"<p>Everyday I enjoy using this language more and more. It&#8217;s powerful, it&#8217;s easy, and it can be used in everyday life for many more things than simply writing web pages.<\/p>\n<p>Theese days I&#8217;m taking part in the development of <a href=\"http:\/\/www.igalia.com\/en\/press_room\/news\/igalia_se_adjudica_la_segunda_fase_del_proyecto_e_sicus\">Sicus<\/a>, and one of the tasks I&#8217;ve to do is writing unit tests of some parts of the application. It&#8217;s boring and involves a lot of repetitive coding. Well, that&#8217;s where PHP can help&#8230;<\/p>\n<p>I&#8217;ve written a couple of scripts that take a brief specification of the methods of a class (method, mandatoryness, erroneous values) and automatically write the methods to perform the tests using loops, conditionals and variable substitution. It&#8217;s easy because text\/template substitution is what PHP is designed for.<\/p>\n<p>The code might not be very elegant, but performs well enough.<\/p>\n<p><strong>[24\/6\/2006 update]\u00a0<\/strong><\/p>\n<p>Yesterday I discovered a NetBeans menu tool that would had avoided me writing one of that PHP scripts I was talkinf above of (the getter &amp; setter method generator).<\/p>\n<p>NetBeans has the ability of examiining your code, noticing what member attributes haven&#8217;t get() and set() methods yet, and generate that code automatically. That tool is available from the menu: Refactor &#8211;&gt; Encapsulate field.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Everyday I enjoy using this language more and more. It&#8217;s powerful, it&#8217;s easy, and it can be used in everyday life for many more things than simply writing web pages. Theese days I&#8217;m taking part in the development of Sicus, and one of the tasks I&#8217;ve to do is writing unit tests of some parts &hellip; <a href=\"https:\/\/eocanha.org\/blog\/2006\/06\/16\/php-is-my-friend\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">PHP is my friend \ud83d\ude42 (and also is NetBeans)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/posts\/31"}],"collection":[{"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":1,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":456,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/posts\/31\/revisions\/456"}],"wp:attachment":[{"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}