Tagged with Web Development
Web development related topics
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.
Events are the bread and butter of interactive websites. However, attaching and detaching events to the DOM can create memory leaks and performance issues due to time spent attaching events. This normally is not an issue, unless you are binding a large number of events.
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.
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