Things tagged with Web Development
Web development related topics
Well its been a while coming but today, DebugKit officially left GitHub. As noted in the past by some, the CakePHP family of projects were a bit scattered. So in an effort to consolidate everything, DebugKit has moved over to thechaw alongside other fabulous CakePHP projects like CakeBook and ApiGenerator.
I recently wrote an article about testing CakePHP controllers the hard way where I covered testing controllers by running their methods manually. I hinted at some additional tricks that could be performed by using Mock Objects. Today I’m going to spill the beans on Mocks, and how I use them when testing my Controllers.
I’ve recently been doing some work on some CLI tools, and I came across the need to “paginate” a long list of file. Instead of dumping out 40+ items to the screen all at once, which would be confusing and hard to read, I wanted a more elegant way of showing only a section on the huge list at once.
By now you already know or should know about
CakeTestCase::testAction() and the wondrous things it can do. However,
testAction has a few shortcomings. It can’t handle redirects, it doesn’t let you use the power of Mocks, and its impossible to make assertions on object state changes. Sometimes you need to do things the hard way, stick your fingers in the mud and work it out.
I’ve been working hard over the last few weeks to improve the DebugKit and have added what I think are some pretty cool features. First up is
FireCake is a fully functional FirePHP library built specifically with CakePHP in mind.
If you’ve ever tried to subclass a PHP4 static class you may have come to same conclusion that I have its a total pain in the neck. However, I think I’ve come up with a not too terrible approach.
Often times you will need to query a distant table based on a condition on a close table. For example we have a store that has a table structure like the following:
Now we want to find the Division that a particular Item belongs to. In normal SQL we could do
I’ve had quite the busy last little month or two. My wife and I have been house shopping for a while, and found a place about 2 months ago. However, just last weekend we moved into our new (to us at least) condo in west Toronto.
The new sideproject is the CakePHP DebugKit . I’ve been hard at work building a ‘debug toolbar’ for CakePHP.
At some point or another we’ve all had to make a data model that involved various flags to indicate different statuses / modes for an object. Often the schema for such a data model may end up looking like
With the help of Oscar Carlsson I’ve updated the AcoSync Shell and renamed it to the AclExtrasShell. With Oscar’s help we’ve added quick and easy ways to recover and verify your tree structures. AclExtras Shell also incorporates all the existing functionality of AcoSync Shell.
So 1.2 is nearly complete, the code is frozen and there are only a few bugs left to squash before the final release is ready. So you want to upgrade your application from 1.1 to 1.2. Although the 1.2 moniker suggests a ‘minor’ version, a lot has changed under the hood and entire API’s have been rebuilt.
Eclipse is widely popular, robust and powerful IDE. It supports PHP through the PDT project . PDT gives you some good PHP related development tools, including code completion & code templates to help you save some time.
If you are following the development of CakePHP today is a good day for you. RC3 was released today! We have all been working really hard to make this Release Candidate better than the last one. There have been over 400 commits since the last RC2. Some of the big changes are related to performance. Larry Masters and the rest of the team have been hard at work making CakePHP snappier and all around speedier.
The folks at Packt Publishing were kind enough to send me a copy of their newly published book CakePHP Application Development to review. The book is authored by Ahsanul Bari and Anupom Syam, and is a quick read at 300 pages.
By now you’ve got an awesome Acl and Auth controlled app running. However, making navigation menus is a pain with dynamic, and variable permissions. Outside of making menu elements for each type of Aro and including them in your layout, there currently aren’t many options (at least none that I’m aware of). I was faced with this exact problem a while back, and couldn’t find a suitable solution, so I made one.
The documentation for CakePHP has grown in leaps and bounds since the creation of the cookbook. Today I wanted to look at a few methods and conventions that may not be crystal clear from reading the book or api.
Object is the parent class for almost all other classes in CakePHP.
With all the talk of testing going on, I thought it would be good to look at how tests work and what is makes them tick. SimpleTest handles the bulk of test case execution, however, there are a few CakePHP specifics that are not part of a normal
When bakers first start using CakePHP there is a tendency to use
requestAction() more often than it should be. Often
requestAction() gets used to pull in common elements like recent posts or new comments, or to make menus. This makes sense in a way as it keeps the comments code in the
CommentsController and all is well.
Continuing in my previous vein of ACL related topics. I’ve got another handy addition to the ACL user’s toolbox.