Things tagged with PHP
Generating code coverage for test cases is a handy feature, it gives you a quick and easy way to determine how much of your code is running during your tests. It doesn’t ensure that the tests are good or that you have enough assertions, but code that doesn’t run definitely has not been tested. Before code coverage was created it was very difficult to determine how much code was being run.
So I’ve been working away on DebugKit the last few weeks. And I think its at a level where I can suggest other people give it a whirl. Its not at a stable release point. But if you are feeling adventurous and don’t mind using beta code give it a try. There are a few notable features have been added, so in no particular order here they are.
vCards are a nice added touch for an application that acts as a Address book, or contact management. vCards are easily used by most mail clients, and are a plain text standard making them nice and easy to implement. While hCard and other microformats are gaining popularity, the widespread support still doesn’t exist. Leaving vCard as the primary format to transfer contact information out of a web application
This is a quick trick I learned from master baker gwoo. If by chance you have multiple projects, and those projects share multiple plugins. You are in a bit of a pickle.
The release of the new API at http://api.cakephp.org wasn’t quite as smooth as I would have liked it. However, since the initial release things have constantly been improving. The search is now much more effective, and global functions are now in the index. So things are looking better each day. I hope to answer a few questions surrounding ApiGenerator today.
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.
I like many webdevelopers build a lot of forms. Forms are the bread and butter of web applications, and while making forms is getting easier for developers, users often still have a hard time with them. In these circumstances it is necessary to give them a help above and beyond ‘password’.