Chris Hartjes' Blog: Testing Components In CakePHP
129211
Chris Hartjes has posted a quick example of a useful method for CakePHP developers - how to test components.   Using the test suite is actually quite easy: drop SimpleTest into your cake/vendors directly and you're ready to start writing your tests. Having written tests using SimpleTest before it wasn't going to be too hard for me to get them done. But there was one little problem: how do you test a component?   He includes an example of such a test, running it on his Email controller to try to send an email via SMTP.
208133
Chris Hartjes has posted a mini-tutorial on working with HABTM (Has And Belongs To Many) relationships in a CakePHP applications alongside pagination.   There are usually lots of Has And Belongs To Many relationship questions on the CakePHP mailing list. Since I am stupid about this stuff, I sought out Nate Abele and bugged him via IM until he agreed to give me an example of how to do this.   He includes both the how and the why, explaining that merging the parameters allows the script to apply the HABTM connections as well as limiting the results for each page.
247721
Continuing on from this previous post talking about Javascript in CakePHP applications, Felix Geisendorfer hands out more tips in this new blog entry targeted mainly at users of the jQuery Javascript library.   While the old solution was nice to manage the JS of a smaller application, this one is ment to structure your JS even in bigger projects. To make this possible I decided to go with a loose (MV)C pattern.   He gives an example of using a SiteController in connection with a CalendarController to help populate the information for the calendar.
457664
In this post on the Zend Developer Zone, Cal Evans takes a look at an article published in a recent php|architect issue from Chris Hartjes about how several recent advancements in the PHP community have helped developers think more in "the Rails way" of development.   Chris does a good job of laying out his points. As with any article of this nature, you are going to agree with some of them and you'll disagree with some of them. However, to get to that point you'll have to consider all of them. That's really the point of the article; making developer sit back and think for a minute. It's well worth the read.   Cal also mentions some of the topics presented in the article including more conceptual ideas like "Convention Over Configuration" and "Rapid Should Mean Rapid".
257024
The Bakery (for the CakePHP framework) has several new articles/helpers/components they've posted about lately - here's the list:   CakePHP on IIS Yahoo! Weather Component ACL Management Plugin Visualize - Generate a graphic of your models/tables Tree Helper New Year, New Beta   Check out The Bakery for more information on these and other great CakePHP-related items.
496780
Lorenzo Alberton has posted some updates about the PEAR packages that he maintains to his blog today including MDB_QueryTool, Mail_Queue2, MDB2, and Translation2.   Even if lately I've been coding way more in C/C++ than in PHP, I still keep an eye on PEAR developement: I reckon in the last month I've closed a bug a day, on average. And after my last call for help about my PEAR packages, I'm also pleased to announce that someone did indeed offer a hand. I'm happy to welcome not one, but two new developers!   Each of the items has links to their PEAR homepage and a few quick words on where the package stands (including developers involved or wanting to get involved). He also reminds developers out there that they can help out too if they want to jump in and get into PEAR.
414301
Over on the ThinkingPHP Blog, Felix Geisendorfer has completed his series of Ten Days of Free Dessert with some useful tips about using the CakePHP Framework.   'm announcing the "10 Days of free Dessert!". This basically means that I'll post at least 1 useful and easy to adapt CakePHP tip begining tomorrow for the next 10 days. I will try to pick things you might not have heard before and that didn't get a lot of loving from the docs team so far.   Here's the listing:  The 7 Crucials of CRUD Become Friends with the Inflector Generate a Random Password Keep Your Cake Fresh (use SVN HEAD) Keep a Custom Configuration File MySQL & UTF-8 Conventions over Ego Render Custom Errors Graceful Error Handling Default Models, Components, and Helpers  Each of the posts contains a description of the feature and some code to show how it's done. It's a great, handy little series of posts for any CakePHP developer to keep in their toolkit to pull from later on.
67063
Chris Hartjes has posted about a new resource that he "cannot stop recommending people to use [it] when searching for answers to their CakePHP problems" - the CakePHP Cookbook.   With a ton of help from Andy Dawson (AD7Six) the documentation for CakePHP 1.2 has moved forward immensely with the unveiling of the CakePHP Cookbook. It's a combination of manual and wiki, where people can flesh out the manual and make comments on the methods in there.   With the wiki in place, anyone can add to the communal CakePHP wisdom (or correct where others might have strayed) to make it a bigger and better resource for the whole range of CakePHP developers.
81155
From the PHP in Action blog today, there's a new post that (briefly) shows how to run your tests directly from a popular unix text editor - vim.   I created my own test runner to run tests inside Vim, I can't remember how long ago. Must be a year or two. I never shared it with the world. It was too primitive for anyone else to use. Then, recently, I decided to try re-implementing it in a more serious way.   The "more serious way" meant using Vim script to its full potential, including the ability to work with objects and already has its own testing framework. He includes a screenshot but no download just yet. It looks promising and makes running tests as simple as hitting F11 and watching it go.
416010
The IBM developerWorks site brings the community another great tutorial today, this time looking at the CakePHP framework and the creation of a simple application with it.    In "Cook up Web sites fast with CakePHP, Part 1: Adding related information and services", they build a sample application (Tor) from the ground up (installation guide and all) that will take in a username and password on a login page. Their goal is to show you how much time you could safe by using the framework over just the usual library-based (or procedural) programming methods.   You will need to be a bit familiar with PHP and the Model/View/Controller design pattern before you get started here, but if you have that down, you can just jump right in. You'll also either need to register with the site or log in with your account information to get to the good stuff.
654789
Padraic Brady has posted today about a subclass of the Zend_Loader package (in the Zend Framework) he had written up to handle Dependency Injections - it was submitted but ended up being replaced with a Zend_Di component instead.   I realised someone had proposed a novel new component called Zend_Di, and that small change was since accepted by Federico into his DI buster. This is a quick overview with very simple use cases - read the full proposal for even more gory details about your object innards using DI.   He talks about what DI (dependency injection) is and what it can be used for and includes a simple example set around a controller in the framework that uses the Zend_Di component to make a "mock Zend_Mail" that can be used in testing too. Examples of these sorts of tests (with PHPSpec) are included too.
698334
Popular posts from PHPDeveloper.org for the past week:The Bakery: Six New Articles/Tutorials PostedEvert Pot's Blog: PHP: Arrays vs. ObjectsDevArticles: Learning AJAXInternet Super Hero: PHP: mysqli_fetch_all()David Coallier's Blog: PHP Namespaces (Part 1: Basic usage & gotchas)I/O Reader: 15 Cool Things & 12 Things to Dislike About PHPProPHP Podcast: Newscast - August 16, 2007PHPBuilder.com: Dynamic XML with PHPSite News: Popular Posts for the Week of 08.17.2007PRADO Watch Blog: PRADO Watch: Interview With Timani Tunduwani - Why I Moved From CakePHP to PRADO
664550
Sebastian Bergmann has posted an official call for help for a PHPUnit-related project that seems to be a more and more requested feature for the popular unit testing package - an Ajax-based test runner.   It would be great if the frontend for the browser-based test runner would make use of AJAX. Since I am clueless when it comes to both web design in general and AJAX in particular, I would appreciate if someone else could help me with implementing this test runner.   He's looking for the XHTML, CSS, and Javascript to put it all together as well as the Javascript that makes the magic happen. If you're interested in helping out, you can either contact him on the mailing list or in #phpunit on the Freenode IRC network.
416901
Aaron Wormus has a new note on his blog today about his presentation at this year's Zend/PHP Conference & Expo and another speaker he's excited to hear.    One of the Zend conference sessions that I'm pretty excited about is Don Samisa Abeysinghe's (of WSO2) "Fully Fletched Web Services with PHP".   I'll be presenting a session on "Moving to PHP5 with Style." This tutorial/case study will be based on experience in transitioning several codebases from PHP4 to PHP5, creating unit tests & started a move towards a service based architecture without a complete platform rewrite.    Aaron's talk fits under the banner of the "PHP Development" talks, including others on topics like hosting PHP applications on Windows, working with PDO, unicoding in PHP6, and using PHPUnit.
277304
The results from the latest poll conducted by the International PHP Magazine have been released. This time, they asked developers what they thought was the best way to do QA for their PHP applications.   Among the options were things like "Do API documentation", "Use code analyzers that check CS violations, XSS or SQL injection attacks" and the number one choice - "Do unit tests using PHPUnit or phpt". Three other options followed behind (using debugging tools, code analyzers and having a commit mailing list) with the API documentation falling down in last place.   They already started up this week's poll too. This time, they ask developers to vote on which of the options make for good PHP code. There's four options - structured, consistent, portable and secure. Get your vote in today!
295818
In a new note today, Matthew O'Phinney shares some of his experience as being asked to head up the MVC team for the Zend Framework, including some of the changes that have been made.   The experience has been incredibly rewarding, however, and I've had the chance to pick the brains of and work with some top-notch developers in the process. In the next week or so, we'll be releasing version 0.6.0 of the framework, and it will include much of my work in the MVC components as part of the core distribution.   Some of the changes he lists include:  changes that promote greater flexibility and testing controller classes are now unit tested the introduction of the request and response objects a router is no longer needed the ability to push parameters into the front controller  He also gets into a bit of detail on the Response object - what it is, how it works, and how you can set up your own custom versions of it. Check out the full post for more information.
139275
Popular posts from PHPDeveloper.org for the past week:PHP-Coding-Practices.com: Try-Catch Syntax WeirdnessPHPBuilder.com: Cross-Platform Database PHP DevelopmentIBM developerWorks: Java and PHP technology on AIX - Integrate the Java business application w/ DB2OpenSourceCommunity.org: What do you think makes a good CMS?Jonathan Snook's Blog: Elemental: Conditional Content with CakePHPDevShed: The Basics of Using the Factory Pattern in PHP 5Builder.com.au: PHP exploit code plants itself in GIFJohn Cox's Blog:  Linux.com Now PHP PoweredNick Halstead's Blog: Solving Programming ProblemsPHP-Tools Blog: Testing FIT